metaclient

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: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SaltBytes is the number of bytes used for salts.
	SaltBytes = 32

	// ShardGroupDeletedExpiration is the amount of time before a shard group info will be removed from cached
	// data after it has been marked deleted (2 weeks).
	ShardGroupDeletedExpiration = -2 * 7 * 24 * time.Hour
	IndexGroupDeletedExpiration = -2 * 7 * 24 * time.Hour

	RPCReqTimeout       = 10 * time.Second
	HttpSnapshotTimeout = 4 * time.Second
)
View Source
const (
	ClockFileName = "clock"
)

Variables

View Source
var (
	ErrNameTooLong          = fmt.Errorf("database name must have fewer than %d characters", maxDbOrRpName)
	RetryGetUserInfoTimeout = 5 * time.Second
	RetryExecTimeout        = 60 * time.Second
	RetryReportTimeout      = 60 * time.Second
	HttpReqTimeout          = 10 * time.Second
)
View Source
var LogicClock uint64
View Source
var VerifyNodeEn = true

Functions

This section is empty.

Types

type BaseCallback

type BaseCallback struct {
}

func (*BaseCallback) GetCodec

func (c *BaseCallback) GetCodec() transport.Codec

func (*BaseCallback) Trans2MetaMsg

func (c *BaseCallback) Trans2MetaMsg(data interface{}) (*message.MetaMessage, error)

type Client

type Client struct {
	ShardDurations map[uint64]*meta2.ShardDurationInfo
	DBBriefInfos   map[string]*meta2.DatabaseBriefInfo

	ShardTier uint64

	// send RPC message interface.
	SendRPCMessage
	// contains filtered or unexported fields
}

Client is used to execute commands on and read data from a meta service cluster.

var DefaultMetaClient *Client

func NewClient

func NewClient(weakPwdPath string, retentionAutoCreate bool, maxConcurrentWriteLimit int) *Client

NewClient returns a new *Client.

func (*Client) AdminUserExists

func (c *Client) AdminUserExists() bool

AdminUserExists returns true if any user has admin privilege.

func (*Client) AliveReadNodes added in v1.2.0

func (c *Client) AliveReadNodes() ([]meta2.DataNode, error)

func (*Client) AlterShardKey

func (c *Client) AlterShardKey(database, retentionPolicy, mst string, shardKey *meta2.ShardKeyInfo) error

func (*Client) Authenticate

func (c *Client) Authenticate(username, password string) (u meta2.User, e error)

Authenticate returns a UserInfo if the username and password match an existing entry.

func (*Client) BatchUpdateContinuousQueryStat added in v1.1.0

func (c *Client) BatchUpdateContinuousQueryStat(cqStats map[string]int64) error

BatchUpdateContinuousQueryStat reports all continuous queries state

func (*Client) Close

func (c *Client) Close() error

Close the meta service cluster connection.

func (*Client) ClusterID

func (c *Client) ClusterID() uint64

ClusterID returns the ID of the cluster it's connected to.

func (*Client) CompareHashAndPlainPwd

func (c *Client) CompareHashAndPlainPwd(hashed, plaintext string) error

compares a hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.

func (*Client) CreateContinuousQuery added in v1.1.0

func (c *Client) CreateContinuousQuery(database, name, query string) error

func (*Client) CreateDataNode

func (c *Client) CreateDataNode(writeHost, queryHost, role string) (uint64, uint64, uint64, error)

CreateDataNode will create a new data node in the metastore

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(name string, enableTagArray bool, replicaN uint32, options *obs.ObsOptions) (*meta2.DatabaseInfo, error)

CreateDatabase creates a database or returns it if it already exists.

func (*Client) CreateDatabaseWithRetentionPolicy

func (c *Client) CreateDatabaseWithRetentionPolicy(name string, spec *meta2.RetentionPolicySpec, shardKey *meta2.ShardKeyInfo,
	enableTagArray bool, replicaN uint32) (*meta2.DatabaseInfo, error)

CreateDatabaseWithRetentionPolicy creates a database with the specified retention policy.

When creating a database with a retention policy, the retention policy will always be set to default. Therefore if the caller provides a retention policy that already exists on the database, but that retention policy is not the default one, an error will be returned.

This call is only idempotent when the caller provides the exact same retention policy, and that retention policy is already the default for the database.

func (*Client) CreateMeasurement

func (c *Client) CreateMeasurement(database, retentionPolicy, mst string, shardKey *meta2.ShardKeyInfo, indexR *influxql.IndexRelation,
	engineType config.EngineType, colStoreInfo *meta2.ColStoreInfo, schemaInfo []*proto2.FieldSchema, options *meta2.Options) (*meta2.MeasurementInfo, error)

