Documentation
¶
Index ¶
- Constants
- type Config
- type Option
- func WithBackendFilter(filter func(morpc.Message, string) bool) Option
- func WithConfigAdjust(adjustConfigFunc func(c *Config)) Option
- func WithHAKeeperClientFactory(factory func() (logservice.TNHAKeeperClient, error)) Option
- func WithLogServiceClientFactory(factory func(metadata.TNShard) (logservice.Client, error)) Option
- func WithTaskStorageFactory(factory taskservice.TaskStorageFactory) Option
- type PortSlot
- type Service
- type StorageType
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 tn 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"`
// PortBase is the base port for the service. We reserve reservedPorts for
// the service to start internal server inside it.
//
// TODO(volgariver6): The value of this field is also used to determine the version
// of MO. If it is not set, we use the old listen-address/service-address fields, and
// if it is set, we use the new policy to distribute the ports to all services.
PortBase int `toml:"port-base"`
// ServiceHost is the host name/IP for the service address of RPC request. There is
// no port value in it.
ServiceHost string `toml:"service-host"`
// 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"`
GlobalMinCount int64 `toml:"global-min-count"`
ReservedWALEntryCount uint64 `toml:"reserved-WAL-entry-count"`
}
LogtailServer struct {
ListenAddress string `toml:"listen-address"`
ServiceAddress string `toml:"service-address"`
RpcMaxMessageSize toml.ByteSize `toml:"rpc-max-message-size"`
RpcEnableChecksum bool `toml:"rpc-enable-checksum"`
LogtailCollectInterval toml.Duration `toml:"logtail-collect-interval"`
LogtailResponseSendTimeout toml.Duration `toml:"logtail-response-send-timeout"`
}
// 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"`
// Mode. [Optimistic|Pessimistic], default Pessimistic.
Mode string `toml:"mode"`
// If IncrementalDedup is 'true', it will enable the incremental dedup feature.
// If incremental dedup feature is disable,
// If empty, it will set 'false' when CN.Txn.Mode is optimistic, set 'true' when CN.Txn.Mode is pessimistic
// IncrementalDedup will be treated as FullSkipWorkspaceDedup.
IncrementalDedup string `toml:"incremental-dedup"`
// Storage txn storage config
Storage struct {
// Backend txn storage backend implementation. [TAE|Mem], default TAE.
Backend StorageType `toml:"backend"`
// contains filtered or unexported fields
}
}
// Cluster configuration
Cluster struct {
// RefreshInterval refresh cluster info from hakeeper interval
RefreshInterval toml.Duration `toml:"refresh-interval"`
}
// LockService lockservice config
LockService lockservice.Config `toml:"lockservice"`
Ctl ctlservice.Config `toml:"ctl"`
}
Config tn store configuration
type Option ¶
type Option func(*store)
Option store option
func WithBackendFilter ¶
WithBackendFilter set filtering txn.TxnRequest sent to other DNShard
func WithConfigAdjust ¶
WithConfigAdjust set adjust config func
func WithHAKeeperClientFactory ¶
func WithHAKeeperClientFactory(factory func() (logservice.TNHAKeeperClient, error)) Option
WithHAKeeperClientFactory set hakeeper client factory
func WithLogServiceClientFactory ¶
WithLogServiceClientFactory set log service client factory
func WithTaskStorageFactory ¶
func WithTaskStorageFactory(factory taskservice.TaskStorageFactory) Option
WithTaskStorageFactory setup the special task strorage factory
type Service ¶
type Service interface {
// Start start tn store. Start all DNShards currently managed by the Store and listen
// to and process requests from CN and other DNs.
Start() error
// Close close tn store
Close() error
// StartTNReplica start the DNShard replica
StartTNReplica(metadata.TNShard) error
// CloseTNReplica close the DNShard replica.
CloseTNReplica(shard metadata.TNShard) error
// GetTaskService returns taskservice
GetTaskService() (taskservice.TaskService, bool)
}
Service TN Service
func NewService ¶
func NewService( perfCounter *perfcounter.CounterSet, cfg *Config, rt runtime.Runtime, fileService fileservice.FileService, shutdownC chan struct{}, opts ...Option) (Service, error)
NewService create TN Service
Click to show internal directories.
Click to hide internal directories.