mock

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitEntry = "CommitEntry"
	DropEntry   = "DropEntry"
)
View Source
const (
	Write     = "Write"
	WriteMeta = "WriteMeta"
	Trunc     = "Trunc"
	Read      = "Read"
	ReadFrom  = "ReadFrom"
	ReadMeta  = "ReadMeta"
	Close     = "Close"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type StateMachine

type StateMachine struct {
	Calls         map[string]int
	OnCommitEntry func(*pb.LogEntry) error
	OnDropEntry   func(*pb.LogEntry) error
}

func NewStateMachine

func NewStateMachine() *StateMachine

func (*StateMachine) CommitEntry

func (m *StateMachine) CommitEntry(entry *pb.LogEntry) error

func (*StateMachine) DropEntry

func (m *StateMachine) DropEntry(entry *pb.LogEntry) error

func (*StateMachine) Reset

func (m *StateMachine) Reset()

func (*StateMachine) UseError

func (m *StateMachine) UseError(method string, err error)

type Sync

type Sync struct {
	Calls       map[string]int
	OnWrite     func(...*pb.LogEntry) error
	OnWriteMeta func(*pb.LogMeta) error
	OnTrunc     func(uint64) error
	OnRead      func(uint64) (*pb.LogEntry, error)
	OnReadFrom  func(uint64) ([]*pb.LogEntry, error)
	OnReadMeta  func() (*pb.LogMeta, error)
	OnClose     func() error
}

func NewSync

func NewSync() *Sync

func (*Sync) Close

func (m *Sync) Close() error

func (*Sync) Read

func (m *Sync) Read(index uint64) (*pb.LogEntry, error)

func (*Sync) ReadFrom

func (m *Sync) ReadFrom(index uint64) ([]*pb.LogEntry, error)

func (*Sync) ReadMeta

func (m *Sync) ReadMeta() (*pb.LogMeta, error)

func (*Sync) Reset

func (m *Sync) Reset()

func (*Sync) Trunc

func (m *Sync) Trunc(index uint64) error

func (*Sync) UseError

func (m *Sync) UseError(method string, err error)

func (*Sync) Write

func (m *Sync) Write(entries ...*pb.LogEntry) error

func (*Sync) WriteMeta

func (m *Sync) WriteMeta(meta *pb.LogMeta) error

Jump to

Keyboard shortcuts

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