meta

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartTimeOut = 15
	LockTimeOut  = 15
)
View Source
const (
	Stopped = iota
	Running
	Stopping
)
View Source
const (
	DeleteDatabase = iota
	DeleteRp
	DeleteMeasurement
)
View Source
const (
	MuxHeader = 8
)
View Source
const SerialBalanceAlgoName string = "v1.0"

Variables

View Source
var ErrRaftNotOpen = fmt.Errorf("raft instance is not ready")
View Source
var ErrRaftTransOpenFailed = fmt.Errorf("raft trans open failed")

Functions

func TransMeasurementInfos2Bytes added in v1.0.0

func TransMeasurementInfos2Bytes(dataTypes []int64, rpInfos *meta.RetentionPolicyInfo) ([]byte, error)

Types

type AddrRewriter

type AddrRewriter struct {
	// contains filtered or unexported fields
}

func NewAddrRewriter

func NewAddrRewriter() *AddrRewriter

func (*AddrRewriter) Rewrite

func (r *AddrRewriter) Rewrite(ln net.Listener, addr string) (string, error)

func (*AddrRewriter) RewriteHost

func (r *AddrRewriter) RewriteHost(addr string) string

func (*AddrRewriter) SetHostname

func (r *AddrRewriter) SetHostname(hostname string)

type AnalysisCache

type AnalysisCache struct {
	Index      int                  `json:"index"`
	LockHolder string               `json:"lockHolder"`
	TaskLock   map[string]string    `json:"taskLock"`
	Heart      map[string]time.Time `json:"heart"`
}

type AnalysisRequest

type AnalysisRequest struct {
	AnalysisCache
	Req AnalysisRequestType `json:"req"`
}

type AnalysisRequestType

type AnalysisRequestType int
const (
	AquireLock AnalysisRequestType = iota
	Heart
	ReleaseLock
)

type AnalysisResponse

type AnalysisResponse struct {
	AnalysisCache
	Error string `json:"error"`
	Ok    bool   `json:"ok"`
}

type AssignEvent

type AssignEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

func NewAssignEvent

func NewAssignEvent(pt *meta.DbPtInfo, targetId uint64, aliveConnId uint64, isUserCommand bool) *AssignEvent

func (*AssignEvent) String added in v1.0.0

func (e *AssignEvent) String() string

type AssignState

type AssignState int
const (
	Init         AssignState = 0
	StartAssign  AssignState = 8
	AssignFailed AssignState = 9
	Assigned     AssignState = 10
	Final        AssignState = 11
)

func (AssignState) String

func (s AssignState) String() string

type BalanceManager added in v1.0.0

type BalanceManager struct {
	// contains filtered or unexported fields
}

func NewBalanceManager added in v1.0.0

func NewBalanceManager(algo string) *BalanceManager

func (*BalanceManager) Start added in v1.0.0

func (b *BalanceManager) Start()

Start balance goroutine

func (*BalanceManager) Stop added in v1.0.0

func (b *BalanceManager) Stop()

Stop balance goroutine

type BaseEvent

type BaseEvent struct {
	// contains filtered or unexported fields
}

type BaseHandler

type BaseHandler struct {
	// contains filtered or unexported fields
}

func (*BaseHandler) InitHandler

func (h *BaseHandler) InitHandler(store MetaStoreInterface, conf *config.Meta, closing chan struct{})

func (*BaseHandler) Process

func (h *BaseHandler) Process() (transport.Codec, error)

type ClusterManager

type ClusterManager struct {
	// contains filtered or unexported fields
}

func CreateClusterManager added in v1.0.0

func CreateClusterManager() *ClusterManager

func NewClusterManager

func NewClusterManager(store storeInterface) *ClusterManager

func (*ClusterManager) Close

func (cm *ClusterManager) Close()

func (*ClusterManager) GetEventCh

func (cm *ClusterManager) GetEventCh() chan serf.Event

func (*ClusterManager) PreviousNode

func (cm *ClusterManager) PreviousNode() []*serf.PreviousNode

func (*ClusterManager) SetMemberIds added in v1.1.1

func (cm *ClusterManager) SetMemberIds(memberIds map[uint64]struct{})

func (*ClusterManager) SetStop added in v1.1.1