func (*Client) CreateMetaNode

func (c *Client) CreateMetaNode(httpAddr, tcpAddr string) (*meta2.NodeInfo, error)

func (*Client) CreateRetentionPolicy

func (c *Client) CreateRetentionPolicy(database string, spec *meta2.RetentionPolicySpec, makeDefault bool) (*meta2.RetentionPolicyInfo, error)

CreateRetentionPolicy creates a retention policy on the specified database.

func (*Client) CreateShardGroup

func (c *Client) CreateShardGroup(database, policy string, timestamp time.Time, version uint32, engineType config.EngineType) (*meta2.ShardGroupInfo, error)

CreateShardGroup creates a shard group on a database and policy for a given timestamp.

func (*Client) CreateStreamPolicy added in v1.0.0

func (c *Client) CreateStreamPolicy(info *meta2.StreamInfo) error

func (*Client) CreateSubscription

func (c *Client) CreateSubscription(database, rp, name, mode string, destinations []string) error

CreateSubscription creates a subscription against the given database and retention policy.

func (*Client) CreateUser

func (c *Client) CreateUser(name, password string, admin, rwuser bool) (meta2.User, error)

CreateUser adds a user with the given name and password and admin status.

func (*Client) DBPtView

func (c *Client) DBPtView(database string) (meta2.DBPtInfos, error)

func (*Client) DBRepGroups added in v1.1.0

func (c *Client) DBRepGroups(database string) []meta2.ReplicaGroup

func (*Client) DataNode

func (c *Client) DataNode(id uint64) (*meta2.DataNode, error)

DataNode returns a node by id.

func (*Client) DataNodeByHTTPHost

func (c *Client) DataNodeByHTTPHost(httpAddr string) (*meta2.DataNode, error)

DataNodeByHTTPHost returns the data node with the give http bind address

func (*Client) DataNodeByTCPHost

func (c *Client) DataNodeByTCPHost(tcpAddr string) (*meta2.DataNode, error)

DataNodeByTCPHost returns the data node with the give http bind address

func (*Client) DataNodes

func (c *Client) DataNodes() ([]meta2.DataNode, error)

DataNodes returns the data nodes' info.

func (*Client) Database

func (c *Client) Database(name string) (*meta2.DatabaseInfo, error)

Database returns info for the requested database.

func (*Client) Databases

func (c *Client) Databases() map[string]*meta2.DatabaseInfo

Databases returns a list of all database infos.

func (*Client) DeleteDataNode

func (c *Client) DeleteDataNode(id uint64) error

DeleteDataNode deletes a data node from the cluster.

func (*Client) DeleteIndexGroup

func (c *Client) DeleteIndexGroup(database, policy string, id uint64) error

func (*Client) DeleteMetaNode

func (c *Client) DeleteMetaNode(id uint64) error

func (*Client) DeleteShardGroup

func (c *Client) DeleteShardGroup(database, policy string, id uint64) error

DeleteShardGroup removes a shard group from a database and retention policy by id.

func (*Client) DropContinuousQuery added in v1.1.0

func (c *Client) DropContinuousQuery(name string, database string) error

func (*Client) DropDownSamplePolicy added in v1.0.0

func (c *Client) DropDownSamplePolicy(database, name string, dropAll bool) error

func (*Client) DropShard

func (c *Client) DropShard(id uint64) error

DropShard deletes a shard by ID.

func (*Client) DropStream added in v1.0.0

func (c *Client) DropStream(name string) error

func (*Client) DropSubscription

func (c *Client) DropSubscription(database, rp, name string) error

DropSubscription removes the named subscription from the given database and retention policy.

func (*Client) DropUser

func (c *Client) DropUser(name string) error

DropUser removes the user with the given name.

func (*Client) FieldKeys

func (c *Client) FieldKeys(database string, ms influxql.Measurements) (map[string]map[string]int32, error)

func (*Client) GetAliveShards

func (c *Client) GetAliveShards(database string, sgi *meta2.ShardGroupInfo) []int

used for map shards in select and write progress. write progress shard for all shards in shared-storage and replication policy.

func (*Client) GetAllMst added in v1.1.0

func (c *Client) GetAllMst(dbName string) []string

func (*Client) GetCqLease added in v1.1.0

func (c *Client) GetCqLease(host string) ([]string, error)

func (*Client) GetDownSamplePolicies added in v1.0.0

func (c *Client) GetDownSamplePolicies() (*meta2.DownSamplePoliciesInfoWithDbRp, error)

func (*Client) GetDstStreamInfos added in v1.0.0

