@Override public void storeState(final Configuration configuration) { super.storeState(configuration); configuration.setProperty(PAGE_RANK_MEMORY_KEY, this.memoryKey); }
private void checkKeyValue(final String key, final Object value) { if (!this.memoryKeys.contains(key)) throw GraphComputer.Exceptions.providedKeyIsNotAMemoryComputeKey(key); MemoryHelper.validateValue(value); } }
public FulgoraMemory(final VertexProgram<?> vertexProgram, final Set<MapReduce> mapReducers) { this.currentMap = new ConcurrentHashMap<>(); this.previousMap = new ConcurrentHashMap<>(); if (null != vertexProgram) { for (final String key : vertexProgram.getMemoryComputeKeys()) { MemoryHelper.validateKey(key); this.memoryKeys.add(key); } } for (final MapReduce mapReduce : mapReducers) { this.memoryKeys.add(mapReduce.getMemoryKey()); } }
GraphComputerHelper.validateProgramOnComputer(this, vertexProgram); this.mapReduces.addAll(this.vertexProgram.getMapReducers()); this.persistMode = GraphComputerHelper.getPersistState(Optional.ofNullable(this.vertexProgram), Optional.ofNullable(this.persistMode)); this.resultGraphMode = GraphComputerHelper.getResultGraphState(Optional.ofNullable(this.vertexProgram), Optional.ofNullable(this.resultGraphMode)); return new DefaultComputerResult(resultgraph, this.memory); });
public void setVertexProgram(final VertexProgram vertexProgram) { this.vertexProgramPool = new VertexProgramPool(vertexProgram, this.numberOfWorkers); }
@Override public Element element() { final Element element = this.property.element(); if (element instanceof Vertex) return new ComputerVertex((Vertex) element); else if (element instanceof Edge) return new ComputerEdge((Edge) element); else return new ComputerVertexProperty((VertexProperty) element); }
@Override public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) { if (state.equals(State.MAP_REDUCE)) throw GraphComputer.Exceptions.incidentAndAdjacentElementsCanNotBeAccessedInMapReduce(); return new ComputerEdge(this.getBaseVertex().addEdge(label, inVertex, keyValues)); }
@Override public <U> Iterator<Property<U>> properties(final String... propertyKeys) { return IteratorUtils.map(super.properties(propertyKeys), property -> new ComputerProperty(property)); }
@Override public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) { return IteratorUtils.map(super.properties(propertyKeys), property -> new ComputerVertexProperty<V>((VertexProperty<V>) property)); }
@Override public <V> VertexProperty<V> property(final String key) { return new ComputerVertexProperty<>(this.getBaseVertex().property(key)); }
@Override public Vertex getBaseVertex() { return (Vertex) this.getBaseElement(); } }
@Override public VertexProperty<V> getBaseVertexProperty() { return (VertexProperty<V>) this.getBaseElement(); } }
@Override public Edge getBaseEdge() { return (Edge) this.getBaseElement(); } }
public default Memory asImmutable() { return new ImmutableMemory(this); } }
GraphComputerHelper.validateProgramOnComputer(this, vertexProgram); this.mapReduces.addAll(this.vertexProgram.getMapReducers()); this.persistMode = GraphComputerHelper.getPersistState(Optional.ofNullable(this.vertexProgram), Optional.ofNullable(this.persistMode)); this.resultGraphMode = GraphComputerHelper.getResultGraphState(Optional.ofNullable(this.vertexProgram), Optional.ofNullable(this.resultGraphMode)); return new DefaultComputerResult(resultgraph, this.memory); });
private void checkKeyValue(final String key, final Object value) { if (!this.memoryKeys.containsKey(key)) throw GraphComputer.Exceptions.providedKeyIsNotAMemoryComputeKey(key); MemoryHelper.validateValue(value); }
@Override public void storeState(final Configuration configuration) { super.storeState(configuration); configuration.setProperty(SHORTEST_DISTANCE_MEMORY_KEY, this.memoryKey); }
private MemoryComputeKey(final String key, final BinaryOperator<A> reducer, final boolean isBroadcast, final boolean isTransient) { this.key = key; this.reducer = reducer; this.isTransient = isTransient; this.isBroadcast = isBroadcast; MemoryHelper.validateKey(key); }
@Override public void storeState(final Configuration configuration) { super.storeState(configuration); configuration.setProperty(SHORTEST_DISTANCE_MEMORY_KEY, this.memoryKey); }
@Override public void storeState(final Configuration configuration) { super.storeState(configuration); configuration.setProperty(PAGE_RANK_MEMORY_KEY, this.memoryKey); }