public class SnapshotExecutorImpl extends Object implements SnapshotExecutor
Describer.DefaultPrinter, Describer.Printer| 构造器和说明 |
|---|
SnapshotExecutorImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
describe(Describer.Printer out) |
void |
doSnapshot(Closure done)
Start to snapshot StateMachine, and |done| is called after the
execution finishes or fails.
|
long |
getLastSnapshotIndex()
Only for test
|
long |
getLastSnapshotTerm()
Only for test
|
NodeImpl |
getNode()
Return the owner NodeImpl
|
SnapshotStorage |
getSnapshotStorage()
Returns the backing snapshot storage
|
boolean |
init(SnapshotExecutorOptions opts)
Initialize the service.
|
void |
installSnapshot(RpcRequests.InstallSnapshotRequest request,
RpcRequests.InstallSnapshotResponse.Builder response,
RpcRequestClosure done)
Install snapshot according to the very RPC from leader
After the installing succeeds (StateMachine is reset with the snapshot)
or fails, done will be called to respond
Errors:
- Term mismatches: which happens interrupt_downloading_snapshot was
called before install_snapshot, indicating that this RPC was issued by
the old leader
|
void |
interruptDownloadingSnapshots(long newTerm)
Interrupt the downloading if possible.
|
boolean |
isInstallingSnapshot()
Returns true if this is currently installing a snapshot, either
downloading or loading.
|
void |
join()
Block the current thread until all the running job finishes (including failure)
|
void |
shutdown()
Dispose the resources for service.
|
@OnlyForTest public long getLastSnapshotTerm()
@OnlyForTest public long getLastSnapshotIndex()
public boolean init(SnapshotExecutorOptions opts)
Lifecycleinit 在接口中 Lifecycle<SnapshotExecutorOptions>public void shutdown()
Lifecycleshutdown 在接口中 Lifecycle<SnapshotExecutorOptions>public NodeImpl getNode()
SnapshotExecutorgetNode 在接口中 SnapshotExecutorpublic void doSnapshot(Closure done)
SnapshotExecutordoSnapshot 在接口中 SnapshotExecutordone - snapshot callbackpublic void installSnapshot(RpcRequests.InstallSnapshotRequest request, RpcRequests.InstallSnapshotResponse.Builder response, RpcRequestClosure done)
SnapshotExecutorinstallSnapshot 在接口中 SnapshotExecutorpublic void interruptDownloadingSnapshots(long newTerm)
SnapshotExecutorinterruptDownloadingSnapshots 在接口中 SnapshotExecutornewTerm - new term numpublic boolean isInstallingSnapshot()
SnapshotExecutorisInstallingSnapshot 在接口中 SnapshotExecutorpublic SnapshotStorage getSnapshotStorage()
SnapshotExecutorgetSnapshotStorage 在接口中 SnapshotExecutorpublic void join()
throws InterruptedException
SnapshotExecutorjoin 在接口中 SnapshotExecutorInterruptedExceptionpublic void describe(Describer.Printer out)
Copyright © 2021. All rights reserved.