public class SequencerServer extends AbstractServer
It currently supports a single operation, which is a incoming request:
TOKEN_REQ - Request the next address.
The sequencer server maintains the current tail of the log, the current tail of every stream, and a cache of timestamps of updates on recent conflict-parameters.
A token request can be of several sub-types, which are defined in
TokenRequest
:
TokenRequest::TK_QUERY
- used for only querying the current tail
of the log and/or the tails of specific streams
TokenRequest::TK_RAW
- reserved for getting a "raw" token in the
global log
TokenRequest::TK_MULTI_STREAM
- used for logging across one or
more streams
TokenRequest::TK_TX
- used for reserving an address for transaction
commit.
The transaction commit is the most sophisticated functaionality of the sequencer. The sequencer reserves an address for the transaction only on if it knows that it can commit.
The TK_TX request contains a conflict-set and a write-set. The sequencer checks the conflict-set against the stream-tails and against the conflict-parameters timestamp cache it maintains. If the transaction commits, the sequencer updates the tails of all the streams and the cache of conflict parameters.
Created by mwei on 12/8/15.
Modifier and Type | Class and Description |
---|---|
static class |
SequencerServer.Config
Sequencer server configuration
|
AbstractServer.ServerState
Constructor and Description |
---|
SequencerServer(ServerContext serverContext)
Returns a new SequencerServer.
|
Modifier and Type | Method and Description |
---|---|
ExecutorService |
getExecutor() |
void |
handleMetricsRequest(CorfuMsg msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming metrics request with the metrics response.
|
boolean |
isServerReadyToHandleMsg(CorfuMsg msg) |
void |
resetServer(CorfuPayloadMsg<SequencerRecoveryMsg> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming request to reset the sequencer.
|
void |
shutdown()
Shutdown the server.
|
void |
tokenRequest(CorfuPayloadMsg<TokenRequest> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming token request.
|
void |
trimCache(CorfuPayloadMsg<Long> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r) |
getHandler, getState, handleMessage, sealServerWithEpoch, setState
public SequencerServer(ServerContext serverContext)
serverContext
- context object providing parameters and objectspublic boolean isServerReadyToHandleMsg(CorfuMsg msg)
isServerReadyToHandleMsg
in class AbstractServer
public ExecutorService getExecutor()
getExecutor
in class AbstractServer
public void trimCache(CorfuPayloadMsg<Long> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void resetServer(CorfuPayloadMsg<SequencerRecoveryMsg> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void handleMetricsRequest(CorfuMsg msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void tokenRequest(CorfuPayloadMsg<TokenRequest> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void shutdown()
AbstractServer
shutdown
in class AbstractServer
Copyright © 2019 CorfuDB. All rights reserved.