public class LogUnitServer extends AbstractServer
A Log Unit Server, which is responsible for providing the persistent storage for the Corfu Distributed Shared Log.
All reads and writes go through a cache. For persistence, every 10,000 log entries are written to individual files (logs), which are represented as FileHandles. Each FileHandle contains a pointer to the tail of the file, a memory-mapped file channel, and a set of addresses known to be in the file. To append an entry, the pointer to the tail is first extended to the length of the entry, and the entry is added to the set of known addresses. A header is written, which consists of the ASCII characters LE, followed by a set of flags, the log unit address, the size of the entry, then the metadata size, metadata and finally the entry itself . When the entry is complete, a written flag is set in the flags field.
Modifier and Type | Class and Description |
---|---|
static class |
LogUnitServer.LogUnitServerConfig
Log unit server configuration class
|
AbstractServer.ServerState
Constructor and Description |
---|
LogUnitServer(ServerContext serverContext)
Returns a new LogUnitServer.
|
Modifier and Type | Method and Description |
---|---|
com.github.benmanes.caffeine.cache.LoadingCache<Long,ILogData> |
getDataCache() |
ExecutorService |
getExecutor() |
void |
handleLogAddressSpaceRequest(CorfuMsg msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming request for log address space, i.e., the map of addresses for every stream in the log.
|
void |
handleTailRequest(CorfuPayloadMsg<TailsRequest> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming request for maximum global address the log unit server has written.
|
void |
handleTrimMarkRequest(CorfuMsg msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming request to retrieve the starting address of this logging unit.
|
boolean |
isServerReadyToHandleMsg(CorfuMsg msg) |
void |
rangeWrite(CorfuPayloadMsg<RangeWriteMsg> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Services incoming range write calls.
|
void |
sealServerWithEpoch(long epoch)
Seal the server with the epoch.
|
void |
shutdown()
Shutdown the server.
|
void |
write(CorfuPayloadMsg<WriteRequest> msg,
io.netty.channel.ChannelHandlerContext ctx,
IServerRouter r)
Service an incoming write request.
|
getHandler, getState, handleMessage, setState
public LogUnitServer(ServerContext serverContext)
serverContext
- context object providing settings and objectspublic ExecutorService getExecutor()
getExecutor
in class AbstractServer
public void handleTailRequest(CorfuPayloadMsg<TailsRequest> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void handleLogAddressSpaceRequest(CorfuMsg msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void handleTrimMarkRequest(CorfuMsg msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void write(CorfuPayloadMsg<WriteRequest> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void rangeWrite(CorfuPayloadMsg<RangeWriteMsg> msg, io.netty.channel.ChannelHandlerContext ctx, IServerRouter r)
public void sealServerWithEpoch(long epoch)
- A seal operation is inserted in the queue and then we wait to flush all operations in the queue before this operation. - All operations after this operation but stamped with an older epoch will be failed.
sealServerWithEpoch
in class AbstractServer
epoch
- Epoch to seal withpublic boolean isServerReadyToHandleMsg(CorfuMsg msg)
isServerReadyToHandleMsg
in class AbstractServer
public void shutdown()
shutdown
in class AbstractServer
Copyright © 2019 CorfuDB. All rights reserved.