MCPcopy Create free account
hub / github.com/apple/foundationdb / updateEdgeWeight

Method updateEdgeWeight

recipes/java-recipes/MicroGraph.java:111–122  ·  view source on GitHub ↗
(TransactionContext tcx, final String node, final String neighbor, final long change)

Source from the content-addressed store, hash-verified

109 }
110
111 public static void updateEdgeWeight(TransactionContext tcx, final String node, final String neighbor, final long change){
112 tcx.run(new Function<Transaction,Void>() {
113 public Void apply(Transaction tr){
114 ByteBuffer b = ByteBuffer.allocate(8);
115 b.order(ByteOrder.LITTLE_ENDIAN);
116 b.putLong(change);
117 tr.mutate(MutationType.ADD, wEdge.pack(Tuple.from(node,neighbor)), b.array());
118 tr.mutate(MutationType.ADD, wInverse.pack(Tuple.from(neighbor,node)), b.array());
119 return null;
120 }
121 });
122 }
123
124 public static long getWeight(TransactionContext tcx, final String node, final String neighbor){
125 return tcx.run(new Function<Transaction,Long>() {

Callers 1

smokeTestMethod · 0.95

Calls 1

runMethod · 0.65

Tested by

no test coverage detected