func (c *Client) GetDstStreamInfos(db, rp string, dstSis *[]*meta2.StreamInfo) bool

GetDstStreamInfos get the stream info whose db and rip of the data are the same as the db and rp of the source table of the stream Note: make sure dstSis is initialized

func (*Client) GetMaxCQChangeID added in v1.1.0

func (c *Client) GetMaxCQChangeID() uint64

func (*Client) GetMaxSubscriptionID added in v1.1.0

func (c *Client) GetMaxSubscriptionID() uint64

func (*Client) GetMeasurementInfoStore added in v1.0.0

func (c *Client) GetMeasurementInfoStore(dbName string, rpName string, mstName string) (*meta2.MeasurementInfo, error)

func (*Client) GetMeasurements

func (c *Client) GetMeasurements(m *influxql.Measurement) ([]*meta2.MeasurementInfo, error)

func (*Client) GetMeasurementsInfoStore added in v1.1.0

func (c *Client) GetMeasurementsInfoStore(dbName string, rpName string) (*meta2.MeasurementsInfo, error)

func (*Client) GetMstInfoWithInRp added in v1.0.0

func (c *Client) GetMstInfoWithInRp(dbName, rpName string, dataTypes []int64) (*meta2.RpMeasurementsFieldsInfo, error)

func (*Client) GetNodePtsMap added in v1.1.0

func (c *Client) GetNodePtsMap(database string) (map[uint64][]uint32, error)

func (*Client) GetReplicaInfo added in v1.1.0

func (c *Client) GetReplicaInfo(db string, pt uint32) *message.ReplicaInfo

func (*Client) GetReplicaInfoManager added in v1.1.0

func (c *Client) GetReplicaInfoManager() *ReplicaInfoManager

func (*Client) GetReplicaN added in v1.1.0

func (c *Client) GetReplicaN(database string) (int, error)

func (*Client) GetShardDurationInfo

func (c *Client) GetShardDurationInfo(index uint64) (*meta2.ShardDurationResponse, error)

func (*Client) GetShardGroupByTimeRange added in v1.2.0

func (c *Client) GetShardGroupByTimeRange(repoName, streamName string, min, max time.Time) ([]*meta2.ShardGroupInfo, error)

func (*Client) GetShardInfoByTime added in v1.1.0

func (c *Client) GetShardInfoByTime(database, retentionPolicy string, t time.Time, ptIdx int, nodeId uint64, engineType config.EngineType) (*meta2.ShardInfo, error)

func (*Client) GetShardRangeInfo

func (c *Client) GetShardRangeInfo(db string, rp string, shardID uint64) (*meta2.ShardTimeRangeInfo, error)

func (*Client) GetStreamInfos added in v1.0.0

func (c *Client) GetStreamInfos() map[string]*meta2.StreamInfo

func (*Client) GetStreamInfosForStore added in v1.0.0

func (c *Client) GetStreamInfosForStore(currentServer int) map[string]*meta2.StreamInfo

func (*Client) GetStreamInfosStore added in v1.0.0

func (c *Client) GetStreamInfosStore() map[string]*meta2.StreamInfo

func (*Client) InitMetaClient

func (c *Client) InitMetaClient(joinPeers []string, tlsEn bool, storageNodeInfo *StorageNodeInfo, role string) (uint64, uint64, uint64, error)

func (*Client) IsLeader

func (c *Client) IsLeader() bool

IsLeader - should get rid of this

func (*Client) JoinMetaServer

func (c *Client) JoinMetaServer(httpAddr, rpcAddr, tcpAddr string) (*meta2.NodeInfo, error)

JoinMetaServer will add the passed in tcpAddr to the raft peers and add a MetaNode to the metastore

func (*Client) MarkDatabaseDelete

func (c *Client) MarkDatabaseDelete(name string) error

func (*Client) MarkMeasurementDelete

func (c *Client) MarkMeasurementDelete(database, measurement string) error

func (*Client) MarkRetentionPolicyDelete

func (c *Client) MarkRetentionPolicyDelete(database, name string) error

func (*Client) MatchMeasurements

func (c *Client) MatchMeasurements(database string, ms influxql.Measurements) (map[string]*meta2.MeasurementInfo, error)

func (*Client) Measurement

func (c *Client) Measurement(database string, rpName string, mstName string) (*meta2.MeasurementInfo, error)

func (*Client) Measurements

func (c *Client) Measurements(database string, ms influxql.Measurements) ([]string, error)

func (*Client) MetaNodeByAddr

func (c *Client) MetaNodeByAddr(addr string) *meta2.NodeInfo

MetaNodeByAddr returns the meta node's info.

func (*Client) MetaNodes

func (c *Client) MetaNodes() ([]meta2.NodeInfo, error)

MetaNodes returns the meta nodes' info.

func (*Client) MetaServers

func (c *Client) MetaServers() []string

func (*Client) NewDownSamplePolicy added in v1.0.0

func (c *Client) NewDownSamplePolicy(database, name string, info *meta2.DownSamplePolicyInfo) error

func (*Client) NodeID

func (c *Client) NodeID() uint64

NodeID GetNodeID returns the client's node ID.

func (*Client) Open

func (c *Client) Open() error

Open a connection to a meta service cluster.

func (*Client) OpenAtStore added in v1.0.0

func (c *Client) OpenAtStore()

func (*Client) Peers

func (c *Client) Peers() []string

Peers returns the TCPHost addresses of all the metaservers

func (*Client) Ping

func (c *Client) Ping(checkAllMetaServers bool) error

Ping will hit the ping endpoint for the metaservice and return nil if it returns 200. If checkAllMetaServers is set to true, it will hit the ping endpoint and tell it to verify the health of all metaservers in the cluster

func (*Client) PruneGroupsCommand

func (c *Client) PruneGroupsCommand(shardGroup bool, id uint64) error

PyStore send command to PyMeta. NO need to waitForIndex.

func (*Client) QueryTagKeys

func (c *Client) QueryTagKeys(database string, ms influxql.Measurements, cond influxql.Expr) (map[string]map[string]struct{}, error)

func (*Client) ReportShardLoads

func (c *Client) ReportShardLoads(dbPTStats []*proto2.DBPtStatus) error

func (*Client) RetentionPolicy

func (c *Client) RetentionPolicy(database, name string) (rpi *meta2.RetentionPolicyInfo, err error)

RetentionPolicy returns the requested retention policy info.

func (*Client) RetryDownSampleInfo added in v1.0.0

func (c *Client) RetryDownSampleInfo() ([]byte, error)

func (*Client) RetryGetMeasurementInfoStore added in v1.0.0

func (c *Client) RetryGetMeasurementInfoStore(database string, rpName string, mstName string) ([]byte, error)

func (*Client) RetryGetMeasurementsInfoStore added in v1.1.0

func (c *Client) RetryGetMeasurementsInfoStore(database string, rpName string) ([]byte, error)

func (*Client) RetryGetShardAuxInfo

func (c *Client) RetryGetShardAuxInfo(cmd *proto2.Command) ([]byte, error)

func (*Client) RetryGetStreamInfosStore added in v1.0.0

func (c *Client) RetryGetStreamInfosStore() map[string]*meta2.StreamInfo

func (*Client) RetryMstInfosInRp added in v1.0.0

func (c *Client) RetryMstInfosInRp(dbName, rpName string, dataTypes []int64) ([]byte, error)

func (*Client) RetryRegisterQueryIDOffset added in v1.1.0

func (c *Client) RetryRegisterQueryIDOffset(host string) (uint64, error)

RetryRegisterQueryIDOffset send a register rpc to ts-meta,request a query id offset

func (*Client) Schema

func (c *Client) Schema(database string, retentionPolicy string, mst string) (fields map[string]int32,
	dimensions map[string]struct{}, err error)

func (*Client) SendSql2MetaHeartbeat added in v1.1.0

func (c *Client) SendSql2MetaHeartbeat(host string) error

func (*Client) SendSysCtrlToMeta added in v1.2.0

func (c *Client) SendSysCtrlToMeta(mod string, param map[string]string) (map[string]string, error)

func (*Client) SetAdminPrivilege

func (c *Client) SetAdminPrivilege(username string, admin bool) error

SetAdminPrivilege sets or unsets admin privilege to the given username.

func (*Client) SetCacheData added in v1.2.0

func (c *Client) SetCacheData(cacheData *meta2.Data)

this function is used for UT testing

func (*Client) SetData

func (c *Client) SetData(data *meta2.Data) error

SetData overwrites the underlying data in the meta store.

func (*Client) SetDefaultRetentionPolicy

func (c *Client) SetDefaultRetentionPolicy(database, name string) error

SetDefaultRetentionPolicy sets a database's default retention policy.

func (*Client) SetHashAlgo added in v1.1.0

func (c *Client) SetHashAlgo(optHashAlgo string)

func (*Client) SetMetaServers

func (c *Client) SetMetaServers(a []string)

SetMetaServers updates the meta servers on the client.

func (*Client) SetPrivilege

func (c *Client) SetPrivilege(username, database string, p originql.Privilege) error