func (cm *ClusterManager) SetStop(stop int32)

func (*ClusterManager) Start

func (cm *ClusterManager) Start()

func (*ClusterManager) Stop

func (cm *ClusterManager) Stop()

func (*ClusterManager) WaitEventDone

func (cm *ClusterManager) WaitEventDone()

type CreateNode

type CreateNode struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*CreateNode) Instance

func (h *CreateNode) Instance() RPCHandler

func (*CreateNode) Process

func (h *CreateNode) Process() (transport.Codec, error)

func (*CreateNode) SetRequestMsg

func (h *CreateNode) SetRequestMsg(data transport.Codec) error

type DbPtIds added in v1.1.0

type DbPtIds struct {
	// contains filtered or unexported fields
}

type EventResultInfo

type EventResultInfo struct {
	// contains filtered or unexported fields
}

type EventType

type EventType int
const (
	AssignType EventType = iota
	OffloadType
	MoveType
)

func (EventType) String added in v1.0.0

func (t EventType) String() string

type Execute

type Execute struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Execute) Instance

func (h *Execute) Instance() RPCHandler

func (*Execute) Process

func (h *Execute) Process() (transport.Codec, error)

func (*Execute) SetRequestMsg

func (h *Execute) SetRequestMsg(data transport.Codec) error

type GetContinuousQueryLease added in v1.1.0

type GetContinuousQueryLease struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetContinuousQueryLease) Instance added in v1.1.0

func (h *GetContinuousQueryLease) Instance() RPCHandler

func (*GetContinuousQueryLease) Process added in v1.1.0

func (h *GetContinuousQueryLease) Process() (transport.Codec, error)

func (*GetContinuousQueryLease) SetRequestMsg added in v1.1.0

func (h *GetContinuousQueryLease) SetRequestMsg(data transport.Codec) error

type GetDownSampleInfo added in v1.0.0

type GetDownSampleInfo struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetDownSampleInfo) Instance added in v1.0.0

func (h *GetDownSampleInfo) Instance() RPCHandler

func (*GetDownSampleInfo) Process added in v1.0.0

func (h *GetDownSampleInfo) Process() (transport.Codec, error)

func (*GetDownSampleInfo) SetRequestMsg added in v1.0.0

func (h *GetDownSampleInfo) SetRequestMsg(data transport.Codec) error

type GetMeasurementInfo added in v1.0.0

type GetMeasurementInfo struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetMeasurementInfo) Instance added in v1.0.0

func (h *GetMeasurementInfo) Instance() RPCHandler

func (*GetMeasurementInfo) Process added in v1.0.0

func (h *GetMeasurementInfo) Process() (transport.Codec, error)

func (*GetMeasurementInfo) SetRequestMsg added in v1.0.0

func (h *GetMeasurementInfo) SetRequestMsg(data transport.Codec) error

type GetMeasurementsInfo added in v1.1.0

type GetMeasurementsInfo struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetMeasurementsInfo) Instance added in v1.1.0

func (h *GetMeasurementsInfo) Instance() RPCHandler

func (*GetMeasurementsInfo) Process added in v1.1.0

func (h *GetMeasurementsInfo) Process() (transport.Codec, error)

func (*GetMeasurementsInfo) SetRequestMsg added in v1.1.0

func (h *GetMeasurementsInfo) SetRequestMsg(data transport.Codec) error

type GetRpMstInfos added in v1.0.0

type GetRpMstInfos struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetRpMstInfos) Instance added in v1.0.0

func (h *GetRpMstInfos) Instance() RPCHandler

func (*GetRpMstInfos) Process added in v1.0.0

func (h *GetRpMstInfos) Process() (transport.Codec, error)

func (*GetRpMstInfos) SetRequestMsg added in v1.0.0

func (h *GetRpMstInfos) SetRequestMsg(data transport.Codec) error

type GetShardInfo

type GetShardInfo struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetShardInfo) Instance

func (h *GetShardInfo) Instance() RPCHandler

func (*GetShardInfo) Process

func (h *GetShardInfo) Process() (transport.Codec, error)

func (*GetShardInfo) SetRequestMsg

func (h *GetShardInfo) SetRequestMsg(data transport.Codec) error

