replidb

package
v0.0.0-...-15b7eb6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Act_Allocate uint = iota
	Act_Rollback
)
View Source
const (
	Op_Create uint = iota
	Op_Delete
	Op_SetSequence
)

Variables

View Source
var ENoTarget = errors.New("NoTarget")
View Source
var EStartupRecoverFailed = errors.New("StartupRecoverFailed")

Functions

func BytesComparator

func BytesComparator(a, b interface{}) int

func Decode

func Decode(b []byte) (i uint64)

func Encode

func Encode(V uint64) []byte

func PairComparator

func PairComparator(a, b interface{}) int

func SplitOff

func SplitOff(b []byte) (n, r []byte)

func SplitOffSecond

func SplitOffSecond(b []byte) (n, r []byte)

Types

type Action

type Action struct {
	Act    uint
	Name   []byte
	Number uint64
	Error  error
	WG     *sync.WaitGroup
	Free   func(a *Action)
}

type LoggedSequence

type LoggedSequence struct {
	Seq  *Sequence
	Path string

	/* Replication outbound. */
	Replicator func(b []byte) error

	MaxLogBeforeMerge int64
	// contains filtered or unexported fields
}

func (*LoggedSequence) Commit

func (l *LoggedSequence) Commit() error

func (*LoggedSequence) Create

func (l *LoggedSequence) Create(pair Pair)

func (*LoggedSequence) Delete

func (l *LoggedSequence) Delete(pair Pair)

func (*LoggedSequence) GetSequence

func (l *LoggedSequence) GetSequence(name []byte) uint64

func (*LoggedSequence) Lowest

func (l *LoggedSequence) Lowest(name []byte) (uint64, bool)

func (*LoggedSequence) OnReceive

func (l *LoggedSequence) OnReceive(repl []byte) error

Replication inbound.

func (*LoggedSequence) SetSequence

func (l *LoggedSequence) SetSequence(pair Pair)

func (*LoggedSequence) Startup

func (l *LoggedSequence) Startup() error

type Pair

type Pair struct {
	Name []byte
	Num  uint64
}

func (*Pair) Copy

func (p *Pair) Copy()

type RowEvent

type RowEvent struct {
	Pair
	Op uint
}

func (*RowEvent) DecodeMsgpack

func (r *RowEvent) DecodeMsgpack(dec *msgpack.Decoder) error

func (*RowEvent) EncodeMsgpack

func (r *RowEvent) EncodeMsgpack(enc *msgpack.Encoder) error

type Sequence

type Sequence struct {
	DB    *bolt.DB
	Table []byte

	Exist     *avl.Tree
	DontExist *avl.Tree
	Seqs      *avl.Tree
	// contains filtered or unexported fields
}

func (*Sequence) BGFlush

func (s *Sequence) BGFlush() error

Background-Flush function.

func (*Sequence) Create

func (s *Sequence) Create(pair Pair)

func (*Sequence) Delete

func (s *Sequence) Delete(pair Pair)

func (*Sequence) GetSequence

func (s *Sequence) GetSequence(name []byte) uint64

func (*Sequence) Init

func (s *Sequence) Init()

func (*Sequence) Lowest

func (s *Sequence) Lowest(name []byte) (uint64, bool)

func (*Sequence) SetSequence

func (s *Sequence) SetSequence(pair Pair)

type SequenceWorker

type SequenceWorker struct {
	LS *LoggedSequence
	B  batcher.Batcher
}

func (*SequenceWorker) Start

func (sw *SequenceWorker) Start()

func (*SequenceWorker) Stop

func (sw *SequenceWorker) Stop()

func (*SequenceWorker) Submit

func (sw *SequenceWorker) Submit(a *Action)

type UIntBuffer

type UIntBuffer [9]byte

func NewUIntBuffer

func NewUIntBuffer() *UIntBuffer

func (*UIntBuffer) Encode

func (u *UIntBuffer) Encode(V uint64) []byte

func (*UIntBuffer) Free

func (u *UIntBuffer) Free()

Jump to

Keyboard shortcuts

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