Documentation ¶
Overview ¶
Package types defines required types of kayak.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotLeader represents current node is not a peer leader. ErrNotLeader = errors.New("not leader") // ErrNotFollower represents current node is not a peer follower. ErrNotFollower = errors.New("not follower") // ErrPrepareTimeout represents timeout failure for prepare operation. ErrPrepareTimeout = errors.New("prepare timeout") // ErrPrepareFailed represents failure for prepare operation. ErrPrepareFailed = errors.New("prepare failed") // ErrInvalidLog represents log is invalid. ErrInvalidLog = errors.New("invalid log") // ErrNotInPeer represents current node does not exists in peer list. ErrNotInPeer = errors.New("node not in peer") // ErrInvalidConfig represents invalid kayak runtime config. ErrInvalidConfig = errors.New("invalid runtime config") // ErrStopped represents runtime not started. ErrStopped = errors.New("stopped") )
Functions ¶
This section is empty.
Types ¶
type ApplyRequest ¶
ApplyRequest defines the apply request entity.
type FetchRequest ¶
FetchRequest defines the fetch request entity.
type FetchResponse ¶
FetchResponse defines the fetch response entity.
type Handler ¶
type Handler interface { EncodePayload(req interface{}) (data []byte, err error) DecodePayload(data []byte) (req interface{}, err error) Check(request interface{}) error Commit(request interface{}, isLeader bool) (result interface{}, err error) }
Handler defines the main underlying fsm of kayak.
type Log ¶
type Log struct { LogHeader // Data could be detected and handle decode properly by log layer Data []byte }
Log defines the log data structure.
type LogHeader ¶
type LogHeader struct { Index uint64 // log index Version uint64 // log version Type LogType // log type Producer proto.NodeID // producer node DataLength uint64 // data length }
LogHeader defines the checksum header structure.
type LogType ¶
type LogType uint16
LogType defines the log type.
const ( // LogPrepare defines the prepare phase of a commit. LogPrepare LogType = iota // LogRollback defines the rollback phase of a commit. LogRollback // LogCommit defines the commit phase of a commit. LogCommit // LogCheckpoint defines the checkpoint log (created/virtually created by block production or log truncation). LogCheckpoint // LogBarrier defines barrier log, all open windows should be waiting this operations to complete. LogBarrier // LogNoop defines noop log. LogNoop )
type RuntimeConfig ¶
type RuntimeConfig struct { // underlying handler. Handler Handler // minimum rpc success node percent requirement for prepare operation. PrepareThreshold float64 // minimum rpc success node percent requirement for commit operation. CommitThreshold float64 // maximum allowed time for prepare operation. PrepareTimeout time.Duration // maximum allowed time for commit operation. CommitTimeout time.Duration // init peers of node. Peers *proto.Peers // wal for kayak. Wal Wal // current node id. NodeID proto.NodeID // current instance id. InstanceID string // mux service name. ServiceName string // apply service method. ApplyMethodName string // fetch service method. FetchMethodName string // fetch timeout. LogWaitTimeout time.Duration }
RuntimeConfig defines the runtime config of kayak.
Click to show internal directories.
Click to hide internal directories.