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

Method enqueue

recipes/java-recipes/MicroQueue.java:64–75  ·  view source on GitHub ↗
(TransactionContext tcx, final Object value)

Source from the content-addressed store, hash-verified

62
63 // Add an element to the queue.
64 public static void enqueue(TransactionContext tcx, final Object value){
65 tcx.run(new Function<Transaction,Void>() {
66 public Void apply(Transaction tr){
67 byte[] rands = new byte[20];
68 randno.nextBytes(rands); // Create random seed to avoid conflicts.
69 tr.set(queue.subspace(Tuple.from(lastIndex(tr)+1, rands)).pack(),
70 Tuple.from(value).pack());
71
72 return null;
73 }
74 });
75 }
76
77 // Get the top element of the queue.
78 private static KeyValue firstItem(TransactionContext tcx){

Callers 1

mainMethod · 0.95

Calls 1

runMethod · 0.65

Tested by

no test coverage detected