public interface LogStream extends AutoCloseable
Opening the log stream will start the indexing of the current existing log storage. The log
storage will separated into blocks, these blocks will be indexed by an LogController. The
LogBlockIndex is available and can be accessed via getLogBlockIndex().
The LogStream will append available events to the log storage with the help of an
LogController. The events are read from a given Dispatcher, if available. This can be stopped
with the closeAppender() method and re-/started with LogStream#openLogStreamController(AgentRunnerService) or LogStream#openLogStreamController(AgentRunnerService, int).
To access the current LogStorage the getLogStorage() can be used. The close() method will close all LogController and the log storage.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_APPEND_BLOCK_SIZE |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the log stream synchronously.
|
ActorFuture<Void> |
closeAppender()
Stops the streaming to the log storage.
|
ActorFuture<Void> |
closeAsync()
Closes the log stream asynchronous.
|
long |
getCommitPosition() |
LogBlockIndex |
getLogBlockIndex()
Returns the LogBlockIndex object, which is used for indexing the LogStorage.
|
LogBlockIndexWriter |
getLogBlockIndexWriter()
Returns the log block index controller, which creates periodically the block index for the log
storage.
|
String |
getLogName()
Returns the name of the log stream.
|
LogStorage |
getLogStorage()
Returns the log storage, which is accessed by the LogStream.
|
LogStorageAppender |
getLogStorageAppender()
Returns the log stream controller, which streams the logged events from the write buffer into
the log storage.
|
int |
getPartitionId() |
int |
getTerm() |
Dispatcher |
getWriteBuffer()
Returns the writeBuffer, which is used by the LogStreamController to stream the content into
the log storage.
|
ActorFuture<LogStorageAppender> |
openAppender()
This method delegates to
#openLogStreamController(AgentRunnerService, int). |
void |
registerOnAppendCondition(ActorCondition condition) |
void |
registerOnCommitPositionUpdatedCondition(ActorCondition condition) |
void |
removeOnAppendCondition(ActorCondition condition) |
void |
removeOnCommitPositionUpdatedCondition(ActorCondition condition) |
void |
setCommitPosition(long commitPosition)
Sets the log streams commit position to the given position.
|
void |
setTerm(int term)
Sets the log streams term.
|
void |
truncate(long position)
Truncates the log stream from the given position to the end of the stream.
|
static final int DEFAULT_MAX_APPEND_BLOCK_SIZE
int getPartitionId()
String getLogName()
void close()
close in interface AutoCloseableActorFuture<Void> closeAsync()
long getCommitPosition()
void setCommitPosition(long commitPosition)
int getTerm()
void setTerm(int term)
LogStorage getLogStorage()
LogBlockIndex getLogBlockIndex()
Dispatcher getWriteBuffer()
LogStorageAppender getLogStorageAppender()
LogBlockIndexWriter getLogBlockIndexWriter()
ActorFuture<Void> closeAppender()
ActorFuture<LogStorageAppender> openAppender()
#openLogStreamController(AgentRunnerService, int).
The DEFAULT_MAX_APPEND_BLOCK_SIZE is used as default max append block size and the
old agent runner service is reused.
#openLogStreamController(AgentRunnerService, int)}void truncate(long position)
position - the position to start the truncationvoid registerOnCommitPositionUpdatedCondition(ActorCondition condition)
void removeOnCommitPositionUpdatedCondition(ActorCondition condition)
void registerOnAppendCondition(ActorCondition condition)
void removeOnAppendCondition(ActorCondition condition)
Copyright © 2017–2018 camunda services GmbH. All rights reserved.