Documentation ¶
Overview ¶
Copyright 2018 The JIMDB Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CreateKey(createID int64) string
- func DBKey(id int32) string
- func Err(e error) *mspb.ResponseHeader
- func GetBuildTime() string
- func GetBuildVersion() string
- func GetCommitID() string
- func IndexRangeKey(tableID, indexID int32, rangeID uint64) string
- func IndexRangeKeyPre(tableID, indexID int32) string
- func InitConfig(path string)
- func InitMonitor()
- func LoadConfig(conf *Config, path string)
- func LockCluster() string
- func LockDBKey(dbID int32) string
- func LockTableKey(dbID, tableID int32) string
- func Monitor() monitoring.Monitor
- func NodeKey(nodeID uint64) string
- func NodeTTLKey(nodeID uint64) string
- func OK() *mspb.ResponseHeader
- func RangeKey(tableID int32, rangeID uint64) string
- func RangeKeyPre(tableID int32) string
- func SetConfigVersion(bv, bt, ci string)
- func TableKey(dbID, tableID int32) string
- func TableKeyPre(dbID int32) string
- type Config
- type CreateRecord
- type GlobalCfg
- type MasterCfg
- type Masters
- type ProtoReq
- type ProtoResp
- type RecordState
- type TableRecord
Constants ¶
const ( LocalSingleAddr = "127.0.0.1" LocalCastAddr = "0.0.0.0" )
const ( SequenceNodeID = "/sequence/node/" SequenceRangeID = "/sequence/range/" SequencePeerID = "/sequence/peer/" // new table or new index SequenceCreateID = "/sequence/create/" )
ids sequence key for etcd
const ( PrefixLock = "/lock/" PrefixLockCluster = "/lock/_cluster/" PrefixNode = "/node/" PrefixNodeTTL = "/ttl/node/" PrefixTable = "/table/" PrefixRange = "/range/" PrefixIndex = "/index/" PrefixDataBase = "/db/" PrefixCreate = "/create/" )
const ( ConfAutoSplit = "/config/auto_split" ConfFailOver = "/config/fail_over" ConfBalanced = "/config/balanced" )
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
Variables ¶
This section is empty.
Functions ¶
func Err ¶
func Err(e error) *mspb.ResponseHeader
func GetBuildTime ¶
func GetBuildTime() string
func GetBuildVersion ¶
func GetBuildVersion() string
func GetCommitID ¶
func GetCommitID() string
func IndexRangeKey ¶
only include index type of ranges
func IndexRangeKeyPre ¶
func InitConfig ¶
func InitConfig(path string)
func InitMonitor ¶
func InitMonitor()
func LoadConfig ¶
func LockCluster ¶
func LockCluster() string
func LockTableKey ¶
func Monitor ¶
func Monitor() monitoring.Monitor
func NodeTTLKey ¶
func OK ¶
func OK() *mspb.ResponseHeader
func RangeKeyPre ¶
func SetConfigVersion ¶
func SetConfigVersion(bv, bt, ci string)
func TableKeyPre ¶
Types ¶
type Config ¶
type Config struct { Global *GlobalCfg `toml:"global,omitempty" json:"global"` Masters Masters `toml:"masters,omitempty" json:"masters"` }
func (*Config) CurrentByMasterNameDomainIp ¶
CurrentByMasterNameDomainIp find this machine domain.The main purpose of this function is to find the master from from multiple masters and set it‘s Field:self to true. The only criterion for judging is: Is the IP address the same with one of the masters?
type CreateRecord ¶
type CreateRecord struct { CreateId int64 RngIds []uint64 CreateTime int64 CreateState RecordState }
type GlobalCfg ¶
type GlobalCfg struct { Name string `toml:"name,omitempty" json:"name"` Log string `toml:"log,omitempty" json:"log"` Data string `toml:"data,omitempty" json:"data"` Level string `toml:"level,omitempty" json:"level"` Signkey string `toml:"signkey,omitempty" json:"signkey"` ClusterID uint64 `toml:"cluster_id,omitempty" json:"cluster_id"` ReplicaNum int `toml:"replica_num,omitempty" json:"replica_num"` ScheduleSecond int `toml:"schedule_second,omitempty" json:"schedule_second"` PeerDownSecond int `toml:"peer_down_second,omitempty" json:"peer_down_second"` MemoryRatio float64 `toml:"memory_ratio,omitempty" json:"memory_ratio"` MonitorEnable bool `toml:"monitor_enable,omitempty" json:"monitor_enable"` Monitor string `toml:"monitor,omitempty" json:"monitor"` PushGateway string `toml:"push_gateway,omitempty" json:"push_gateway"` PushInterval int `toml:"push_interval,omitempty" json:"push_interval"` }
type MasterCfg ¶
type MasterCfg struct { Name string `toml:"name,omitempty" json:"name"` Address string `toml:"address,omitempty" json:"address"` ApiPort uint16 `toml:"api_port,omitempty" json:"api_port"` EtcdPort uint16 `toml:"etcd_port,omitempty" json:"etcd_port"` EtcdPeerPort uint16 `toml:"etcd_peer_port,omitempty" json:"etcd_peer_port"` EtcdClientPort uint16 `toml:"etcd_client_port,omitempty" json:"etcd_client_port"` Self bool `json:"-"` PprofPort uint16 `toml:"pprof_port,omitempty" json:"pprof_port"` }
type Masters ¶
type Masters []*MasterCfg
func (Masters) ClientAddress ¶
new client use this function to get client urls
type RecordState ¶
type RecordState int32
const ( RecordState_Unknown RecordState = iota RecordState_Creating RecordState_Created RecordState_Failed )
type TableRecord ¶
type TableRecord struct { DbId int32 TableId int32 Replicas int32 CreateTime int64 State RecordState }