@Test public void testGetLastWriteActionWithTimestamp() { String key = TestData.getSimpleString(); TObject value = TestData.getTObject(); long record = TestData.getLong(); add(key, value, record); long timestamp = Time.now(); remove(key, value, record); Assert.assertEquals(Action.ADD, ((Limbo) store).getLastWriteAction( Write.notStorable(key, value, record), timestamp)); }
@Nullable protected Action getLastWriteAction(Write write, long timestamp) { Action action = null; if(timestamp >= getOldestWriteTimestamp()) { Iterator<Write> it = iterator(); while (it.hasNext()) { Write stored = it.next(); if(stored.getVersion() <= timestamp) { if(stored.equals(write)) { action = stored.getType(); } } else { break; } } } return action; }
Limbo extends BaseStore implements Iterable<Write> { @Nullable protected Action getLastWriteAction(Write write, long timestamp) { Action action = null; if(timestamp >= getOldestWriteTimestamp()) { Iterator<Write> it = iterator(); while (it.hasNext()) { Write stored = it.next(); if(stored.getVersion() <= timestamp) { if(stored.equals(write)) { action = stored.getType(); } } else { break; } } } return action; } }
Limbo extends BaseStore implements Iterable<Write> { @Nullable protected Action getLastWriteAction(Write write, long timestamp) { Action action = null; if(timestamp >= getOldestWriteTimestamp()) { Iterator<Write> it = iterator(); while (it.hasNext()) { Write stored = it.next(); if(stored.getVersion() <= timestamp) { if(stored.equals(write)) { action = stored.getType(); } } else { break; } } } return action; }  }
Limbo extends BaseStore implements Iterable<Write> { @Nullable protected Action getLastWriteAction(Write write, long timestamp) { Action action = null; if(timestamp >= getOldestWriteTimestamp()) { Iterator<Write> it = iterator(); while (it.hasNext()) { Write stored = it.next(); if(stored.getVersion() <= timestamp) { if(stored.equals(write)) { action = stored.getType(); } } else { break; } } } return action; }  @Override Map<Long, String> audit(long record); @Override Map<Long, String> audit(String key, long record); @Override Map<TObject, Set<Long>> browse(String key); @Override Map<TObject, Set<Long>> browse(String key, long timestamp); Map<TObject, Set<Long>> browse(String key, long timestamp,
            Map<TObject, Set<Long>> context); @Override Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end); Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end, Map<Long, Set<TObject>> context); @Override boolean contains(long record); Set<String> describe(long record, long timestamp,
            Map<String, Set<TObject>> context); Map<Long, Set<TObject>> explore(Map<Long, Set<TObject>> context,
            long timestamp, String key, Operator operator, TObject... values); final Set<TObject> gather(String key, long record, long timestamp,
            Set<TObject> context); @Override Set<Long> getAllRecords(); int getDesiredTransportSleepTimeInMs(); final boolean insert(Write write); abstract boolean insert(Write write, boolean sync); @Override abstract Iterator<Write> iterator(); @Override Memory memory(); @Override Set<Long> search(String key, String query); @Override Map<String, Set<TObject>> select(long record); @Override Map<String, Set<TObject>> select(long record, long timestamp); Map<String, Set<TObject>> select(long record, long timestamp,
            Map<String, Set<TObject>> context); @Override Set<TObject> select(String key, long record); @Override Set<TObject> select(String key, long record, long timestamp); Set<TObject> select(String key, long record, long timestamp,
            Set<TObject> context); void sync(); final void transport(PermanentStore destination); void transport(PermanentStore destination, boolean syncAfterEach); @Override boolean verify(String key, TObject value, long record); @Override boolean verify(String key, TObject value, long record,
            long timestamp); boolean verify(Write write, boolean exists); boolean verify(Write write, long timestamp); boolean verify(Write write, long timestamp, boolean exists); final TernaryTruth verifyFast(Write write); final TernaryTruth verifyFast(Write write, Inventory inventory); TernaryTruth verifyFast(Write write, long timestamp); TernaryTruth verifyFast(Write write, long timestamp,
            Inventory inventory); void waitUntilTransportable(); }
Limbo extends BaseStore implements Iterable<Write> { @Nullable protected Action getLastWriteAction(Write write, long timestamp) { Action action = null; if(timestamp >= getOldestWriteTimestamp()) { Iterator<Write> it = iterator(); while (it.hasNext()) { Write stored = it.next(); if(stored.getVersion() <= timestamp) { if(stored.equals(write)) { action = stored.getType(); } } else { break; } } } return action; }  @Override Map<Long, String> audit(long record); @Override Map<Long, String> audit(String key, long record); @Override Map<TObject, Set<Long>> browse(String key); @Override Map<TObject, Set<Long>> browse(String key, long timestamp); Map<TObject, Set<Long>> browse(String key, long timestamp,
            Map<TObject, Set<Long>> context); @Override Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end); Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end, Map<Long, Set<TObject>> context); @Override boolean contains(long record); Set<String> describe(long record, long timestamp,
            Map<String, Set<TObject>> context); Map<Long, Set<TObject>> explore(Map<Long, Set<TObject>> context,
            long timestamp, String key, Operator operator, TObject... values); final Set<TObject> gather(String key, long record, long timestamp,
            Set<TObject> context); @Override Set<Long> getAllRecords(); int getDesiredTransportSleepTimeInMs(); final boolean insert(Write write); abstract boolean insert(Write write, boolean sync); @Override abstract Iterator<Write> iterator(); @Override Memory memory(); @Override Set<Long> search(String key, String query); @Override Map<String, Set<TObject>> select(long record); @Override Map<String, Set<TObject>> select(long record, long timestamp); Map<String, Set<TObject>> select(long record, long timestamp,
            Map<String, Set<TObject>> context); @Override Set<TObject> select(String key, long record); @Override Set<TObject> select(String key, long record, long timestamp); Set<TObject> select(String key, long record, long timestamp,
            Set<TObject> context); void sync(); final void transport(PermanentStore destination); void transport(PermanentStore destination, boolean syncAfterEach); @Override boolean verify(String key, TObject value, long record); @Override boolean verify(String key, TObject value, long record,
            long timestamp); boolean verify(Write write, boolean exists); boolean verify(Write write, long timestamp); boolean verify(Write write, long timestamp, boolean exists); final TernaryTruth verifyFast(Write write); final TernaryTruth verifyFast(Write write, Inventory inventory); TernaryTruth verifyFast(Write write, long timestamp); TernaryTruth verifyFast(Write write, long timestamp,
            Inventory inventory); void waitUntilTransportable();  }