Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyFields = errors.New("too many fields")
ErrTooManyFields is the error returned by memory-database when writes exceed the max limit of fields.
var ErrTooManyTagKeys = errors.New("too many tag keys")
ErrTooManyTagKeys is the error returned by memory-database when writes exceed the max limit of tag keys.
var ErrTooManyTags = errors.New("too many tags")
ErrTooManyTags is the error returned by memory-database when writes exceed the max limit of tag identifiers.
var ErrWrongFieldType = errors.New("field type is wrong")
ErrWrongFieldType is the error returned by memory-database when field-type of new point is different from the type before.
Functions ¶
This section is empty.
Types ¶
type ActiveNode ¶
type ActiveNode struct { Node Node `json:"node"` OnlineTime int64 `json:"onlineTime"` // node online time(millisecond) }
ActiveNode represents active node include online time
type BrokerReplicaState ¶
type BrokerReplicaState struct { ReportTime int64 `json:"reportTime"` // broker report state's time(millisecond) Replicas []ReplicaState `json:"replicas"` // replica state list under this broker }
BrokerReplicaState represents the replica state list of the broker
type CreateShardTask ¶
type CreateShardTask struct { Database string `json:"database"` ShardIDs []int32 `json:"shardIDs"` ShardOption option.ShardOption `json:"shardOption"` }
CreateShardTask represents create shard task param
func (CreateShardTask) Bytes ¶
func (t CreateShardTask) Bytes() []byte
Bytes returns create shard task binary data using json
type Database ¶
type Database struct { Name string `json:"name"` Clusters []DatabaseCluster `json:"clusters"` }
Database defines database config, database can include multi-cluster
type DatabaseCluster ¶
type DatabaseCluster struct { Name string `json:"name"` NumOfShard int `json:"numOfShard"` ReplicaFactor int `json:"replicaFactor"` ShardOption option.ShardOption `json:"shardOption"` }
DatabaseCluster represents database's storage cluster config
type Replica ¶
type Replica struct {
Replicas []int `json:"replicas"`
}
Replica defines replica list for spec shard of database
type ReplicaState ¶
type ReplicaState struct { Cluster string `json:"cluster"` // cluster which storing database Database string `json:"database"` // database name ShardID int32 `json:"shardID"` // shard id TO Node `json:"to"` // target storage node for database's shard WriteIndex int64 `json:"writeIndex"` // wal write index ReplicaIndex int64 `json:"replicaIndex"` // replica index for current replicator's channel CommitIndex int64 `json:"commitIndex"` // commit index }
ReplicaState represents the status of replicator's channel
func (ReplicaState) Pending ¶
func (r ReplicaState) Pending() int64
Pending returns the num. of pending which it need replica msg
func (ReplicaState) ShardIndicator ¶
func (r ReplicaState) ShardIndicator() string
ShardIndicator returns shard indicator based on cluster/database/shard id
type ShardAssignment ¶
type ShardAssignment struct { Config DatabaseCluster `json:"cluster"` Nodes map[int]*Node `json:"nodes"` Shards map[int]*Replica `json:"shards"` }
ShardAssignment defines shard assignment for database
func NewShardAssignment ¶
func NewShardAssignment() *ShardAssignment
NewShardAssignment returns empty shard assignment instance
func (*ShardAssignment) AddReplica ¶
func (s *ShardAssignment) AddReplica(shardID int, replicaID int)
AddReplica adds replica id to replica list of spec shard
type StorageCluster ¶
StorageCluster represents config of storage cluster
type StorageState ¶
type StorageState struct { Name string `json:"name"` ActiveNodes map[string]*ActiveNode `json:"activeNodes"` }
StorageState represents storage cluster node state. NOTICE: it is not safe for concurrent use.
func NewStorageState ¶
func NewStorageState() *StorageState
NewStorageState creates storage cluster state
func (*StorageState) AddActiveNode ¶
func (s *StorageState) AddActiveNode(node *ActiveNode)
AddActiveNode adds a node into active node list
func (*StorageState) GetActiveNodes ¶
func (s *StorageState) GetActiveNodes() []*ActiveNode
GetActiveNodes returns all active nodes
func (*StorageState) RemoveActiveNode ¶
func (s *StorageState) RemoveActiveNode(node string)
RemoveActiveNode removes a node from active node list