Documentation ¶
Index ¶
- Constants
- type GlobalState
- type RequestNumberOrder
- type Server
- type Shard
- type WAL
- func (self *WAL) AssignSequenceNumbersAndLog(request *protocol.Request, shard Shard) (uint32, error)
- func (self *WAL) Close() error
- func (self *WAL) Commit(requestNumber uint32, serverId uint32) error
- func (self *WAL) RecoverServerFromLastCommit(serverId uint32, shardIds []uint32, ...) error
- func (self *WAL) RecoverServerFromRequestNumber(requestNumber uint32, shardIds []uint32, ...) error
- func (self *WAL) SetServerId(id uint32)
Constants ¶
View Source
const HOST_ID_OFFSET = uint64(10000)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GlobalState ¶
type GlobalState struct { // used for creating index entries CurrentFileSuffix int CurrentFileOffset int64 // keep track of the next request number LargestRequestNumber uint32 // used for rollover FirstSuffix int // last seq number used ShardLastSequenceNumber map[uint32]uint64 // committed request number per server ServerLastRequestNumber map[uint32]uint32 // contains filtered or unexported fields }
func (*GlobalState) LowestCommitedRequestNumber ¶
func (self *GlobalState) LowestCommitedRequestNumber() uint32
type RequestNumberOrder ¶
type RequestNumberOrder interface {
// contains filtered or unexported methods
}
type WAL ¶
type WAL struct {
// contains filtered or unexported fields
}
func NewWAL ¶
func NewWAL(config *configuration.Configuration) (*WAL, error)
func (*WAL) AssignSequenceNumbersAndLog ¶
func (self *WAL) AssignSequenceNumbersAndLog(request *protocol.Request, shard Shard) (uint32, error)
Will assign sequence numbers if null. Returns a unique id that should be marked as committed for each server as it gets confirmed.
func (*WAL) RecoverServerFromLastCommit ¶
func (*WAL) RecoverServerFromRequestNumber ¶
func (self *WAL) RecoverServerFromRequestNumber(requestNumber uint32, shardIds []uint32, yield func(request *protocol.Request, shardId uint32) error) error
In the case where this server is running and another one in the cluster stops responding, at some point this server will have to just write requests to disk. When the downed server comes back up, it's this server's responsibility to send out any writes that were queued up. If the yield function returns nil then the request is committed.
func (*WAL) SetServerId ¶
Click to show internal directories.
Click to hide internal directories.