SetPrivilege sets a privilege for the given user on the given database.

func (*Client) SetTLS

func (c *Client) SetTLS(v bool)

SetTLS sets whether the client should use TLS when connecting. This function is not safe for concurrent use.

func (*Client) SetTier

func (c *Client) SetTier(tier string) error

func (*Client) ShardGroupsByTimeRange

func (c *Client) ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta2.ShardGroupInfo, err error)

ShardGroupsByTimeRange returns a list of all shard groups on a database and policy that may contain data for the specified time range. Shard groups are sorted by start time.

func (*Client) ShardIDs

func (c *Client) ShardIDs() []uint64

ShardIDs returns a list of all shard ids.

func (*Client) ShardOwner

func (c *Client) ShardOwner(shardID uint64) (database, policy string, sgi *meta2.ShardGroupInfo)

ShardOwner returns the owning shard group info for a specific shard.

func (*Client) ShardsByTimeRange

func (c *Client) ShardsByTimeRange(sources influxql.Sources, tmin, tmax time.Time) (a []meta2.ShardInfo, err error)

ShardsByTimeRange returns a slice of shards that may contain data in the time range.

func (*Client) ShowCluster added in v1.2.0

func (c *Client) ShowCluster() models.Rows

func (*Client) ShowClusterWithCondition added in v1.2.0

func (c *Client) ShowClusterWithCondition(nodeType string, ID uint64) (models.Rows, error)

func (*Client) ShowContinuousQueries added in v1.1.0

func (c *Client) ShowContinuousQueries() (models.Rows, error)

func (*Client) ShowDownSamplePolicies added in v1.0.0

func (c *Client) ShowDownSamplePolicies(database string) (models.Rows, error)

func (*Client) ShowRetentionPolicies

func (c *Client) ShowRetentionPolicies(database string) (models.Rows, error)

func (*Client) ShowShardGroups

func (c *Client) ShowShardGroups() models.Rows

func (*Client) ShowShards

func (c *Client) ShowShards() models.Rows

func (*Client) ShowStreams added in v1.0.0

func (c *Client) ShowStreams(database string, showAll bool) (models.Rows, error)

func (*Client) ShowSubscriptions

func (c *Client) ShowSubscriptions() models.Rows

func (*Client) Suicide added in v1.0.0

func (c *Client) Suicide(err error)

func (*Client) TagArrayEnabled added in v1.1.0

func (c *Client) TagArrayEnabled(db string) bool

func (*Client) TagKeys

func (c *Client) TagKeys(database string) map[string]set.Set

func (*Client) ThermalShards added in v1.1.0

func (c *Client) ThermalShards(dbName string, start, end time.Duration) map[uint64]struct{}

func (*Client) UpdateMeasurement added in v1.2.0

func (c *Client) UpdateMeasurement(db, rp, mst string, options *meta2.Options) error

func (*Client) UpdateRetentionPolicy

func (c *Client) UpdateRetentionPolicy(database, name string, rpu *meta2.RetentionPolicyUpdate, makeDefault bool) error

UpdateRetentionPolicy updates a retention policy.

func (*Client) UpdateSchema

func (c *Client) UpdateSchema(database string, retentionPolicy string, mst string, fieldToCreate []*proto2.FieldSchema) error

func (*Client) UpdateShardDownSampleInfo added in v1.0.0

func (c *Client) UpdateShardDownSampleInfo(Ident *meta2.ShardIdentifier) error

func (*Client) UpdateShardInfoTier

func (c *Client) UpdateShardInfoTier(shardID uint64, tier uint64, dbName, rpName string) error

func (*Client) UpdateStreamMstSchema added in v1.0.0

func (c *Client) UpdateStreamMstSchema(database string, retentionPolicy string, mst string, stmt *influxql.SelectStatement) error

func (*Client) UpdateUser

func (c *Client) UpdateUser(name, password string) error

UpdateUser updates the password of an existing user.

func (*Client) User

func (c *Client) User(name string) (meta2.User, error)

User returns the user with the given name, or ErrUserNotFound.

func (*Client) UserCount

func (c *Client) UserCount() int

UserCount returns the number of users stored.

func (*Client) UserPrivilege

func (c *Client) UserPrivilege(username, database string) (*originql.Privilege, error)

UserPrivilege returns the privilege for the given user on the given database.

func (*Client) UserPrivileges

func (c *Client) UserPrivileges(username string) (map[string]originql.Privilege, error)

UserPrivileges returns the privileges for a user mapped by database name.

func (*Client) Users

func (c *Client) Users() []meta2.UserInfo

Users returns a slice of UserInfo representing the currently known users.

func (*Client) WaitForDataChanged

func (c *Client) WaitForDataChanged() chan struct{}

WaitForDataChanged returns a channel that will get a stuct{} when the metastore data has changed.

type CreateNodeCallback

type CreateNodeCallback struct {
	BaseCallback

	NodeStartInfo *meta.NodeStartInfo
}

func (*CreateNodeCallback) Handle

func (c *CreateNodeCallback) Handle(data interface{}) error

type DBPTCtx

type DBPTCtx struct {
	DBPTStat     *proto2.DBPtStatus
	RpStatusPool sync.Pool
}

func (*DBPTCtx) GetDBPTStat

func (r *DBPTCtx) GetDBPTStat() *proto2.DBPtStatus

func (*DBPTCtx) GetRpStat

func (r *DBPTCtx) GetRpStat() []*proto2.RpShardStatus

func (*DBPTCtx) String added in v1.0.0

func (r *DBPTCtx) String() string

type ErrRedirect

type ErrRedirect struct {
	Host string
}

func (ErrRedirect) Error

func (e ErrRedirect) Error() string

type ExecuteAndReportCallback

type ExecuteAndReportCallback struct {
	BaseCallback

	Typ   uint8
	Index uint64

	ErrCommand *errCommand
}

Execute & Report

func (*ExecuteAndReportCallback) Handle

func (c *ExecuteAndReportCallback) Handle(data interface{}) error

type FieldKey

type FieldKey struct {
	Field     string
	FieldType int32
}

type FieldKeys

type FieldKeys []FieldKey

func (FieldKeys) Len

func (a FieldKeys) Len() int

func (FieldKeys) Less

func (a FieldKeys) Less(i, j int) bool

func (FieldKeys) Swap

func (a FieldKeys) Swap(i, j int)

type GetCqLeaseCallback added in v1.1.0

type GetCqLeaseCallback struct {
	BaseCallback
	CQNames []string
}

func (*GetCqLeaseCallback) Handle added in v1.1.0

func (c *GetCqLeaseCallback) Handle(data interface{}) error

type GetDownSampleInfoCallback added in v1.0.0

type GetDownSampleInfoCallback struct {
	BaseCallback
	Data []byte
}

func (*GetDownSampleInfoCallback) Handle added in v1.0.0

func (c *GetDownSampleInfoCallback) Handle(data interface{}) error

type GetMeasurementInfoCallback added in v1.0.0

type GetMeasurementInfoCallback struct {
	BaseCallback

	Data []byte
}

func (*GetMeasurementInfoCallback) Handle added in v1.0.0

func (c *GetMeasurementInfoCallback) Handle(data interface{}) error

type GetMeasurementsInfoCallback added in v1.1.0

type GetMeasurementsInfoCallback struct {
	BaseCallback

	Data []byte
}

func (*GetMeasurementsInfoCallback) Handle added in v1.1.0

func (c *GetMeasurementsInfoCallback) Handle(data interface{}) error

type GetRpMstInfoCallback added in v1.0.0

type GetRpMstInfoCallback struct {
	BaseCallback
	Data []byte
}

func (*GetRpMstInfoCallback) Handle added in v1.0.0

func (c *GetRpMstInfoCallback) Handle(data interface{}) error

type GetShardInfoCallback

type GetShardInfoCallback struct {
	BaseCallback

	Data []byte
}

func (*GetShardInfoCallback) Handle

func (c *GetShardInfoCallback) Handle(data interface{}) error

type GetStreamInfoCallback added in v1.0.0

type GetStreamInfoCallback struct {
	BaseCallback

	Data []byte
}

func (*GetStreamInfoCallback) Handle added in v1.0.0

func (c *GetStreamInfoCallback) Handle(data interface{}) error

type JoinCallback

type JoinCallback struct {
	BaseCallback

	NodeInfo *meta.NodeInfo
}

func (*JoinCallback) Handle

func (c *JoinCallback) Handle(data interface{}) error

type LoadCtx

type LoadCtx struct {
	LoadCh    chan *DBPTCtx
	ReportCtx sync.Pool
}

func (*LoadCtx) GetReportCtx

func (ctx *LoadCtx) GetReportCtx() *DBPTCtx

func (*LoadCtx) PutReportCtx

func (ctx *LoadCtx) PutReportCtx(dbPTCtx *DBPTCtx)

type MetaClient

