wal

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2014 License: MIT Imports: 17 Imported by: 0

Documentation

Index

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 Server

type Server interface {
	GetId() uint32
}

type Shard

type Shard interface {
	Id() uint32
}

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) Close

func (self *WAL) Close() error

func (*WAL) Commit

func (self *WAL) Commit(requestNumber uint32, serverId uint32) error

Marks a given request for a given server as committed

func (*WAL) CreateCheckpoint added in v0.5.2

func (self *WAL) CreateCheckpoint() error

func (*WAL) RecoverServerFromLastCommit

func (self *WAL) RecoverServerFromLastCommit(serverId uint32, shardIds []uint32, yield func(request *protocol.Request, shardId uint32) error) error

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

func (self *WAL) SetServerId(id uint32)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL