public class RaftServiceContext extends Object implements io.atomix.primitive.service.ServiceContext
| Constructor and Description |
|---|
RaftServiceContext(io.atomix.primitive.PrimitiveId primitiveId,
String serviceName,
io.atomix.primitive.PrimitiveType primitiveType,
io.atomix.primitive.service.ServiceConfig config,
io.atomix.primitive.service.PrimitiveService service,
io.atomix.protocols.raft.impl.RaftContext raft,
io.atomix.utils.concurrent.ThreadContextFactory threadContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
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() |
io.atomix.primitive.operation.OperationType |
currentOperation() |
io.atomix.primitive.session.Session |
currentSession() |
io.atomix.protocols.raft.impl.OperationResult |
executeCommand(long index,
long sequence,
long timestamp,
RaftSession session,
io.atomix.primitive.operation.PrimitiveOperation operation)
Executes the given command on the state machine.
|
CompletableFuture<io.atomix.protocols.raft.impl.OperationResult> |
executeQuery(long index,
long sequence,
long timestamp,
RaftSession session,
io.atomix.primitive.operation.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.
|
io.atomix.utils.time.LogicalClock |
logicalClock() |
long |
openSession(long index,
long timestamp,
RaftSession session)
Registers the given session.
|
io.atomix.utils.serializer.Serializer |
serializer() |
<C extends io.atomix.primitive.service.ServiceConfig> |
serviceConfig() |
io.atomix.primitive.PrimitiveId |
serviceId() |
String |
serviceName() |
io.atomix.primitive.PrimitiveType |
serviceType() |
void |
takeSnapshot(io.atomix.protocols.raft.storage.snapshot.SnapshotWriter writer)
Takes a snapshot of the service state.
|
String |
toString() |
io.atomix.utils.time.WallClock |
wallClock() |
public RaftServiceContext(io.atomix.primitive.PrimitiveId primitiveId,
String serviceName,
io.atomix.primitive.PrimitiveType primitiveType,
io.atomix.primitive.service.ServiceConfig config,
io.atomix.primitive.service.PrimitiveService service,
io.atomix.protocols.raft.impl.RaftContext raft,
io.atomix.utils.concurrent.ThreadContextFactory threadContextFactory)
public io.atomix.primitive.PrimitiveId serviceId()
serviceId in interface io.atomix.primitive.service.ServiceContextpublic String serviceName()
serviceName in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.primitive.PrimitiveType serviceType()
serviceType in interface io.atomix.primitive.service.ServiceContextpublic <C extends io.atomix.primitive.service.ServiceConfig> C serviceConfig()
serviceConfig in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.utils.serializer.Serializer serializer()
public long currentIndex()
currentIndex in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.primitive.session.Session currentSession()
currentSession in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.primitive.operation.OperationType currentOperation()
currentOperation in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.utils.time.LogicalClock logicalClock()
logicalClock in interface io.atomix.primitive.service.ServiceContextpublic io.atomix.utils.time.WallClock wallClock()
wallClock in interface io.atomix.primitive.service.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,
io.atomix.primitive.operation.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 CompletableFuture<io.atomix.protocols.raft.impl.OperationResult> executeQuery(long index, long sequence, long timestamp, RaftSession session, io.atomix.primitive.operation.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.Copyright © 2013–2018. All rights reserved.