raftlog

package
v0.0.0-...-0ebafaf Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomRaftLogFlag byte = 64

	TypePrewrite            CustomRaftLogType = 1
	TypeCommit              CustomRaftLogType = 2
	TypeRolback             CustomRaftLogType = 3
	TypePessimisticLock     CustomRaftLogType = 4
	TypePessimisticRollback CustomRaftLogType = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomBuilder

type CustomBuilder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(header CustomHeader) *CustomBuilder

func (*CustomBuilder) AppendCommit

func (b *CustomBuilder) AppendCommit(key, value []byte, commitTS uint64)

func (*CustomBuilder) AppendLock

func (b *CustomBuilder) AppendLock(key, value []byte)

func (*CustomBuilder) AppendPessimisticRollback

func (b *CustomBuilder) AppendPessimisticRollback(key []byte)

func (*CustomBuilder) AppendRollback

func (b *CustomBuilder) AppendRollback(key []byte, startTS uint64, deleteLock bool)

func (*CustomBuilder) Build

func (b *CustomBuilder) Build() *CustomRaftLog

func (*CustomBuilder) GetType

func (b *CustomBuilder) GetType() CustomRaftLogType

func (*CustomBuilder) Len

func (b *CustomBuilder) Len() int

func (*CustomBuilder) SetType

func (b *CustomBuilder) SetType(tp CustomRaftLogType)

type CustomHeader

type CustomHeader struct {
	RegionID uint64
	Epoch    Epoch
	PeerID   uint64
	StoreID  uint64
	Term     uint64
}

func (*CustomHeader) Marshal

func (h *CustomHeader) Marshal() []byte

type CustomRaftLog

type CustomRaftLog struct {
	Data []byte
	// contains filtered or unexported fields
}

CustomRaftLog is the raft log format for unistore to store Prewrite/Commit/PessimisticLock.

| flag(1) | type(1) | version(2) | header(40) | entries

It reduces the cost of marshal/unmarshal and avoid DB lookup during apply.

func NewCustom

func NewCustom(data []byte) *CustomRaftLog

func (*CustomRaftLog) Epoch

func (c *CustomRaftLog) Epoch() Epoch

func (*CustomRaftLog) GetRaftCmdRequest

func (c *CustomRaftLog) GetRaftCmdRequest() *raft_cmdpb.RaftCmdRequest

func (*CustomRaftLog) IterateCommit

func (rl *CustomRaftLog) IterateCommit(itFunc func(key, val []byte, commitTS uint64))

func (*CustomRaftLog) IterateLock

func (rl *CustomRaftLog) IterateLock(itFunc func(key, val []byte))

func (*CustomRaftLog) IteratePessimisticRollback

func (rl *CustomRaftLog) IteratePessimisticRollback(itFunc func(key []byte))

func (*CustomRaftLog) IterateRollback

func (rl *CustomRaftLog) IterateRollback(itFunc func(key []byte, startTS uint64, deleteLock bool))

func (*CustomRaftLog) Marshal

func (c *CustomRaftLog) Marshal() []byte

func (*CustomRaftLog) PeerID

func (c *CustomRaftLog) PeerID() uint64

func (*CustomRaftLog) RegionID

func (c *CustomRaftLog) RegionID() uint64

func (*CustomRaftLog) StoreID

func (c *CustomRaftLog) StoreID() uint64

func (*CustomRaftLog) Term

func (c *CustomRaftLog) Term() uint64

func (*CustomRaftLog) Type

func (c *CustomRaftLog) Type() CustomRaftLogType

type CustomRaftLogType

type CustomRaftLogType byte

type Epoch

type Epoch struct {
	// contains filtered or unexported fields
}

func NewEpoch

func NewEpoch(ver, confVer uint64) Epoch

func (Epoch) ConfVer

func (e Epoch) ConfVer() uint64

func (Epoch) String

func (e Epoch) String() string

func (Epoch) Ver

func (e Epoch) Ver() uint64

type RaftLog

type RaftLog interface {
	RegionID() uint64
	Epoch() Epoch
	PeerID() uint64
	StoreID() uint64
	Term() uint64
	Marshal() []byte
	GetRaftCmdRequest() *raft_cmdpb.RaftCmdRequest
}

func NewRequest

func NewRequest(req *raft_cmdpb.RaftCmdRequest) RaftLog

type RequestRaftLog

type RequestRaftLog struct {
	*raft_cmdpb.RaftCmdRequest
}

func (RequestRaftLog) Epoch

func (r RequestRaftLog) Epoch() Epoch

func (RequestRaftLog) GetRaftCmdRequest

func (r RequestRaftLog) GetRaftCmdRequest() *raft_cmdpb.RaftCmdRequest

func (RequestRaftLog) Marshal

func (r RequestRaftLog) Marshal() []byte

func (RequestRaftLog) PeerID

func (r RequestRaftLog) PeerID() uint64

func (RequestRaftLog) RegionConfVer

func (r RequestRaftLog) RegionConfVer() uint64

func (RequestRaftLog) RegionID

func (r RequestRaftLog) RegionID() uint64

func (RequestRaftLog) StoreID

func (r RequestRaftLog) StoreID() uint64

func (RequestRaftLog) Term

func (r RequestRaftLog) Term() uint64

Jump to

Keyboard shortcuts

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