replicateddb

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ElectionTick       = 10
	HeartbeatTick      = 1
	ProposeTimeout     = 5 * time.Second
	ProposeConfTimeout = 5 * time.Second
)
View Source
const C_CommitTxn int64 = 15774688
View Source
const C_Delete int64 = 1035893169
View Source
const C_Set int64 = 3730400060
View Source
const C_StartTxn int64 = 605208098
View Source
const C_StopTxn int64 = 1239816782

Variables

View Source
var (
	ErrKeyNotFound         = badger.ErrKeyNotFound
	DefaultIteratorOptions = badger.DefaultIteratorOptions
)
View Source
var (
	ErrDuplicateID = fmt.Errorf("duplicate id")
	ErrTxnNotFound = fmt.Errorf("txn not found")
	ErrUnknown     = fmt.Errorf("unknown")
)
View Source
var File_commands_proto protoreflect.FileDescriptor
View Source
var PoolCommitTxn = poolCommitTxn{}
View Source
var PoolDelete = poolDelete{}
View Source
var PoolSet = poolSet{}
View Source
var PoolStartTxn = poolStartTxn{}
View Source
var PoolStopTxn = poolStopTxn{}

Functions

This section is empty.

Types

type CommitTxn

type CommitTxn struct {
	ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	// contains filtered or unexported fields
}

func (*CommitTxn) DeepCopy

func (x *CommitTxn) DeepCopy(z *CommitTxn)

func (*CommitTxn) Descriptor deprecated

func (*CommitTxn) Descriptor() ([]byte, []int)

Deprecated: Use CommitTxn.ProtoReflect.Descriptor instead.

func (*CommitTxn) GetID

func (x *CommitTxn) GetID() int64

func (*CommitTxn) Marshal

func (x *CommitTxn) Marshal() ([]byte, error)

func (*CommitTxn) ProtoMessage

func (*CommitTxn) ProtoMessage()

func (*CommitTxn) ProtoReflect

func (x *CommitTxn) ProtoReflect() protoreflect.Message

func (*CommitTxn) Reset

func (x *CommitTxn) Reset()

func (*CommitTxn) String

func (x *CommitTxn) String() string

func (*CommitTxn) Unmarshal

func (x *CommitTxn) Unmarshal(b []byte) error

type Config

type Config struct {
	Cluster             cluster.Cluster
	DirPath             string
	ConflictRetries     int
	ConflictMaxInterval time.Duration
	BatchWorkers        int
	BatchSize           int
}

func DefaultConfig

func DefaultConfig(dataPath string) Config

type Delete

type Delete struct {
	TxnID int64  `protobuf:"varint,1,opt,name=TxnID,proto3" json:"TxnID,omitempty"`
	Key   []byte `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"`
	// contains filtered or unexported fields
}

func (*Delete) DeepCopy

func (x *Delete) DeepCopy(z *Delete)

func (*Delete) Descriptor deprecated

func (*Delete) Descriptor() ([]byte, []int)

Deprecated: Use Delete.ProtoReflect.Descriptor instead.

func (*Delete) GetKey

func (x *Delete) GetKey() []byte

func (*Delete) GetTxnID

func (x *Delete) GetTxnID() int64

func (*Delete) Marshal

func (x *Delete) Marshal() ([]byte, error)

func (*Delete) ProtoMessage

func (*Delete) ProtoMessage()

func (*Delete) ProtoReflect

func (x *Delete) ProtoReflect() protoreflect.Message

func (*Delete) Reset

func (x *Delete) Reset()

func (*Delete) String

func (x *Delete) String() string

func (*Delete) Unmarshal

func (x *Delete) Unmarshal(b []byte) error

type Entry

type Entry = badger.Entry

func NewEntry

func NewEntry(key, value []byte) *Entry

type Set