type MetaClient interface {
	CreateMeasurement(database, retentionPolicy, mst string, shardKey *meta2.ShardKeyInfo, indexR *influxql.IndexRelation, engineType config.EngineType,
		colStoreInfo *meta2.ColStoreInfo, schemaInfo []*proto2.FieldSchema, options *meta2.Options) (*meta2.MeasurementInfo, error)
	AlterShardKey(database, retentionPolicy, mst string, shardKey *meta2.ShardKeyInfo) error
	CreateDatabase(name string, enableTagArray bool, replicaN uint32, options *obs.ObsOptions) (*meta2.DatabaseInfo, error)
	CreateDatabaseWithRetentionPolicy(name string, spec *meta2.RetentionPolicySpec, shardKey *meta2.ShardKeyInfo, enableTagArray bool, replicaN uint32) (*meta2.DatabaseInfo, error)
	CreateRetentionPolicy(database string, spec *meta2.RetentionPolicySpec, makeDefault bool) (*meta2.RetentionPolicyInfo, error)
	CreateSubscription(database, rp, name, mode string, destinations []string) error
	CreateUser(name, password string, admin, rwuser bool) (meta2.User, error)
	Databases() map[string]*meta2.DatabaseInfo
	Database(name string) (*meta2.DatabaseInfo, error)
	DataNode(id uint64) (*meta2.DataNode, error)
	DataNodes() ([]meta2.DataNode, error)
	AliveReadNodes() ([]meta2.DataNode, error)
	DeleteDataNode(id uint64) error
	DeleteMetaNode(id uint64) error
	DropShard(id uint64) error
	DropSubscription(database, rp, name string) error
	DropUser(name string) error
	MetaNodes() ([]meta2.NodeInfo, error)
	RetentionPolicy(database, name string) (rpi *meta2.RetentionPolicyInfo, err error)
	SetAdminPrivilege(username string, admin bool) error
	SetPrivilege(username, database string, p originql.Privilege) error
	ShardsByTimeRange(sources influxql.Sources, tmin, tmax time.Time) (a []meta2.ShardInfo, err error)
	ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta2.ShardGroupInfo, err error)
	UpdateRetentionPolicy(database, name string, rpu *meta2.RetentionPolicyUpdate, makeDefault bool) error
	UpdateUser(name, password string) error
	UserPrivilege(username, database string) (*originql.Privilege, error)
	UserPrivileges(username string) (map[string]originql.Privilege, error)
	Users() []meta2.UserInfo
	MarkDatabaseDelete(name string) error
	MarkRetentionPolicyDelete(database, name string) error
	MarkMeasurementDelete(database, mst string) error
	DBPtView(database string) (meta2.DBPtInfos, error)
	ShardOwner(shardID uint64) (database, policy string, sgi *meta2.ShardGroupInfo)
	Measurement(database string, rpName string, mstName string) (*meta2.MeasurementInfo, error)
	Schema(database string, retentionPolicy string, mst string) (fields map[string]int32, dimensions map[string]struct{}, err error)
	GetMeasurements(m *influxql.Measurement) ([]*meta2.MeasurementInfo, error)
	TagKeys(database string) map[string]set.Set
	FieldKeys(database string, ms influxql.Measurements) (map[string]map[string]int32, error)
	QueryTagKeys(database string, ms influxql.Measurements, cond influxql.Expr) (map[string]map[string]struct{}, error)
	MatchMeasurements(database string, ms influxql.Measurements) (map[string]*meta2.MeasurementInfo, error)
	Measurements(database string, ms influxql.Measurements) ([]string, error)
	ShowShards() models.Rows
	ShowShardGroups() models.Rows
	ShowSubscriptions() models.Rows
	ShowRetentionPolicies(database string) (models.Rows, error)
	ShowCluster() models.Rows
	ShowClusterWithCondition(nodeType string, ID uint64) (models.Rows, error)
	GetAliveShards(database string, sgi *meta2.ShardGroupInfo) []int
	NewDownSamplePolicy(database, name string, info *meta2.DownSamplePolicyInfo) error
	DropDownSamplePolicy(database, name string, dropAll bool) error
	ShowDownSamplePolicies(database string) (models.Rows, error)
	GetMstInfoWithInRp(dbName, rpName string, dataTypes []int64) (*meta2.RpMeasurementsFieldsInfo, error)
	AdminUserExists() bool
	Authenticate(username, password string) (u meta2.User, e error)
	UpdateShardDownSampleInfo(Ident *meta2.ShardIdentifier) error
	OpenAtStore()
	UpdateStreamMstSchema(database string, retentionPolicy string, mst string, stmt *influxql.SelectStatement) error
	CreateStreamPolicy(info *meta2.StreamInfo) error
	GetStreamInfos() map[string]*meta2.StreamInfo
	GetStreamInfosStore() map[string]*meta2.StreamInfo
	ShowStreams(database string, showAll bool) (models.Rows, error)
	DropStream(name string) error
	GetMeasurementInfoStore(database string, rpName string, mstName string) (*meta2.MeasurementInfo, error)
	GetMeasurementsInfoStore(dbName string, rpName string) (*meta2.MeasurementsInfo, error)
	GetAllMst(dbName string) []string
	RetryRegisterQueryIDOffset(host string) (uint64, error)
	ThermalShards(db string, start, end time.Duration) map[uint64]struct{}
	GetNodePtsMap(database string) (map[uint64][]uint32, error)
	DBRepGroups(database string) []meta2.ReplicaGroup
	GetReplicaN(database string) (int, error)

	// for continuous query
	SendSql2MetaHeartbeat(host string) error
	CreateContinuousQuery(database, name, query string) error
	ShowContinuousQueries() (models.Rows, error)
	DropContinuousQuery(name string, database string) error
	UpdateShardInfoTier(shardID uint64, tier uint64, dbName, rpName string) error

	// sysctrl for admin
	SendSysCtrlToMeta(mod string, param map[string]string) (map[string]string, error)
}

