storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ClientAddress is the public address of the Regatta host used for client requests.
	ClientAddress string
	// NodeID is a non-zero value used to identify a node within a Raft cluster.
	NodeID uint64
	// InitialMembers is a map of both meta and table clusters initial members.
	InitialMembers map[uint64]string
	// WALDir is the directory used for storing the WAL of Raft entries. It is
	// recommended to use low latency storage such as NVME SSD with power loss
	// protection to store such WAL data. WAL will be stored in
	// NodeHostDir if it is set to the zero value.
	WALDir string
	// NodeHostDir is where everything else is stored.
	NodeHostDir string
	// RTTMillisecond defines the average Round Trip Time (RTT) in milliseconds
	// between two NodeHost instances. Such a RTT interval is internally used as
	// a logical clock tick. Raft heartbeat and election intervals are both
	// defined in terms of such logical clock ticks (RTT intervals).
	// Note that RTTMillisecond is the combined delays between two NodeHost
	// instances including all delays caused by network transmission, delays
	// caused by NodeHost queuing and processing. As an example, when fully
	// loaded, the average Rround Trip Time between two of our NodeHost instances
	// used for benchmarking purposes is up to 500 microseconds when the ping time
	// between them is 100 microseconds. Set RTTMillisecond to 1 when it is less
	// than 1 million in your environment.
	RTTMillisecond uint64
	// RaftAddress is a DNS name:port or IP:port address used by the transport
	// module for exchanging Raft messages, snapshots and metadata between
	// NodeHost instances. It should be set to the public address that can be
	// accessed from remote NodeHost instances.
	//
	// When the NodeHostConfig.ListenAddress field is empty, NodeHost listens on
	// RaftAddress for incoming Raft messages. When hostname or domain name is
	// used, it will be resolved to IPv4 addresses first and Dragonboat listens
	// to all resolved IPv4 addresses.
	//
	// By default, the RaftAddress value is not allowed to change between NodeHost
	// restarts. AddressByNodeHostID should be set to true when the RaftAddress
	// value might change after restart.
	RaftAddress string
	// ListenAddress is an optional field in the hostname:port or IP:port address
	// form used by the transport module to listen on for Raft message and
	// snapshots. When the ListenAddress field is not set, the transport module
	// listens on RaftAddress. If 0.0.0.0 is specified as the IP of the
	// ListenAddress, Dragonboat listens to the specified port on all network
	// interfaces. When hostname or domain name is used, it will be resolved to
	// IPv4 addresses first and Dragonboat listens to all resolved IPv4 addresses.
	ListenAddress string
	// EnableMetrics determines whether health metrics in Prometheus format should
	// be enabled.
	EnableMetrics bool
	// MaxSendQueueSize is the maximum size in bytes of each send queue.
	// Once the maximum size is reached, further replication messages will be
	// dropped to restrict memory usage. When set to 0, it means the send queue
	// size is unlimited.
	MaxSendQueueSize uint64
	// MaxReceiveQueueSize is the maximum size in bytes of each receive queue.
	// Once the maximum size is reached, further replication messages will be
	// dropped to restrict memory usage. When set to 0, it means the queue size
	// is unlimited.
	MaxReceiveQueueSize uint64
	// NotifyCommit specifies whether clients should be notified when their
	// regular proposals and config change requests are committed. By default,
	// commits are not notified, clients are only notified when their proposals
	// are both committed and applied.
	NotifyCommit bool
	// Gossip is a configuration for memberlist cluster discovery.
	Gossip GossipConfig
	// Table is a configuration for table OnDisk state machines.
	Table TableConfig
	// Meta is a configuration for metadata inmemory state machine.
	Meta MetaConfig
	// LogDBImplementation underlying LogDB implementation Pebble (default) or Tan.
	LogDBImplementation LogDBImplementation
	// LogCacheSize specifies the size of the log cache.
	LogCacheSize int
	// FS is the filesystem to use for log store, useful for testing,
	// uses the real vfs.Default if nil.
	FS vfs.FS
	// Logger implementation for storage.
	Log *zap.SugaredLogger
}

type Engine

type Engine struct {
	*dragonboat.NodeHost
	*table.Manager

	LogReader logreader.Interface
	Cluster   *cluster.Cluster
	LogCache  *logreader.ShardCache
	// contains filtered or unexported fields
}

func New

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

func (*Engine) Close

func (e *Engine) Close() error

func (*Engine) Config added in v0.5.0

func (e *Engine) Config() Config

func (*Engine) IterateRange added in v0.4.0

func (e *Engine) IterateRange(ctx context.Context, req *regattapb.RangeRequest) (iter.Seq[*regattapb.RangeResponse], error)

func (*Engine) MemberList added in v0.3.0

func (*Engine) Put

func (*Engine) Range

func (*Engine) Start

func (e *Engine) Start() error

func (*Engine) Status added in v0.3.0

func (*Engine) Txn

func (*Engine) WaitUntilReady added in v0.5.0

func (e *Engine) WaitUntilReady(ctx context.Context) error

type GossipConfig added in v0.2.0

type GossipConfig struct {
	BindAddress      string
	AdvertiseAddress string
	InitialMembers   []string
	ClusterName      string
	NodeName         string
}

type IndexNotificationQueue added in v0.5.0

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

func NewNotificationQueue added in v0.5.0

func NewNotificationQueue() *IndexNotificationQueue

func (*IndexNotificationQueue) Add added in v0.5.0

func (q *IndexNotificationQueue) Add(ctx context.Context, table string, revision uint64) <-chan error

func (*IndexNotificationQueue) Close added in v0.5.0

func (q *IndexNotificationQueue) Close() error

func (*IndexNotificationQueue) Len added in v0.5.0

func (q *IndexNotificationQueue) Len(table string) int

func (*IndexNotificationQueue) Notify added in v0.5.0

func (q *IndexNotificationQueue) Notify(table string, revision uint64)

func (*IndexNotificationQueue) Run added in v0.5.0

func (q *IndexNotificationQueue) Run()

type LogDBImplementation

type LogDBImplementation int
const (
	Tan LogDBImplementation = iota
	Pebble
)

type MetaConfig

type MetaConfig table.MetaConfig

type TableConfig

type TableConfig table.TableConfig

Directories

Path Synopsis
dns
fsm
key

Jump to

Keyboard shortcuts

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