replication

package
v0.0.0-...-9753c4d Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMsgSize = 4 * 1000 * 1000

MaxMsgSize is the maximum message size accepted by the gRPC server. It should be 4MiB, but we set it to 4MB to avoid exceeding the allowed size

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	protodb.DB
	Path() string
	InMemory() bool
	MaxVersion() uint64
	SetVersion(v uint64)
	Drop() error
	Load(ctx context.Context, r io.Reader) (uint64, error)
	Stream(ctx context.Context, at, since uint64, w io.Writer) error
	LoadDescriptors(ctx context.Context) error
	NewWriteBatchAt(readTs uint64) *badger.WriteBatch

	ValueThreshold() int64
	MaxBatchCount() int64
	MaxBatchSize() int64
	Close() error
}

type Maybe

type Maybe struct {
	Tx
	DB
	// contains filtered or unexported fields
}

func (*Maybe) Close

func (s *Maybe) Close(ctx context.Context) error

func (*Maybe) Commit

func (s *Maybe) Commit(ctx context.Context, at uint64) error

func (*Maybe) Delete

func (s *Maybe) Delete(ctx context.Context, key []byte) error

func (*Maybe) Iterator

func (s *Maybe) Iterator(tx *badger.Txn, readTs uint64, opt badger.IteratorOptions) pending.Iterator

func (*Maybe) New

func (s *Maybe) New(ctx context.Context, readTs uint64) error

func (*Maybe) Set

func (s *Maybe) Set(ctx context.Context, key, value []byte, expiresAt uint64) error

type Mode

type Mode uint8
const (
	ModeNone Mode = iota
	ModeAsync
	ModeSync
)

func (Mode) String

func (m Mode) String() string

type Option

type Option func(o *Options)

func WithAddrs

func WithAddrs(addrs ...string) Option

func WithClientCA

func WithClientCA(ca []byte) Option

func WithClientCert

func WithClientCert(cert []byte) Option

func WithClientKey

func WithClientKey(key []byte) Option

func WithEncryptionKey

func WithEncryptionKey(key string) Option

func WithGRPCPort

func WithGRPCPort(port int) Option

func WithGossipPort

func WithGossipPort(port int) Option

func WithMode

func WithMode(mode Mode) Option

func WithName

func WithName(name string) Option

func WithRaftStartOptions

func WithRaftStartOptions(opts ...raft.StartOption) Option

func WithServerCert

func WithServerCert(cert []byte) Option

func WithServerKey

func WithServerKey(key []byte) Option

func WithTLSConfig

func WithTLSConfig(config *tls.Config) Option

func WithTick

func WithTick(ms int) Option

type Options

type Options struct {
	Mode     Mode
	Name     string
	Addrs    []string
	GRPCPort int
	Tick     time.Duration

	GossipPort    int
	EncryptionKey string

	StartOptions []raft.StartOption
	// contains filtered or unexported fields
}

func (*Options) TLS

func (o *Options) TLS() (*tls.Config, error)

type Replication

type Replication interface {
	IsLeader() bool
	LeaderConn() (grpc.ClientConnInterface, bool)
	CurrentLeader() string
	Subscribe() <-chan string
	LinearizableReads() bool
	NewTx(ctx context.Context) (Tx, error)
	Close() error
}

type Tx

type Tx interface {
	Iterator(tx *badger.Txn, readTs uint64, opt badger.IteratorOptions) pending.Iterator
	New(ctx context.Context, readTs uint64) error
	Set(ctx context.Context, key, value []byte, expiresAt uint64) error
	Delete(ctx context.Context, key []byte) error
	Commit(ctx context.Context, at uint64) error
	Close(ctx context.Context) error
}

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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