MetaClient is an interface for accessing meta data.

type Node

type Node struct {
	ID     uint64
	Clock  uint64
	ConnId uint64
	// contains filtered or unexported fields
}

func NewNode

func NewNode(path string) *Node

func (*Node) LoadLogicalClock

func (n *Node) LoadLogicalClock() error

type Peers

type Peers []string

func (Peers) Append

func (peers Peers) Append(p ...string) Peers

func (Peers) Contains

func (peers Peers) Contains(peer string) bool

func (Peers) Unique

func (peers Peers) Unique() Peers

type PeersCallback

type PeersCallback struct {
	BaseCallback

	Peers []string
}

func (*PeersCallback) Handle

func (c *PeersCallback) Handle(data interface{}) error

type PingCallback

type PingCallback struct {
	BaseCallback

	Leader []byte
}

func (*PingCallback) Handle

func (c *PingCallback) Handle(data interface{}) error

type RPCMessageSender added in v1.1.0

type RPCMessageSender struct{}

func (*RPCMessageSender) SendRPCMsg added in v1.1.0

func (s *RPCMessageSender) SendRPCMsg(currentServer int, msg *message.MetaMessage, callback transport.Callback) error

type RegisterQueryIDOffsetCallback added in v1.1.0

type RegisterQueryIDOffsetCallback struct {
	BaseCallback
	Offset uint64
}

func (*RegisterQueryIDOffsetCallback) Handle added in v1.1.0

func (c *RegisterQueryIDOffsetCallback) Handle(data interface{}) error

type ReplicaInfoManager added in v1.1.0

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

func NewReplicaInfoManager added in v1.1.0

func NewReplicaInfoManager() *ReplicaInfoManager

func (*ReplicaInfoManager) Get added in v1.1.0

func (*ReplicaInfoManager) Update added in v1.1.0

func (m *ReplicaInfoManager) Update(data *meta.Data, nodeID uint64)

type Role added in v1.0.0

type Role int
const (
	SQL Role = iota
	STORE
	META
)

type SendRPCMessage added in v1.1.0

type SendRPCMessage interface {
	SendRPCMsg(currentServer int, msg *message.MetaMessage, callback transport.Callback) error
}

type SendSysCtrlToMetaCallback added in v1.2.0

type SendSysCtrlToMetaCallback struct {
	BaseCallback
}

func (*SendSysCtrlToMetaCallback) Handle added in v1.2.0

func (c *SendSysCtrlToMetaCallback) Handle(data interface{}) error

type SnapshotCallback

type SnapshotCallback struct {
	BaseCallback

	Data []byte
}

func (*SnapshotCallback) Handle

func (c *SnapshotCallback) Handle(data interface{}) error

type Sql2MetaHeartbeatCallback added in v1.1.0

type Sql2MetaHeartbeatCallback struct {
	BaseCallback
}

func (*Sql2MetaHeartbeatCallback) Handle added in v1.1.0

func (c *Sql2MetaHeartbeatCallback) Handle(data interface{}) error

type StorageNodeInfo

type StorageNodeInfo struct {
	InsertAddr string
	SelectAddr string
}

type VerifyDataNodeStatusCallback added in v1.1.1

type VerifyDataNodeStatusCallback struct {
	BaseCallback
}

func (*VerifyDataNodeStatusCallback) Handle added in v1.1.1

func (c *VerifyDataNodeStatusCallback) Handle(data interface{}) error

Jump to

Keyboard shortcuts

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