public interface ReplicationManager extends Closeable
NO_REDO
durability will not pass through the replication manager.Modifier and Type | Interface and Description |
---|---|
static interface |
ReplicationManager.Writer |
Modifier and Type | Method and Description |
---|---|
void |
checkpointed(long position)
Indicates that all data prior to the given log position has been durably
checkpointed.
|
long |
encoding()
Return a fixed non-zero value which identifies the replication manager implementation
and its encoding format.
|
default void |
fenced(long position)
Called after a fence operation has been received and processed.
|
void |
flip()
Called to acknowledge mode change from replica to leader, or vice versa.
|
default void |
notifyDrop(Index index)
Notification to replica after an index is dropped.
|
default void |
notifyRename(Index index,
byte[] oldName,
byte[] newName)
Notification to replica after an index is renamed.
|
default void |
notifyStore(Index index,
byte[] key,
byte[] value)
Notification to replica when an entry is stored into an index.
|
int |
read(byte[] b,
int off,
int len)
Blocks at most once, reading as much replication input as possible.
|
long |
readPosition()
Returns the next position a replica will read from, which must be confirmed.
|
void |
recover(EventListener listener)
Called after replication threads have started, providing an opportunity to wait until
replication has sufficiently "caught up".
|
void |
start(long position)
Start the replication manager in replica mode.
|
void |
sync()
Durably flushes all local data to non-volatile storage, up to the current position.
|
default void |
syncConfirm(long position)
Durably flushes all local data to non-volatile storage, up to the given confirmed
position, and then blocks until fully confirmed.
|
void |
syncConfirm(long position,
long timeoutNanos)
Durably flushes all local data to non-volatile storage, up to the given confirmed
position, and then blocks until fully confirmed.
|
ReplicationManager.Writer |
writer()
Returns an object which allows the leader to write changes.
|
long encoding()
void start(long position) throws IOException
After started, the reported position
must match the one
provided to this method. The position can change only after read and write operations
have been performed.
position
- position to start reading from; 0 is the lowest positionIllegalArgumentException
- if position is negativeIllegalStateException
- if already startedIOException
void recover(EventListener listener) throws IOException
listener
- optional listener for posting recovery events toIOException
long readPosition()
int read(byte[] b, int off, int len) throws IOException
IllegalStateException
- if not startedIOException
void flip()
ReplicationManager.Writer writer() throws IOException
IOException
void sync() throws IOException
IOException
default void syncConfirm(long position) throws IOException
void syncConfirm(long position, long timeoutNanos) throws IOException
timeoutNanos
- pass -1 for infiniteConfirmationFailureException
IOException
void checkpointed(long position) throws IOException
position
- log position immediately after the checkpoint positionIOException
default void fenced(long position) throws IOException
position
- log position immediately after the fence operationIOException
default void notifyStore(Index index, byte[] key, byte[] value)
uncommitted
, and so loading with an appropriate lock
mode is required for confirmation. The current thread is free to perform any blocking
operations — it will not suspend replication processing unless all
replication threads are consumed.index
- non-null index referencekey
- non-null key; contents must not be modifiedvalue
- null if entry is deleted; contents can be modifieddefault void notifyRename(Index index, byte[] oldName, byte[] newName)
all
replication threads are consumed.index
- non-null index referenceoldName
- non-null old index namenewName
- non-null new index namedefault void notifyDrop(Index index)
all
replication threads are consumed.index
- non-null closed and dropped index referenceCopyright © 2011–2017 Cojen. All rights reserved.