type GetStreamInfo added in v1.0.0

type GetStreamInfo struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*GetStreamInfo) Instance added in v1.0.0

func (h *GetStreamInfo) Instance() RPCHandler

func (*GetStreamInfo) Process added in v1.0.0

func (h *GetStreamInfo) Process() (transport.Codec, error)

func (*GetStreamInfo) SetRequestMsg added in v1.0.0

func (h *GetStreamInfo) SetRequestMsg(data transport.Codec) error

type HeartbeatInfo added in v1.1.0

type HeartbeatInfo struct {
	Host              string
	LastHeartbeatTime time.Time
}

type IStore

type IStore interface {
	GetData() *meta.Data //get the Data in the store
	IsLeader() bool

	ExpandGroups() error

	SpecialCtlData(cmd string) error
	// contains filtered or unexported methods
}

type MSMState added in v1.0.0

type MSMState int

type MetaServer

type MetaServer struct {
	// contains filtered or unexported fields
}

func NewMetaServer

func NewMetaServer(addr string, store MetaStoreInterface, conf *config.Meta) *MetaServer

func (*MetaServer) Start

func (s *MetaServer) Start() error

func (*MetaServer) Stop

func (s *MetaServer) Stop()

type MetaStoreInterface

type MetaStoreInterface interface {
	IsLeader() bool
	Join(n *meta.NodeInfo) (*meta.NodeInfo, error)

	UpdateLoad(b []byte) error

	GetDownSampleInfo() ([]byte, error)
	GetRpMstInfos(db, rp string, dataTypes []int64) ([]byte, error)
	GetUserInfo() ([]byte, error)
	// contains filtered or unexported methods
}

type MigrateEvent

type MigrateEvent interface {
	String() string
	// contains filtered or unexported methods
}

type MigrateStateMachine

type MigrateStateMachine struct {
	// contains filtered or unexported fields
}

func NewMigrateStateMachine added in v1.0.0

func NewMigrateStateMachine() *MigrateStateMachine

func (*MigrateStateMachine) CheckNodeEventExsit added in v1.1.1

func (m *MigrateStateMachine) CheckNodeEventExsit(nodeIds []uint64) bool

exsit: return true

func (*MigrateStateMachine) Start added in v1.0.0

func (m *MigrateStateMachine) Start()

func (*MigrateStateMachine) Stop added in v1.0.0

func (m *MigrateStateMachine) Stop()

type MoveEvent added in v1.0.0

type MoveEvent struct {
	BaseEvent
	// contains filtered or unexported fields
}

func NewMoveEvent added in v1.0.0

func NewMoveEvent(pt *meta.DbPtInfo, src, dst uint64, aliveConnId uint64, isUserCommand bool) *MoveEvent

func (*MoveEvent) String added in v1.0.0

func (e *MoveEvent) String() string

func (*MoveEvent) StringForTest added in v1.1.0

func (e *MoveEvent) StringForTest() string

type MoveState added in v1.0.0

type MoveState int
const (
	MoveInit               MoveState = 0
	MovePreOffload         MoveState = 1
	MoveRollbackPreOffload MoveState = 2
	MovePreAssign          MoveState = 3
	MoveRollbackPreAssign  MoveState = 4 // rollback preAssign in store when preAssign failed
	MoveOffload            MoveState = 5 // if offload failed retry do not rollback preAssign
	MoveOffloadFailed      MoveState = 6
	MoveOffloaded          MoveState = 7
	MoveAssign             MoveState = 8
	MoveAssignFailed       MoveState = 9
	MoveAssigned           MoveState = 10
	MoveFinal              MoveState = 11
)

func (MoveState) String added in v1.0.0

func (s MoveState) String() string

type NextAction

type NextAction int
const (
	ActionContinue NextAction = iota
	ActionWait
	ActionFinish
	ActionError
)

type Peers

type Peers struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Peers) Instance

func (h *Peers) Instance() RPCHandler

func (*Peers) Process

func (h *Peers) Process() (transport.Codec, error)

func (*Peers) SetRequestMsg

func (h *Peers) SetRequestMsg(data transport.Codec) error

type Ping

type Ping struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Ping) Instance

func (h *Ping) Instance() RPCHandler