type Set struct {
	TxnID int64  `protobuf:"varint,1,opt,name=TxnID,proto3" json:"TxnID,omitempty"`
	Key   []byte `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"`
	Value []byte `protobuf:"bytes,3,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*Set) DeepCopy

func (x *Set) DeepCopy(z *Set)

func (*Set) Descriptor deprecated

func (*Set) Descriptor() ([]byte, []int)

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetKey

func (x *Set) GetKey() []byte

func (*Set) GetTxnID

func (x *Set) GetTxnID() int64

func (*Set) GetValue

func (x *Set) GetValue() []byte

func (*Set) Marshal

func (x *Set) Marshal() ([]byte, error)

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

func (x *Set) ProtoReflect() protoreflect.Message

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

func (*Set) Unmarshal

func (x *Set) Unmarshal(b []byte) error

type StartTxn

type StartTxn struct {
	ID     int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Update bool  `protobuf:"varint,2,opt,name=Update,proto3" json:"Update,omitempty"`
	// contains filtered or unexported fields
}

func (*StartTxn) DeepCopy

func (x *StartTxn) DeepCopy(z *StartTxn)

func (*StartTxn) Descriptor deprecated

func (*StartTxn) Descriptor() ([]byte, []int)

Deprecated: Use StartTxn.ProtoReflect.Descriptor instead.

func (*StartTxn) GetID

func (x *StartTxn) GetID() int64

func (*StartTxn) GetUpdate

func (x *StartTxn) GetUpdate() bool

func (*StartTxn) Marshal

func (x *StartTxn) Marshal() ([]byte, error)

func (*StartTxn) ProtoMessage

func (*StartTxn) ProtoMessage()

func (*StartTxn) ProtoReflect

func (x *StartTxn) ProtoReflect() protoreflect.Message

func (*StartTxn) Reset

func (x *StartTxn) Reset()

func (*StartTxn) String

func (x *StartTxn) String() string

func (*StartTxn) Unmarshal

func (x *StartTxn) Unmarshal(b []byte) error

type StopTxn

type StopTxn struct {
	ID     int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Commit bool  `protobuf:"varint,2,opt,name=Commit,proto3" json:"Commit,omitempty"`
	// contains filtered or unexported fields
}

func (*StopTxn) DeepCopy

func (x *StopTxn) DeepCopy(z *StopTxn)

func (*StopTxn) Descriptor deprecated

func (*StopTxn) Descriptor() ([]byte, []int)

Deprecated: Use StopTxn.ProtoReflect.Descriptor instead.

func (*StopTxn) GetCommit

func (x *StopTxn) GetCommit() bool

func (*StopTxn) GetID

func (x *StopTxn) GetID() int64

func (*StopTxn) Marshal

func (x *StopTxn) Marshal() ([]byte, error)

func (*StopTxn) ProtoMessage

func (*StopTxn) ProtoMessage()

func (*StopTxn) ProtoReflect

func (x *StopTxn) ProtoReflect() protoreflect.Message

func (*StopTxn) Reset

func (x *StopTxn) Reset()

func (*StopTxn) String

func (x *StopTxn) String() string

func (*StopTxn) Unmarshal

func (x *StopTxn) Unmarshal(b []byte) error

type Store

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

Store is the finite state machine which will be used when Raft is enabled.

func New

func New(cfg Config) (*Store, error)

func (*Store) DB

func (fsm *Store) DB() *store.LocalDB

func (*Store) OnJoin added in v0.7.4

func (fsm *Store) OnJoin(hash uint64)

func (*Store) OnLeave added in v0.7.4

func (fsm *Store) OnLeave(hash uint64)

func (*Store) SetCluster

func (fsm *Store) SetCluster(c cluster.Cluster)

func (*Store) Shutdown

func (fsm *Store) Shutdown()

func (*Store) Step added in v0.7.4

func (fsm *Store) Step(payload []byte)

func (*Store) Update

func (fsm *Store) Update(fn func(store.Txn) error) error

func (*Store) UpdateLocal

func (fsm *Store) UpdateLocal(fn func(txn *store.LTxn) error) error

func (*Store) View

func (fsm *Store) View(fn func(store.Txn) error) error

func (*Store) ViewLocal

func (fsm *Store) ViewLocal(fn func(txn *store.LTxn) error) error

type Txn

type Txn struct {
	ID int64
	// contains filtered or unexported fields
}

func (*Txn) Delete

func (txn *Txn) Delete(alloc *tools.Allocator, keyParts ...interface{}) error

func (*Txn) Exists

func (txn *Txn) Exists(alloc *tools.Allocator, keyParts ...interface{}) bool

func (*Txn) Get

func (txn *Txn) Get(alloc *tools.Allocator, keyParts ...interface{}) (v []byte, err error)

func (*Txn) Set

func (txn *Txn) Set(alloc *tools.Allocator, val []byte, keyParts ...interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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