entity

package
v0.0.0-...-927e444 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

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

View Source
const (
	LocalSingleAddr = "127.0.0.1"
	LocalCastAddr   = "0.0.0.0"
)
View Source
const (
	SequenceNodeID  = "/sequence/node/"
	SequenceRangeID = "/sequence/range/"
	SequencePeerID  = "/sequence/peer/"
	// new table or new index
	SequenceCreateID = "/sequence/create/"
)

ids sequence key for etcd

View Source
const (
	PrefixLock        = "/lock/"
	PrefixLockCluster = "/lock/_cluster/"
	PrefixNode        = "/node/"
	PrefixNodeTTL     = "/ttl/node/"
	PrefixTable       = "/table/"
	PrefixRange       = "/range/"
	PrefixIndex       = "/index/"
	PrefixDataBase    = "/db/"
	PrefixCreate      = "/create/"
)
View Source
const (
	ConfAutoSplit = "/config/auto_split"
	ConfFailOver  = "/config/fail_over"
	ConfBalanced  = "/config/balanced"
)
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

Variables

This section is empty.

Functions

func CreateKey

func CreateKey(createID int64) string

func DBKey

func DBKey(id int32) string

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

func IndexRangeKey(tableID, indexID int32, rangeID uint64) string

only include index type of ranges

func IndexRangeKeyPre

func IndexRangeKeyPre(tableID, indexID int32) string

func InitConfig

func InitConfig(path string)

func InitMonitor

func InitMonitor()

func LoadConfig

func LoadConfig(conf *Config, path string)

func LockCluster

func LockCluster() string

func LockDBKey

func LockDBKey(dbID int32) string

func LockTableKey

func LockTableKey(dbID, tableID int32) string

func Monitor

func Monitor() monitoring.Monitor

func NodeKey

func NodeKey(nodeID uint64) string

func NodeTTLKey

func NodeTTLKey(nodeID uint64) string

func OK

func OK() *mspb.ResponseHeader

func RangeKey

func RangeKey(tableID int32, rangeID uint64) string

include data/index type of ranges this is for compatibility

func RangeKeyPre

func RangeKeyPre(tableID int32) string

func SetConfigVersion

func SetConfigVersion(bv, bt, ci string)

func TableKey

func TableKey(dbID, tableID int32) string

func TableKeyPre

func TableKeyPre(dbID int32) string

Types

type Config

type Config struct {
	Global  *GlobalCfg `toml:"global,omitempty" json:"global"`
	Masters Masters    `toml:"masters,omitempty" json:"masters"`
}

func Conf

func Conf() *Config

func (*Config) CurrentByMasterNameDomainIp

func (config *Config) CurrentByMasterNameDomainIp(masterName string) error

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?

func (*Config) GetEmbed

func (config *Config) GetEmbed() (*embed.Config, error)

GetEmbed will get or generate the etcd configuration

func (*Config) Validate

func (config *Config) Validate() error

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"`
}

func (*MasterCfg) ApiUrl

func (m *MasterCfg) ApiUrl() string

type Masters

type Masters []*MasterCfg

func (Masters) ClientAddress

func (ms Masters) ClientAddress() []string

new client use this function to get client urls

func (Masters) Self

func (ms Masters) Self() *MasterCfg

type ProtoReq

type ProtoReq interface {
	Marshal() (dAtA []byte, err error)
	Unmarshal(dAtA []byte) error
	GetHeader() *mspb.RequestHeader
}

type ProtoResp

type ProtoResp interface {
	Marshal() (dAtA []byte, err error)
	Unmarshal(dAtA []byte) error
	GetHeader() *mspb.ResponseHeader
}

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
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL