Segment implements Itemizable, Syncable { public Receipt transfer(Write write) { try { return transfer(write, new AwaitableExecutorService( MoreExecutors.newDirectExecutorService())); } catch (InterruptedException e) { throw CheckedExceptions.wrapAsRuntimeException(e); } } private  Segment(int expectedInsertions); private  Segment(Path file); static Segment create(); static Segment create(int expectedInsertions); static Segment load(Path file); CorpusChunk corpus(); @Override long count(); @Override boolean equals(Object other); @Override void fsync(Path file); @Override int hashCode(); String id(); IndexChunk index(); String label(); boolean isMutable(); Segment reindex(); double similarityWith(Segment other); long size(); TableChunk table(); @Override String toString(); Receipt transfer(Write write); Receipt transfer(Write write, AwaitableExecutorService executor); Stream<Write> writes(); static Comparator<Segment> TEMPORAL_COMPARATOR; }
@Test public void testRevisionTimestampTracking() { Write w0 = TestData.getWriteRemove(); Write w1 = TestData.getWriteAdd(); segment.transfer(w1); Assert.assertEquals(w1.getVersion(), segment.minTs); Assert.assertEquals(w1.getVersion(), segment.maxTs); Write w2 = TestData.getWriteAdd(); segment.transfer(w2); Assert.assertEquals(w1.getVersion(), segment.minTs); Assert.assertEquals(w2.getVersion(), segment.maxTs); Write w4 = TestData.getWriteAdd(); Write w3 = TestData.getWriteAdd(); segment.transfer(w3); Assert.assertEquals(w3.getVersion(), segment.maxTs); segment.transfer(w4); Assert.assertEquals(w3.getVersion(), segment.maxTs); segment.transfer(w0); Assert.assertEquals(w0.getVersion(), segment.minTs); }