public class RaftServiceContext extends java.lang.Object implements ServiceContext
| Constructor and Description |
|---|
RaftServiceContext(PrimitiveId primitiveId,
java.lang.String serviceName,
PrimitiveType primitiveType,
ServiceConfig config,
PrimitiveService service,
io.atomix.protocols.raft.impl.RaftContext raft,
io.atomix.utils.concurrent.ThreadContextFactory threadContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the service context.
|
void |
closeSession(long index,
long timestamp,
RaftSession session,
boolean expired)
Unregister the given session.
|
void |
completeKeepAlive(long index,
long timestamp)
Completes a keep-alive.
|
long |
currentIndex() |
OperationType |
currentOperation() |
Session |
currentSession() |
boolean |
deleted()
Returns a boolean indicating whether the service has been deleted.
|
io.atomix.protocols.raft.impl.OperationResult |
executeCommand(long index,
long sequence,
long timestamp,
RaftSession session,
PrimitiveOperation operation)
Executes the given command on the state machine.
|
java.util.concurrent.CompletableFuture<io.atomix.protocols.raft.impl.OperationResult> |
executeQuery(long index,
long sequence,
long timestamp,
RaftSession session,
PrimitiveOperation operation)
Executes the given query on the state machine.
|
void |
installSnapshot(io.atomix.protocols.raft.storage.snapshot.SnapshotReader reader)
Installs a snapshot.
|
boolean |
keepAlive(long index,
long timestamp,
RaftSession session,
long commandSequence,
long eventIndex)
Keeps the given session alive.
|
void |
keepAliveSessions(long index,
long timestamp)
Keeps all sessions alive using the given timestamp.
|
MemberId |
localMemberId() |
LogicalClock |
logicalClock() |
long |
openSession(long index,
long timestamp,
RaftSession session)
Registers the given session.
|
Serializer |
serializer() |
<C extends ServiceConfig> |
serviceConfig() |
PrimitiveId |
serviceId() |
java.lang.String |
serviceName() |
PrimitiveType |
serviceType() |
void |
takeSnapshot(io.atomix.protocols.raft.storage.snapshot.SnapshotWriter writer)
Takes a snapshot of the service state.
|
java.lang.String |
toString() |
WallClock |
wallClock() |
public RaftServiceContext(PrimitiveId primitiveId, java.lang.String serviceName, PrimitiveType primitiveType, ServiceConfig config, PrimitiveService service, io.atomix.protocols.raft.impl.RaftContext raft, io.atomix.utils.concurrent.ThreadContextFactory threadContextFactory)
public boolean deleted()
public MemberId localMemberId()
localMemberId in interface ServiceContextpublic PrimitiveId serviceId()
serviceId in interface ServiceContextpublic java.lang.String serviceName()
serviceName in interface ServiceContextpublic PrimitiveType serviceType()
serviceType in interface ServiceContextpublic <C extends ServiceConfig> C serviceConfig()
serviceConfig in interface ServiceContextpublic Serializer serializer()
public long currentIndex()
currentIndex in interface ServiceContextpublic Session currentSession()
currentSession in interface ServiceContextpublic OperationType currentOperation()
currentOperation in interface ServiceContextpublic LogicalClock logicalClock()
logicalClock in interface ServiceContextpublic WallClock wallClock()
wallClock in interface ServiceContextpublic void installSnapshot(io.atomix.protocols.raft.storage.snapshot.SnapshotReader reader)
public void takeSnapshot(io.atomix.protocols.raft.storage.snapshot.SnapshotWriter writer)
public long openSession(long index,
long timestamp,
RaftSession session)
index - The index of the registration.timestamp - The timestamp of the registration.session - The session to register.public boolean keepAlive(long index,
long timestamp,
RaftSession session,
long commandSequence,
long eventIndex)
index - The index of the keep-alive.timestamp - The timestamp of the keep-alive.session - The session to keep-alive.commandSequence - The session command sequence number.eventIndex - The session event index.public void completeKeepAlive(long index,
long timestamp)
index - the keep-alive indextimestamp - the keep-alive timestamppublic void keepAliveSessions(long index,
long timestamp)
index - the index of the timestamptimestamp - the timestamp with which to reset session timeoutspublic void closeSession(long index,
long timestamp,
RaftSession session,
boolean expired)
index - The index of the unregister.timestamp - The timestamp of the unregister.session - The session to unregister.expired - Whether the session was expired by the leader.public io.atomix.protocols.raft.impl.OperationResult executeCommand(long index,
long sequence,
long timestamp,
RaftSession session,
PrimitiveOperation operation)
index - The index of the command.timestamp - The timestamp of the command.sequence - The command sequence number.session - The session that submitted the command.operation - The command to execute.public java.util.concurrent.CompletableFuture<io.atomix.protocols.raft.impl.OperationResult> executeQuery(long index,
long sequence,
long timestamp,
RaftSession session,
PrimitiveOperation operation)
index - The index of the query.sequence - The query sequence number.timestamp - The timestamp of the query.session - The session that submitted the query.operation - The query to execute.public void close()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2013-2019. All Rights Reserved.