func (*Ping) Process

func (h *Ping) Process() (transport.Codec, error)

func (*Ping) SetRequestMsg

func (h *Ping) SetRequestMsg(data transport.Codec) error

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(conf *config.Meta, store MetaStoreInterface) *Processor

func (*Processor) Clone

func (p *Processor) Clone() transport.Handler

func (*Processor) Handle

func (p *Processor) Handle(w spdy.Responser, data interface{}) error

type RPCHandler

type RPCHandler interface {
	SetRequestMsg(transport.Codec) error
	Process() (transport.Codec, error)
	Instance() RPCHandler
	InitHandler(MetaStoreInterface, *config.Meta, chan struct{})
}

func New

func New(typ uint8) RPCHandler

type RaftInterface added in v1.0.0

type RaftInterface interface {
	State() raft.RaftState
	Peers() ([]string, error)
	Close() error
	IsLeader() bool
	IsCandidate() bool
	Leader() string
	Apply(b []byte) error
	AddServer(addr string) error
	ShowDebugInfo(witch string) ([]byte, error)
	UserSnapshot() error
	LeadershipTransfer() error
}

type RegisterQueryIDOffset added in v1.1.0

type RegisterQueryIDOffset struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*RegisterQueryIDOffset) Instance added in v1.1.0

func (h *RegisterQueryIDOffset) Instance() RPCHandler

func (*RegisterQueryIDOffset) Process added in v1.1.0

func (h *RegisterQueryIDOffset) Process() (transport.Codec, error)

func (*RegisterQueryIDOffset) SetRequestMsg added in v1.1.0

func (h *RegisterQueryIDOffset) SetRequestMsg(data transport.Codec) error

type Report

type Report struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Report) Instance

func (h *Report) Instance() RPCHandler

func (*Report) Process

func (h *Report) Process() (transport.Codec, error)

func (*Report) SetRequestMsg

func (h *Report) SetRequestMsg(data transport.Codec) error

type ScheduleType

type ScheduleType int
const (
	ScheduleNormal ScheduleType = iota
	ScheduleRetry
	ScheduleNone
)

type SendSysCtrlToMeta added in v1.2.0

type SendSysCtrlToMeta struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*SendSysCtrlToMeta) Instance added in v1.2.0

func (h *SendSysCtrlToMeta) Instance() RPCHandler

func (*SendSysCtrlToMeta) Process added in v1.2.0

func (h *SendSysCtrlToMeta) Process() (transport.Codec, error)

func (*SendSysCtrlToMeta) SetRequestMsg added in v1.2.0

func (h *SendSysCtrlToMeta) SetRequestMsg(data transport.Codec) error

type Service

type Service struct {
	RaftListener net.Listener

	Version string

	Logger *logger.Logger

	Node *metaclient.Node
	// contains filtered or unexported fields
}

func NewService

func NewService(c *config.Meta, tlsConfig *tls.Config) *Service

NewService returns a new instance of Service.

func (*Service) Close

func (s *Service) Close() error

func (*Service) GetClusterManager

func (s *Service) GetClusterManager() *ClusterManager

func (*Service) Open

func (s *Service) Open() error

Open starts the meta service

func (*Service) SetStatisticsPusher added in v1.0.0

func (s *Service) SetStatisticsPusher(pusher *statisticsPusher.StatisticsPusher)

func (*Service) StartReportServer added in v1.0.0

func (s *Service) StartReportServer()

StartReportServer starts report server.

type ShardStat

type ShardStat struct {
	// contains filtered or unexported fields
}

func (ShardStat) String

func (ss ShardStat) String() string

type Snapshot

type Snapshot struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Snapshot) Instance

func (h *Snapshot) Instance() RPCHandler

func (*Snapshot) Process

func (h *Snapshot) Process() (transport.Codec, error)

func (*Snapshot) SetRequestMsg

func (h *Snapshot) SetRequestMsg(data transport.Codec) error

type Sql2MetaHeartbeat added in v1.1.0

type Sql2MetaHeartbeat struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Sql2MetaHeartbeat) Instance added in v1.1.0

func (h *Sql2MetaHeartbeat) Instance() RPCHandler

