DefaultStandbyHeadReader implements StandbyHeadReader { @Override public String readHeadRecordId() { RecordId persistedHead = readPersistedHeadWithRetry(store, timeout); return persistedHead != null ? persistedHead.toString() : null; } DefaultStandbyHeadReader(FileStore store, long timeout); @Override String readHeadRecordId();  }
@Test public void shouldReturnHeadSegmentId() throws Exception { try (FileStore store = newFileStore()) { store.flush(); DefaultStandbyHeadReader reader = new DefaultStandbyHeadReader(store, 0L); assertEquals(store.getRevisions().getPersistedHead().toString(), reader.readHeadRecordId()); } }
@Test public void shouldWaitForFlushAndReturnHeadSegmentId() throws Exception { try (FileStore store = newFileStore()) { DefaultStandbyHeadReader reader = new DefaultStandbyHeadReader(store, 10_000L); assertNotNull(reader.readHeadRecordId()); assertEquals(store.getRevisions().getPersistedHead().toString(), reader.readHeadRecordId()); } }