Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RaftAddr string `toml:"addr-raft"`
AdvertiseRaftAddr string `toml:"addr-advertise-raft"`
ClientAddr string `toml:"addr-client"`
AdvertiseClientAddr string `toml:"addr-advertise-client"`
DataPath string `toml:"dir-data"`
DeployPath string `toml:"dir-deploy"`
Version string `toml:"version"`
GitHash string `toml:"githash"`
Labels [][]string `toml:"labels"`
// Capacity max capacity can use
Capacity typeutil.ByteSize `toml:"capacity"`
UseMemoryAsStorage bool `toml:"use-memory-as-storage"`
ShardGroups uint64 `toml:"shard-groups"`
Replication ReplicationConfig `toml:"replication"`
Snapshot SnapshotConfig `toml:"snapshot"`
// Raft raft config
Raft RaftConfig `toml:"raft"`
// Worker worker config
Worker WorkerConfig `toml:"worker"`
// Prophet prophet config
Prophet pconfig.Config `toml:"prophet"`
// Storage config
Storage StorageConfig
// Customize config
Customize CustomizeConfig
// Logger logger used in cube
Logger *zap.Logger `json:"-" toml:"-"`
// Metric Config
Metric metric.Cfg `toml:"metric"`
// FS used in MatrixCube
FS vfs.FS `json:"-" toml:"-"`
// Test only used in testing
Test TestConfig
}
Config matrixcube config
func (*Config) GetModuleLogger ¶ added in v0.2.0
GetModuleLogger returns logger with named module name
type CustomizeConfig ¶
type CustomizeConfig struct {
// CustomShardStateAwareFactory is a factory func to create aware.ShardStateAware to handled shard life cycle.
CustomShardStateAwareFactory func() aware.ShardStateAware `json:"-" toml:"-"`
// CustomInitShardsFactory is a factory func to provide init shards to cube to bootstrap the cluster.
CustomInitShardsFactory func() []meta.Shard `json:"-" toml:"-"`
// CustomStoreHeartbeatDataProcessor process store heartbeat data, collect, store and process customize data
CustomStoreHeartbeatDataProcessor StoreHeartbeatDataProcessor `json:"-" toml:"-"`
// CustomShardPoolShardFactory is factory create a shard used by shard pool, `start, end and unique` is created by
// `ShardPool` based on `offsetInPool`, these can be modified, provided that the only non-conflict.
CustomShardPoolShardFactory func(g uint64, start, end []byte, unique string, offsetInPool uint64) meta.Shard `json:"-" toml:"-"`
// CustomTransportFilter transport filter
CustomTransportFilter func(meta.RaftMessage) bool `json:"-" toml:"-"`
// CustomWrapNewTransport wraps new transports
CustomWrapNewTransport func(transport.Trans) transport.Trans `json:"-" toml:"-"`
}
CustomizeConfig customize config
type RaftConfig ¶
type RaftConfig struct {
// TickInterval raft tick interval
TickInterval typeutil.Duration `toml:"tick-interval"`
// HeartbeatTicks how many ticks to send raft heartbeat message
HeartbeatTicks int `toml:"heartbeat-ticks"`
// ElectionTimeoutTicks how many ticks to send election message
ElectionTimeoutTicks int `toml:"election-timeout-ticks"`
// MaxSizePerMsg max bytes per raft message
MaxSizePerMsg typeutil.ByteSize `toml:"max-size-per-msg"`
// MaxInflightMsgs max raft message count in a raft rpc
MaxInflightMsgs int `toml:"max-inflight-msgs"`
// MaxEntryBytes max bytes of entry in a proposal message
MaxEntryBytes typeutil.ByteSize `toml:"max-entry-bytes"`
// SendRaftBatchSize raft message sender count
SendRaftBatchSize uint64 `toml:"send-raft-batch-size"`
// RaftLog raft log 配置
RaftLog RaftLogConfig `toml:"raft-log"`
}
RaftConfig raft config
func (*RaftConfig) GetElectionTimeoutDuration ¶
func (c *RaftConfig) GetElectionTimeoutDuration() time.Duration
GetElectionTimeoutDuration returns ElectionTimeoutTicks * TickInterval
func (*RaftConfig) GetHeartbeatDuration ¶
func (c *RaftConfig) GetHeartbeatDuration() time.Duration
GetHeartbeatDuration returns HeartbeatTicks * TickInterval
type RaftLogConfig ¶
type RaftLogConfig struct {
DisableSync bool `toml:"disable-sync"`
CompactThreshold uint64 `toml:"compact-threshold"`
MaxAllowTransferLag uint64 `toml:"max-allow-transfer-lag"`
ForceCompactCount uint64 `toml:"force-compact-log-count"`
ForceCompactBytes uint64 `toml:"force-compact-log-bytes"`
}
RaftLogConfig raft log config
type ReplicationConfig ¶
type ReplicationConfig struct {
MaxPeerDownTime typeutil.Duration `toml:"max-peer-down-time"`
ShardHeartbeatDuration typeutil.Duration `toml:"shard-heartbeat-duration"`
StoreHeartbeatDuration typeutil.Duration `toml:"store-heartbeat-duration"`
ShardSplitCheckDuration typeutil.Duration `toml:"shard-split-check-duration"`
ShardStateCheckDuration typeutil.Duration `toml:"shard-state-check-duration"`
CompactLogCheckDuration typeutil.Duration `toml:"compact-log-check-duration"`
DisableShardSplit bool `toml:"disable-shard-split"`
AllowRemoveLeader bool `toml:"allow-remove-leader"`
ShardCapacityBytes typeutil.ByteSize `toml:"shard-capacity-bytes"`
ShardSplitCheckBytes typeutil.ByteSize `toml:"shard-split-check-bytes"`
}
ReplicationConfig replication config
type ShardConfig ¶
type ShardConfig struct {
// SplitCheckInterval interval to check shard whether need to be split or not.
SplitCheckInterval typeutil.Duration `toml:"split-check-interval"`
// SplitCheckDiff when size change of shard exceed the diff since last check, it
// will be checked again whether it should be split.
SplitCheckDiff uint64 `toml:"split-check-diff"`
}
ShardConfig shard config
type SnapshotConfig ¶
type SnapshotConfig struct {
MaxConcurrencySnapChunks uint64 `toml:"max-concurrency-snap-chunks"`
SnapChunkSize typeutil.ByteSize `toml:"snap-chunk-size"`
}
SnapshotConfig snapshot config
type StorageConfig ¶
type StorageConfig struct {
// DataStorageFactory is a storage factory to store application's data
DataStorageFactory func(group uint64) storage.DataStorage `json:"-" toml:"-"`
// ForeachDataStorageFunc do in every storage
ForeachDataStorageFunc func(cb func(storage.DataStorage)) `json:"-" toml:"-"`
}
StorageConfig storage config
type StoreHeartbeatDataProcessor ¶
type StoreHeartbeatDataProcessor interface {
pconfig.ContainerHeartbeatDataProcessor
// HandleHeartbeatRsp handle the data from store heartbeat at the each worker node
HandleHeartbeatRsp(data []byte) error
// CollectData collect data at every heartbeat
CollectData() []byte
}
StoreHeartbeatDataProcessor process store heartbeat data, collect, store and process customize data
type TestConfig ¶
type TestConfig struct {
// ShardStateAware is a ShardStateAware wrapper for the aware which created by
// `CustomizeConfig.CustomShardStateAwareFactory`
ShardStateAware aware.TestShardStateAware `json:"-" toml:"-"`
// ReplicaSetSnapshotJobWait sleep before set snapshot job
ReplicaSetSnapshotJobWait time.Duration
// SaveDynamicallyShardInitStateWait wait before save dynamically shard init state
SaveDynamicallyShardInitStateWait time.Duration
// ShardPoolCreateWaitC waiting delay for shard creation
ShardPoolCreateWaitC chan struct{} `json:"-" toml:"-"`
// Shards test config for shards
Shards map[uint64]*TestShardConfig `json:"-" toml:"-"`
}
TestConfig all test config
type TestShardConfig ¶
type TestShardConfig struct {
// SkipSaveRaftApplyState skip save raft apply state to metastorage after applied a raft log
SkipSaveRaftApplyState bool
// SkipApply skip apply any raft log
SkipApply bool
}
TestShardConfig shard test config
type WorkerConfig ¶
type WorkerConfig struct {
RaftEventWorkers uint64 `toml:"raft-event-workers"`
}
WorkerConfig worker config
Click to show internal directories.
Click to hide internal directories.