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.PrimitiveService service,
io.atomix.protocols.raft.impl.RaftContext raft,
io.atomix.utils.concurrent.ThreadContextFactory threadContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
closeSession(long index,
long timestamp,
RaftSession session,
boolean expired)
Unregister the given session.
|
CompletableFuture<Void> |
completeKeepAlive(long index,
long timestamp)
Completes a keep-alive.
|
CompletableFuture<Void> |
completeSnapshot(long index)
Completes a snapshot of the service state.
|
long |
currentIndex() |
io.atomix.primitive.operation.OperationType |
currentOperation() |
io.atomix.primitive.session.Session |
currentSession() |
CompletableFuture<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.
|
io.atomix.utils.concurrent.ThreadContext |
executor()
Returns the state machine executor.
|
boolean |
isUnderHighLoad()
Returns a boolean indicating whether the service is under high load.
|
CompletableFuture<Boolean> |
keepAlive(long index,
long timestamp,
RaftSession session,
long commandSequence,
long eventIndex)
Keeps the given session alive.
|
CompletableFuture<Void> |
keepAliveSessions(long index,
long timestamp)
Keeps all sessions alive using the given timestamp.
|
io.atomix.utils.time.LogicalClock |
logicalClock() |
CompletableFuture<Long> |
openSession(long index,
long timestamp,
RaftSession session)
Registers the given session.
|
io.atomix.primitive.PrimitiveId |
serviceId() |
String |
serviceName() |
io.atomix.primitive.PrimitiveType |
serviceType() |
io.atomix.primitive.session.Sessions |
sessions() |
CompletableFuture<Long> |
takeSnapshot(long index)
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.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 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 io.atomix.primitive.session.Sessions sessions()
sessions in interface io.atomix.primitive.service.ServiceContextpublic boolean isUnderHighLoad()
public io.atomix.utils.concurrent.ThreadContext executor()
public CompletableFuture<Long> takeSnapshot(long index)
index - takes a snapshot at the given indexpublic CompletableFuture<Void> completeSnapshot(long index)
index - the index of the snapshot to completepublic CompletableFuture<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 CompletableFuture<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 CompletableFuture<Void> completeKeepAlive(long index, long timestamp)
index - the keep-alive indextimestamp - the keep-alive timestamppublic CompletableFuture<Void> keepAliveSessions(long index, long timestamp)
index - the index of the timestamptimestamp - the timestamp with which to reset session timeoutspublic CompletableFuture<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 CompletableFuture<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.