public class ReadOnlyServiceImpl extends Object implements ReadOnlyService, FSMCaller.LastAppliedLogIndexListener
| Constructor and Description |
|---|
ReadOnlyServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRequest(byte[] reqCtx,
ReadIndexClosure closure)
Adds a ReadIndex request.
|
void |
addRequest(ReadOnlyOption readOnlyOptions,
byte[] reqCtx,
ReadIndexClosure closure)
Adds a ReadIndex request.
|
boolean |
init(ReadOnlyServiceOptions opts)
Initialize the service.
|
void |
join()
Waits for service shutdown.
|
void |
onApplied(long appliedIndex)
Called when lastAppliedIndex updates.
|
void |
setError(RaftException error)
Called when the node is turned into error state.
|
void |
shutdown()
Dispose the resources for service.
|
public boolean init(ReadOnlyServiceOptions opts)
Lifecycleinit in interface Lifecycle<ReadOnlyServiceOptions>public void setError(RaftException error)
ReadOnlyServicesetError in interface ReadOnlyServiceerror - error with raft infopublic void shutdown()
Lifecycleshutdown in interface Lifecycle<ReadOnlyServiceOptions>public void join()
throws InterruptedException
ReadOnlyServicejoin in interface ReadOnlyServiceInterruptedException - if the current thread is interrupted
while waitingpublic void addRequest(byte[] reqCtx,
ReadIndexClosure closure)
ReadOnlyServiceaddRequest in interface ReadOnlyServicereqCtx - request context of readIndexclosure - callbackpublic void addRequest(ReadOnlyOption readOnlyOptions, byte[] reqCtx, ReadIndexClosure closure)
ReadOnlyServiceaddRequest in interface ReadOnlyServicereadOnlyOptions - how the read only request is processedreqCtx - request context of readIndexclosure - callbackpublic void onApplied(long appliedIndex)
onApplied in interface FSMCaller.LastAppliedLogIndexListenerappliedIndex - applied indexCopyright © 2024. All rights reserved.