Documentation ¶
Index ¶
- Constants
- Variables
- func DBKeyBody(id int64) string
- func DBKeyId(id int64) string
- func DBKeyName(name string) string
- func HasPrivi(userPrivi UserPrivi, checkPrivi UserPrivi) bool
- func LockSpaceKey(db, space string) string
- func PartitionKey(partitionID uint32) string
- func ServerKey(name NodeID) string
- func SpaceKey(dbID, spaceId int64) string
- func UserKey(username string) string
- type BuildVersion
- type ChangeMember
- type DB
- type DBID
- type Engine
- type FlushEntity
- type NodeID
- type Partition
- type PartitionForSearch
- type PartitionID
- type PartitionInfo
- type PartitionStatus
- type Replica
- type RetrievalParam
- type Server
- type SlotID
- type Space
- type SpaceID
- type User
- type UserPrivi
- type Version
Constants ¶
View Source
const ( NodeIdSequence = "/id/node" SpaceIdSequence = "/id/space" DBIdSequence = "/id/db" PartitionIdSequence = "/id/partition" )
ids sequence key for etcd
View Source
const ( PrefixUser = "/user/" PrefixLock = "/lock/" PrefixLockCluster = "/lock/_cluster" PrefixServer = "/server/" PrefixSpace = "/space/" PrefixPartition = "/partition/" PrefixDataBase = "/db/" PrefixDataBaseBody = "/db/body/" )
View Source
const ClusterCleanJobKey = "/cluster/cleanjob"
when master runing clean job , it will set value to this key, when other got key , now time less than this they will skip this job
View Source
const (
Gamma = "gamma"
)
Variables ¶
View Source
var PriviMap = map[string]UserPrivi{ "select": PrivilegeSelect, "insert": PrivilegeInsert, "update": PrivilegeUpdate, "delete": PrivilegeDelete, "create": PrivilegeCreate, "alter": PrivilegeAlter, "drop": PrivilegeDrop, "truncate": PrivilegeTruncate, "grant": PrivilegeGrant, }
Functions ¶
func LockSpaceKey ¶
func PartitionKey ¶
Types ¶
type BuildVersion ¶
type ChangeMember ¶
type ChangeMember struct { PartitionID PartitionID `json:"partition_id"` NodeID NodeID `json:"node_id"` Method proto.ConfChangeType `json:"method"` }
type DB ¶
type DB struct { Id DBID `json:"id,omitempty"` Name string `json:"name,omitempty"` Ps []string `json:"ps,omitempty"` //if set this , your db only use you config ps }
db/id/[dbId]:[dbName] db/name/[dbName]:[dbId] db/body/[dbId]:[dbBody]
type Engine ¶
type Engine struct { Name string `json:"name"` IndexSize int64 `json:"index_size"` MaxSize int64 `json:"max_size"` MetricType string `json:"metric_type,omitempty"` RetrievalType string `json:"retrieval_type,omitempty"` RetrievalParam json.RawMessage `json:"retrieval_param,omitempty"` IdType string `json:"id_type,omitempty"` }
func NewDefaultEngine ¶
func NewDefaultEngine() *Engine
func (*Engine) UnmarshalJSON ¶
type FlushEntity ¶
type Partition ¶
type Partition struct { Id PartitionID `json:"id,omitempty"` SpaceId SpaceID `json:"space_id,omitempty"` DBId DBID `json:"db_id,omitempty"` //Slot stores the lower limit of the slot range Slot SlotID `json:"partition_slot"` LeaderID NodeID `json:"leader_name,omitempty"` Replicas []NodeID `json:"replicas,omitempty"` //leader in replicas UpdateTime int64 `json:"update_time,omitempty"` Path string `json:"-"` // contains filtered or unexported fields }
partition/[id]:[body]
func (*Partition) GetStatus ¶
func (p *Partition) GetStatus() PartitionStatus
this is safe method for get status
func (*Partition) SetStatus ¶
func (p *Partition) SetStatus(s PartitionStatus)
this is safe method for set status
type PartitionForSearch ¶
type PartitionInfo ¶
type PartitionInfo struct { PartitionID PartitionID `json:"pid,omitempty"` DocNum uint64 `json:"doc_num,omitempty"` Size int64 `json:"size,omitempty"` ReplicaNum int `json:"replica_num,omitempty"` Path string `json:"path,omitempty"` Unreachable []uint64 `json:"unreachable,omitempty"` Status PartitionStatus `json:"status,omitempty"` Color string `json:"color,omitempty"` Ip string `json:"ip,omitempty"` NodeID uint64 `json:"node_id,omitempty"` RaftStatus *raft.Status `json:"raft_status,omitempty"` IndexStatus int `json:"index_status"` Error string `json:"error,omitempty"` }
get partition from every partitions
type PartitionStatus ¶
type PartitionStatus uint8
const ( PA_UNKNOW PartitionStatus = iota PA_INVALID PA_CLOSED PA_READONLY PA_READWRITE )
type Replica ¶
type Replica struct { NodeID NodeID `json:"nodeID,omitempty"` HeartbeatAddr string `json:"heartbeat_addr,omitempty"` ReplicateAddr string `json:"replicate_addr,omitempty"` RpcAddr string `json:"rpc_addr,omitempty"` }
it use for raft add or remove node
type RetrievalParam ¶
type Server ¶
type Server struct { ID NodeID `json:"name,omitempty"` //unique name for raft RpcPort uint16 `json:"rpc_port"` RaftHeartbeatPort uint16 `json:"raft_heartbeat_port"` RaftReplicatePort uint16 `json:"raft_replicate_port"` Ip string `json:"ip,omitempty"` PartitionIds []PartitionID `json:"p_ids,omitempty"` Size uint64 `json:"size,omitempty"` Private bool `json:"private"` Version *BuildVersion `json:"version"` }
server/id:[body] ttl 3m 3s
type Space ¶
type Space struct { Id SpaceID `json:"id,omitempty"` Name string `json:"name,omitempty"` //user setting Version Version `json:"version,omitempty"` DBId DBID `json:"db_id,omitempty"` Enabled *bool `json:"enabled"` //Enabled flag whether the space can work Partitions []*Partition `json:"partitions"` // partitionids not sorted PartitionNum int `json:"partition_num"` ReplicaNum uint8 `json:"replica_num"` Properties json.RawMessage `json:"properties"` Engine *Engine `json:"engine"` Models json.RawMessage `json:"models,omitempty"` //json model config for python plugin }
space/[dbId]/[spaceId]:[spaceBody]
func (*Space) GetPartition ¶
func (this *Space) GetPartition(id PartitionID) *Partition
func (*Space) PartitionId ¶
func (this *Space) PartitionId(slotID SlotID) PartitionID
type UserPrivi ¶
type UserPrivi uint64
const ( PrivilegeNone UserPrivi = 0 PrivilegeSelect UserPrivi = 1 PrivilegeInsert UserPrivi = 1 << 1 PrivilegeUpdate UserPrivi = 1 << 2 PrivilegeDelete UserPrivi = 1 << 3 PrivilegeCreate UserPrivi = 1 << 4 PrivilegeAlter UserPrivi = 1 << 5 PrivilegeDrop UserPrivi = 1 << 6 PrivilegeTruncate UserPrivi = 1 << 7 PrivilegeGrant UserPrivi = 1 << 8 )
Click to show internal directories.
Click to hide internal directories.