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

Method apply

recipes/java-recipes/MicroSpatialTest.java:76–93  ·  view source on GitHub ↗
(Transaction tr)

Source from the content-addressed store, hash-verified

74 public static void setLocation(TransactionContext tcx, final String label, final long[] pos){
75 tcx.run(new Function<Transaction,Void>() {
76 public Void apply(Transaction tr){
77 long z = xyToZ(pos);
78 boolean isPrevious = false;
79 long previous = 0l;
80
81 for(KeyValue kv : tr.getRange(labelZ.subspace(Tuple.from(label)).range(),1)){
82 isPrevious = true;
83 previous = Tuple.fromBytes(kv.getKey()).getLong(2);
84 }
85
86 if(isPrevious){
87 tr.clear(labelZ.pack(Tuple.from(label,previous)));
88 tr.clear(zLabel.pack(Tuple.from(previous,label)));
89 }
90 tr.set(labelZ.pack(Tuple.from(label,z)),Tuple.from().pack());
91 tr.set(zLabel.pack(Tuple.from(z,label)),Tuple.from().pack());
92 return null;
93 }
94 });
95 }
96

Callers

nothing calls this directly

Calls 12

xyToZMethod · 0.95
fromMethod · 0.95
fromBytesMethod · 0.95
tupleRepMethod · 0.95
getRangeMethod · 0.65
getKeyMethod · 0.65
clearMethod · 0.65
setMethod · 0.65
rangeMethod · 0.45
subspaceMethod · 0.45
getLongMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected