wal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Id      uint64
	Payload Payload
	// contains filtered or unexported fields
}

Entry is a wrapper for Payload, providing a feature to sync between producer and consumer

func GetEntry

func GetEntry(id uint64) *Entry

func (*Entry) Free

func (e *Entry) Free()

func (*Entry) SetDone

func (e *Entry) SetDone()

func (*Entry) WaitDone

func (e *Entry) WaitDone()

type Payload

type Payload interface {
	Marshal() ([]byte, error)
}

type Role

type Role uint8
const (
	BrokerRole Role = iota
	HolderRole
)

type ShardAwareWal

type ShardAwareWal interface {
	Wal
	InitShard(uint64, uint64) error
	TryInitShard(uint64, uint64) error
	GetAllShardCheckpointId() map[uint64]uint64
	GetShardCheckpointId(uint64) uint64
	GetShardCurrSeqNum(uint64) uint64
	GetShardPendingCnt(uint64) int
	GetAllPendingEntries() []*shard.ItemsToCheckpointStat
}

type ShardWal

type ShardWal struct {
	Wal     ShardAwareWal
	ShardId uint64
}

func NewWalShard

func NewWalShard(shardId uint64, wal ShardAwareWal) *ShardWal

func (*ShardWal) Checkpoint

func (wal *ShardWal) Checkpoint(v interface{})

func (*ShardWal) GetCheckpointId

func (wal *ShardWal) GetCheckpointId() uint64

func (*ShardWal) GetCurrSeqNum

func (wal *ShardWal) GetCurrSeqNum() uint64

func (*ShardWal) GetShardId

func (wal *ShardWal) GetShardId() uint64

func (*ShardWal) InitWal

func (wal *ShardWal) InitWal(index uint64) error

func (*ShardWal) Log

func (wal *ShardWal) Log(payload Payload) (*Entry, error)

func (*ShardWal) SyncLog

func (wal *ShardWal) SyncLog(payload Payload) error

func (*ShardWal) TryInitWal

func (wal *ShardWal) TryInitWal(index uint64) error

func (*ShardWal) UncheckpointedCnt

func (wal *ShardWal) UncheckpointedCnt() int

func (*ShardWal) WalEnabled

func (wal *ShardWal) WalEnabled() bool

type Wal

type Wal interface {
	io.Closer
	Log(Payload) (*Entry, error)
	SyncLog(Payload) error
	Checkpoint(interface{})
	String() string
	GetRole() Role
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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