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 int
CQ_BLOCK_SIZE
protected long
lastCommittedOffset
protected static String
OFFSET_QUEUE_PREFIX
protected net.openhft.chronicle.queue.impl.single.SingleChronicleQueue
offsetQueue
protected int
partition
protected ChronicleRetentionDuration
retention
-
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 void
close()
void
commit(long offset)
protected long
doReadLastCommittedOffset()
static boolean
exists(Path basePath, Name group)
static String
getGroupFromDirectory(String dirName)
long
getLastCommittedOffset()
Use a cache to return the last committed offset, concurrent consumer is not taken in account usereadLastCommittedOffset()
in concurrency.static boolean
isOffsetTracker(String dirName)
long
readLastCommittedOffset()
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:
close
in interfaceAutoCloseable
-
-