func (*Sql2MetaHeartbeat) Process added in v1.1.0

func (h *Sql2MetaHeartbeat) Process() (transport.Codec, error)

func (*Sql2MetaHeartbeat) SetRequestMsg added in v1.1.0

func (h *Sql2MetaHeartbeat) SetRequestMsg(data transport.Codec) error

type Store

type Store struct {
	Logger *logger.Logger

	Node     *mclient.Node
	NetStore interface {
		GetShardSplitPoints(node *meta.DataNode, database string, pt uint32, shardId uint64, idxes []int64) ([]string, error)
		DeleteDatabase(node *meta.DataNode, database string, pt uint32) error
		DeleteRetentionPolicy(node *meta.DataNode, db string, rp string, pt uint32) error
		DeleteMeasurement(node *meta.DataNode, db string, rp string, name string, shardIds []uint64) error
		MigratePt(nodeID uint64, data transport.Codec, cb transport.Callback) error
		SendSegregateNodeCmds(nodeIDs []uint64, address []string) (int, error)
	}
	// contains filtered or unexported fields
}

func NewStore

func NewStore(c *config.Meta, httpAddr, rpcAddr, raftAddr string) *Store

NewStore will create a new metaStore with the passed in config

func (*Store) ApplyCmd

func (s *Store) ApplyCmd(cmd *mproto.Command) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) ExpandGroups added in v1.0.0

func (s *Store) ExpandGroups() error

func (*Store) GetClose

func (s *Store) GetClose() chan struct{}

func (*Store) GetClusterManager

func (s *Store) GetClusterManager() *ClusterManager

func (*Store) GetData

func (s *Store) GetData() *meta.Data

getData is used to get the Data in the Store

func (*Store) GetDownSampleInfo added in v1.0.0

func (s *Store) GetDownSampleInfo() ([]byte, error)

func (*Store) GetRpMstInfos added in v1.0.0

func (s *Store) GetRpMstInfos(db, rp string, dataTypes []int64) ([]byte, error)

func (*Store) GetUserInfo added in v1.0.0

func (s *Store) GetUserInfo() ([]byte, error)

func (*Store) IsLeader

func (s *Store) IsLeader() bool

IsLeader returns true if the Store is currently the leader.

func (*Store) Join

func (s *Store) Join(n *meta.NodeInfo) (*meta.NodeInfo, error)

func (*Store) Open

func (s *Store) Open(raftln net.Listener) error

open opens and initializes the raft Store.

func (*Store) RemoveNode added in v1.1.1

func (s *Store) RemoveNode(nodeIds []uint64) error

func (*Store) SetClusterManager

func (s *Store) SetClusterManager(cm *ClusterManager)

func (*Store) SetSegregateNodeStatus added in v1.1.1

func (s *Store) SetSegregateNodeStatus(status []uint64, nodeIds []uint64) error

func (*Store) SpecialCtlData added in v1.1.1

func (s *Store) SpecialCtlData(cmd string) error

cmd sample: limit|192.168.0.11,192.168.0.12 or unlimit|xxxx or delete|xxxx

func (*Store) UpdateLoad

func (s *Store) UpdateLoad(b []byte) error

func (*Store) WaitNodeTakeOverDone added in v1.1.1

func (s *Store) WaitNodeTakeOverDone(nodeIds []uint64, address []string, preSegregateStatus []uint64) error

type Update

type Update struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*Update) Instance

func (h *Update) Instance() RPCHandler

func (*Update) Process

func (h *Update) Process() (transport.Codec, error)

func (*Update) SetRequestMsg

func (h *Update) SetRequestMsg(data transport.Codec) error

type VerifyDataNodeStatus added in v1.1.1

type VerifyDataNodeStatus struct {
	BaseHandler
	// contains filtered or unexported fields
}

func (*VerifyDataNodeStatus) Instance added in v1.1.1

func (h *VerifyDataNodeStatus) Instance() RPCHandler

func (*VerifyDataNodeStatus) Process added in v1.1.1

func (h *VerifyDataNodeStatus) Process() (transport.Codec, error)

func (*VerifyDataNodeStatus) SetRequestMsg added in v1.1.1

func (h *VerifyDataNodeStatus) SetRequestMsg(data transport.Codec) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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