public interface Memory
GraphComputer
is a global data structure where by vertices can communicate information with one another.
Moreover, it also contains global information about the state of the computation such as runtime and the current iteration.
The Memory data is logically updated in parallel using associative/commutative methods which have embarrassingly parallel implementations.Modifier and Type | Interface and Description |
---|---|
static interface |
Memory.Admin
The Admin interface is used by the
GraphComputer to update the Memory. |
static class |
Memory.Exceptions |
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
Object value)
Set the value of the provided key.
|
default Map<String,Object> |
asMap()
A helper method that generates a
Map of the memory key/values. |
default boolean |
exists(String key)
Whether the key exists in the memory.
|
<R> R |
get(String key)
Get the value associated with the provided key.
|
int |
getIteration()
Get the current iteration number.
|
long |
getRuntime()
Get the amount of milliseconds the
GraphComputer has been executing thus far. |
default boolean |
isInitialIteration()
A helper method that states whether the current iteration is 0.
|
Set<String> |
keys()
The set of keys currently associated with this memory.
|
void |
set(String key,
Object value) |
default boolean exists(String key)
key
- key to search the memory for.Set<String> keys()
<R> R get(String key) throws IllegalArgumentException
R
- the type of the valuekey
- the key of the valueIllegalArgumentException
- is thrown if the key does not existvoid set(String key, Object value) throws IllegalArgumentException, IllegalStateException
void add(String key, Object value) throws IllegalArgumentException, IllegalStateException
VertexProgram
. If this is called during execute(), there is no guarantee as to the ultimately stored
value as call order is indeterminate. It is up to the implementation to determine the states in which this
method can be called.key
- they key to set a value forvalue
- the value to set for the keyIllegalArgumentException
IllegalStateException
default Map<String,Object> asMap()
Map
of the memory key/values.int getIteration()
long getRuntime()
GraphComputer
has been executing thus far.default boolean isInitialIteration()
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.