Documentation ¶
Overview ¶
Copyright 2018 The ChuBao 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 DBKey(id uint64) string
- func DBKeyName(name string) string
- func DBKeys(id uint64, name string) (dbKey, nameKey string)
- func Err(e error) *mspb.ResponseHeader
- func GetBuildTime() string
- func GetBuildVersion() string
- func GetCommitID() string
- func InitConfig(path string)
- func InitMonitor()
- func LoadConfig(conf *Config, path string)
- func LockCluster() string
- func LockDBKey(dbID uint64) string
- func LockTableKey(dbID, tableID uint64) string
- func Monitor() monitoring.Monitor
- func NodeKey(nodeID uint64) string
- func NodeTTLKey(nodeID uint64) string
- func OK() *mspb.ResponseHeader
- func RangeKey(tableID, rangeID uint64) string
- func RangeKeyPre(tableID uint64) string
- func SequenceDocument(dbID, tableID uint64) string
- func SetConfigVersion(bv, bt, ci string)
- func TableKey(dbID, tableID uint64) string
- func TableKeyPre(dbID uint64) string
- type Config
- type GlobalCfg
- type MasterCfg
- type Masters
- type ProtoReq
- type ProtoResp
- type TableProperty
Constants ¶
const ( LocalSingleAddr = "127.0.0.1" LocalCastAddr = "0.0.0.0" )
const ( SequenceNodeID = "/sequence/node/" SequenceRangeID = "/sequence/range/" SequenceTableID = "/sequence/table/" SequencePeerID = "/sequence/peer/" SequenceDBID = "/sequence/db/" SequenceIndexID = "/sequence/index/" )
ids sequence key for etcd
const ( PrefixLock = "/lock/" PrefixLockCluster = "/lock/_cluster/" PrefixNode = "/node/" PrefixNodeTTL = "/ttl/node/" PrefixTable = "/table/" PrefixRange = "/range/" PrefixDataBase = "/db/" )
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 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 SequenceDocument ¶
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 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