Class ChronicleLogOffsetTracker
- java.lang.Object
-
- org.nuxeo.lib.stream.log.chronicle.ChronicleLogOffsetTracker
-
- All Implemented Interfaces:
AutoCloseable
public class ChronicleLogOffsetTracker extends Object implements AutoCloseable
Track committed offset for a Log.- Since:
- 9.3
-
-
Field Summary
Fields Modifier and Type Field Description static intCQ_BLOCK_SIZEprotected longlastCommittedOffsetprotected static StringOFFSET_QUEUE_PREFIXprotected net.openhft.chronicle.queue.impl.single.SingleChronicleQueueoffsetQueueprotected intpartitionprotected ChronicleRetentionDurationretention
-
Constructor Summary
Constructors Constructor Description ChronicleLogOffsetTracker(String basePath, int partition, Name group, ChronicleRetentionDuration retention)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcommit(long offset)protected longdoReadLastCommittedOffset()static booleanexists(Path basePath, Name group)static StringgetGroupFromDirectory(String dirName)longgetLastCommittedOffset()Use a cache to return the last committed offset, concurrent consumer is not taken in account usereadLastCommittedOffset()in concurrency.static booleanisOffsetTracker(String dirName)longreadLastCommittedOffset()Read the last committed offset from the file.
-
-
-
Field Detail
-
OFFSET_QUEUE_PREFIX
protected static final String OFFSET_QUEUE_PREFIX
- See Also:
- Constant Field Values
-
CQ_BLOCK_SIZE
public static final int CQ_BLOCK_SIZE
- See Also:
- Constant Field Values
-
offsetQueue
protected final net.openhft.chronicle.queue.impl.single.SingleChronicleQueue offsetQueue
-
partition
protected final int partition
-
lastCommittedOffset
protected long lastCommittedOffset
-
retention
protected final ChronicleRetentionDuration retention
-
-
Constructor Detail
-
ChronicleLogOffsetTracker
public ChronicleLogOffsetTracker(String basePath, int partition, Name group, ChronicleRetentionDuration retention)
-
-
Method Detail
-
isOffsetTracker
public static boolean isOffsetTracker(String dirName)
-
getLastCommittedOffset
public long getLastCommittedOffset()
Use a cache to return the last committed offset, concurrent consumer is not taken in account usereadLastCommittedOffset()in concurrency.
-
readLastCommittedOffset
public long readLastCommittedOffset()
Read the last committed offset from the file.
-
doReadLastCommittedOffset
protected long doReadLastCommittedOffset()
-
commit
public void commit(long offset)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-