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

Method push

recipes/java-recipes/MicroPriority.java:45–55  ·  view source on GitHub ↗
(TransactionContext tcx, final Object value, final int priority)

Source from the content-addressed store, hash-verified

43 // TODO The next six methods are all in the recipe book:
44 // push, nextCount, pop (x2), and peek (x2).
45 public static void push(TransactionContext tcx, final Object value, final int priority){
46 tcx.run(new Function<Transaction,Void>() {
47 public Void apply(Transaction tr){
48 byte[] rands = new byte[20];
49 randno.nextBytes(rands);
50 tr.set(pq.subspace(Tuple.from(priority, nextCount(tr,priority),rands)).pack(),
51 Tuple.from(value).pack());
52 return null;
53 }
54 });
55 }
56
57 private static long nextCount(TransactionContext tcx, final int priority){
58 return tcx.run(new Function<Transaction,Long>() {

Callers 2

smokeTestMethod · 0.95
to_tuplesFunction · 0.45

Calls 1

runMethod · 0.65

Tested by

no test coverage detected