clusterservice

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EQ ==
	EQ = Op(1)
)

Functions

This section is empty.

Types

type ClusterClient

type ClusterClient interface {
	GetClusterDetails(ctx context.Context) (logpb.ClusterDetails, error)
}

type MOCluster

type MOCluster interface {
	// GetCNService get services by selector, and the applyFunc used to save the
	// cn service that matches the selector's conditions.
	//
	// Since the query result may be a Slice, to avoid memory allocation overhead,
	// we use apply to notify the caller of a Service that satisfies the condition.
	GetCNService(selector Selector, apply func(metadata.CNService) bool)
	// GetDNService get services by selector, and the applyFunc used to save the
	// dn service that matches the selector's conditions.
	//
	// Since the query result may be a Slice, to avoid memory allocation overhead,
	// we use apply to notify the caller of a Service that satisfies the condition.
	GetDNService(selector Selector, apply func(metadata.DNService) bool)
	// ForceRefresh when other modules use the cluster information and find out that
	// the current cache information is out of date, you can force the cache to be
	// refreshed.
	ForceRefresh()
	// Close close the cluster
	Close()
	// DebugUpdateCNLabel updates the labels on specified CN. It is only used in mo_ctl
	// internally for debug purpose.
	DebugUpdateCNLabel(uuid string, kvs map[string][]string) error
}

MOCluster is used to get the meta and status information of the MO cluster.

TODO(fagongzi): In the future, all cluster-related information should be obtained from this interface, such as the distribution of table data on cn and other statistical information.

func GetMOCluster

func GetMOCluster() MOCluster

GetMOCluster get mo cluster from process level runtime

func NewMOCluster

func NewMOCluster(
	client ClusterClient,
	refreshInterval time.Duration,
	opts ...Option) MOCluster

NewMOCluster create a MOCluter by HAKeeperClient. MoCluster synchronizes information from HAKeeper and forcibly refreshes the information once every refreshInterval.

TODO(fagongzi): extend hakeeper to support event-driven original message changes

type Op

type Op int

Op compare op

type Option

type Option func(*cluster)

Option options for create cluster

func WithDisableRefresh

func WithDisableRefresh() Option

WithDisableRefresh disable refresh from hakeeper

func WithServices

func WithServices(
	cnServices []metadata.CNService,
	dnServices []metadata.DNService) Option

WithServices set init cn and dn services

type Selector

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

Selector is used to choose a service from MOCluster

func NewSelector

func NewSelector() Selector

NewSelector return a default selector, this empty selector will select all input

func NewServiceIDSelector

func NewServiceIDSelector(serviceID string) Selector

NewServiceIDSelector

func (Selector) SelectByLabel

func (s Selector) SelectByLabel(labels map[string]string, op Op) Selector

SelectByLabel select service by label

func (Selector) SelectByServiceID

func (s Selector) SelectByServiceID(serviceID string) Selector

SelectByServiceID select service by service ID

Jump to

Keyboard shortcuts

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