dnservice

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StorageTAE TAE txn storage backend
	StorageTAE = StorageType("TAE")
	// StorageMEMKV MEMKV txn storage backend
	StorageMEMKV = StorageType("MEMKV")
	// StorageMEMKV MEM txn storage backend
	StorageMEM = StorageType("MEM")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DataDir data dir
	DataDir string `toml:"-"`
	// UUID dn store uuid
	UUID string `toml:"uuid"`
	// ListenAddress listening address for receiving external requests.
	ListenAddress string `toml:"listen-address"`
	// ServiceAddress service address for communication, if this address is not set, use
	// ListenAddress as the communication address.
	ServiceAddress string `toml:"service-address"`

	// HAKeeper configuration
	HAKeeper struct {
		// HeatbeatInterval heartbeat interval to send message to hakeeper. Default is 1s
		HeatbeatInterval toml.Duration `toml:"hakeeper-heartbeat-interval"`
		// HeatbeatTimeout heartbeat request timeout. Default is 3s
		HeatbeatTimeout toml.Duration `toml:"hakeeper-heartbeat-timeout"`
		// DiscoveryTimeout discovery HAKeeper service timeout. Default is 30s
		DiscoveryTimeout toml.Duration `toml:"hakeeper-discovery-timeout"`
		// ClientConfig hakeeper client configuration
		ClientConfig logservice.HAKeeperClientConfig
	}

	// LogService log service configuration
	LogService struct {
		// ConnectTimeout timeout for connect to logservice. Default is 30s.
		ConnectTimeout toml.Duration `toml:"connect-timeout"`
	}

	// RPC configuration
	RPC rpc.Config `toml:"rpc"`

	Ckp struct {
		FlushInterval       toml.Duration `toml:"flush-interval"`
		ScanInterval        toml.Duration `toml:"scan-interval"`
		MinCount            int64         `toml:"min-count"`
		IncrementalInterval toml.Duration `toml:"incremental-interval"`
		GlobalInterval      toml.Duration `toml:"global-interval"`
	}

	// Txn transactions configuration
	Txn struct {
		// ZombieTimeout A transaction timeout, if an active transaction has not operated for more
		// than the specified time, it will be considered a zombie transaction and the backend will
		// roll back the transaction.
		ZombieTimeout toml.Duration `toml:"zombie-timeout"`

		// Storage txn storage config
		Storage struct {

			// Backend txn storage backend implementation. [TAE|Mem], default TAE.
			Backend StorageType `toml:"backend"`
			// LogBackend the backend used to store logs
			LogBackend string `toml:"log-backend"`
			// contains filtered or unexported fields
		}
	}
}

Config dn store configuration

func (*Config) Validate

func (c *Config) Validate() error

type Option

type Option func(*store)

Option store option

func WithBackendFilter

func WithBackendFilter(filter func(morpc.Message, string) bool) Option

WithBackendFilter set filtering txn.TxnRequest sent to other DNShard

func WithClock

func WithClock(clock clock.Clock) Option

WithClock set clock

func WithConfigAdjust

func WithConfigAdjust(adjustConfigFunc func(c *Config)) Option

WithConfigAdjust set adjust config func

func WithHAKeeperClientFactory

func WithHAKeeperClientFactory(factory func() (logservice.DNHAKeeperClient, error)) Option

WithHAKeeperClientFactory set hakeeper client factory

func WithLogServiceClientFactory

func WithLogServiceClientFactory(factory func(metadata.DNShard) (logservice.Client, error)) Option

WithLogServiceClientFactory set log service client factory

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger set logger

func WithTaskStorageFactory

func WithTaskStorageFactory(factory taskservice.TaskStorageFactory) Option

WithTaskStorageFactory setup the special task strorage factory

type Service

type Service interface {
	// Start start dn store. Start all DNShards currently managed by the Store and listen
	// to and process requests from CN and other DNs.
	Start() error
	// Close close dn store
	Close() error

	// StartDNReplica start the DNShard replica
	StartDNReplica(metadata.DNShard) error
	// CloseDNReplica close the DNShard replica.
	CloseDNReplica(shard metadata.DNShard) error

	// GetTaskService returns taskservice
	GetTaskService() (taskservice.TaskService, bool)
}

Service DN Service

func NewService

func NewService(cfg *Config,
	fileService fileservice.FileService,
	opts ...Option) (Service, error)

NewService create DN Service

type StorageType

type StorageType string

StorageType txn storage type

Jump to

Keyboard shortcuts

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