client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchCallCmd added in v1.0.3

func BatchCallCmd(nodes []*util.PegasusNode, cmd string, args []string) map[*util.PegasusNode]*CmdResult

BatchCallCmd performs remote commands in parallel to multiple nodes.

func DowngradeNode added in v1.0.2

func DowngradeNode(meta Meta, node *util.PegasusNode) error

DowngradeNode sets all secondaries from the specified node to inactive state. NOTE: this step requires that the node has no primary, otherwise error is returned.

func DowngradeNodeWithDetails added in v1.1.0

func DowngradeNodeWithDetails(meta Meta, node *util.PegasusNode) ([]*base.Gpid, error)

DowngradeNodeWithDetails is like DowngradeNode but also returns the partitions that were downgraded.

func ListPrimariesOnNode added in v1.2.0

func ListPrimariesOnNode(meta Meta, node *util.PegasusNode, tableName string) ([]*replication.PartitionConfiguration, error)

func MigratePrimariesOut added in v1.0.2

func MigratePrimariesOut(meta Meta, node *util.PegasusNode) error

MigratePrimariesOut migrates all primaries out from the specified node. Internally, for every partition it merely swaps the roles of primary and secondary, so it incurs no data migration. Eventually, the node will have no primaries because they are all turned to secondaries.

func SetMetaLevelLively added in v1.0.2

func SetMetaLevelLively(meta Meta) error

func SetMetaLevelSteady added in v1.0.2

func SetMetaLevelSteady(meta Meta) error

func SetRPCTimeout

func SetRPCTimeout(d time.Duration)

SetRPCTimeout is the global timeout setting of RPC.

Types

type BalanceType added in v1.0.2

type BalanceType int
const (
	BalanceMovePri BalanceType = iota
	BalanceCopyPri
	BalanceCopySec
)

func (BalanceType) String added in v1.0.2

func (t BalanceType) String() string

type ClusterReplicaInfo added in v1.0.3

type ClusterReplicaInfo struct {
	Tables []*TableHealthInfo
	Nodes  []*NodeState
}

ClusterReplicaInfo is a report of the replicas distributed in the cluster.

func GetClusterReplicaInfo added in v1.0.3

func GetClusterReplicaInfo(meta Meta) (*ClusterReplicaInfo, error)

GetClusterReplicaInfo returns replica info in both node and table perspectives. = From node perspective, it returns a list of node states, each contains the replica details, including those with no replicas (empty node). = From table perspective, it returns a list of table states, each contains the partition health information.

type CmdResult added in v1.0.3

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

CmdResult is the result of remote command to a node.

func CallCmd added in v1.0.3

func CallCmd(n *util.PegasusNode, cmd string, args []string) *CmdResult

CallCmd calls remote command to a single node.

func (*CmdResult) Error added in v1.0.3

func (c *CmdResult) Error() error

func (*CmdResult) Failed added in v1.0.3

func (c *CmdResult) Failed() bool

func (*CmdResult) RespBody added in v1.0.3

func (c *CmdResult) RespBody() string

func (*CmdResult) String added in v1.0.3

func (c *CmdResult) String() string

type Meta

type Meta interface {
	Close() error

	// ListAvailableApps lists only available tables.
	ListAvailableApps() ([]*admin.AppInfo, error)

	ListApps(status admin.AppStatus) ([]*admin.AppInfo, error)

	QueryConfig(tableName string) (*replication.QueryCfgResponse, error)

	MetaControl(level admin.MetaFunctionLevel) (oldLevel admin.MetaFunctionLevel, err error)

	QueryClusterInfo() (map[string]string, error)

	UpdateAppEnvs(tableName string, envs map[string]string) error

	ClearAppEnvs(tableName string, clearPrefix string) error

	DelAppEnvs(tableName string, keys []string) error

	CreateApp(tableName string, envs map[string]string, partitionCount int) (int32, error)

	DropApp(tableName string, reserveSeconds int64) error

	ModifyDuplication(tableName string, dupid int, status admin.DuplicationStatus) error

	AddDuplication(tableName string, remoteCluster string, freezed bool) (*admin.DuplicationAddResponse, error)

	QueryDuplication(tableName string) (*admin.DuplicationQueryResponse, error)

	ListNodes() ([]*admin.NodeInfo, error)

	RecallApp(originTableID int, newTableName string) (*admin.AppInfo, error)

	Balance(gpid *base.Gpid, opType BalanceType, from *util.PegasusNode, to *util.PegasusNode) error

	Propose(gpid *base.Gpid, action admin.ConfigType, target *util.PegasusNode, node *util.PegasusNode) error

	StartBackupApp(tableID int, providerType string, backupPath string) (*admin.StartBackupAppResponse, error)

	QueryBackupStatus(tableID int, backupID int64) (*admin.QueryBackupStatusResponse, error)

	RestoreApp(oldClusterName string, oldTableName string, oldTableID int, backupID int64, providerType string,
		newTableName string, restorePath string, skipBadPartition bool, policyName string) (*admin.CreateAppResponse, error)

	StartPartitionSplit(tableName string, newPartitionCount int) error

	QuerySplitStatus(tableName string) (*admin.QuerySplitResponse, error)

	PausePartitionSplit(tableName string, parentPidx int) error

	RestartPartitionSplit(tableName string, parentPidx int) error

	CancelPartitionSplit(tableName string, oldPartitionCount int) error

	StartBulkLoad(tableName string, clusterName string, providerType string, rootPath string) error

	QueryBulkLoad(tableName string) (*admin.QueryBulkLoadResponse, error)

	PauseBulkLoad(tableName string) error

	RestartBulkLoad(tableName string) error

	CancelBulkLoad(tableName string, forced bool) error

	StartManualCompaction(tableName string, targetLevel int, maxRunningCount int, bottommost bool) error

	QueryManualCompaction(tableName string) (*admin.QueryAppManualCompactResponse, error)
}

Meta is a helper over pegasus-go-client's primitive session.MetaManager. It aims to provide an easy-to-use API that eliminates some boilerplate code, like context creation, request/response creation, etc.

func NewRPCBasedMeta

func NewRPCBasedMeta(metaAddrs []string) Meta

NewRPCBasedMeta creates the connection to meta.

type NodeState added in v1.0.3

type NodeState struct {
	IPPort string

	Status admin.NodeStatus

	PrimariesNum   int
	SecondariesNum int
	ReplicaCount   int
}

func ListNodesReplicaInfo added in v1.0.3

func ListNodesReplicaInfo(meta Meta) ([]*NodeState, error)

ListNodesReplicaInfo returns how replicas distributed among nodes.

type TableHealthInfo added in v1.0.2

type TableHealthInfo struct {
	PartitionCount int32
	Unhealthy      int32
	WriteUnhealthy int32
	ReadUnhealthy  int32
	FullHealthy    int32
}

TableHealthInfo is a report of replica health within the table.

func GetTableHealthInfo added in v1.0.2

func GetTableHealthInfo(meta Meta, tableName string) (*TableHealthInfo, error)

GetTableHealthInfo return *TableHealthInfo from meta.

Jump to

Keyboard shortcuts

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