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

Method dequeue

recipes/java-recipes/MicroQueue.java:46–61  ·  view source on GitHub ↗
(TransactionContext tcx)

Source from the content-addressed store, hash-verified

44
45 // Remove the top element from the queue.
46 public static Object dequeue(TransactionContext tcx){
47 // Remove from the top of the queue.
48 return tcx.run(new Function<Transaction,Void>(){
49 public Void apply(Transaction tr){
50 final KeyValue item = firstItem(tr);
51 if(item == null){
52 return null;
53 }
54
55 tr.clear(item.getKey());
56 // Return the old value.
57 return Tuple.fromBytes(item.getValue()).get(0);
58 }
59 });
60
61 }
62
63 // Add an element to the queue.
64 public static void enqueue(TransactionContext tcx, final Object value){

Callers 3

mainMethod · 0.95
gFunction · 0.80
jquery.jsFile · 0.80

Calls 1

runMethod · 0.65

Tested by

no test coverage detected