Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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) // GetTNService get services by selector, and the applyFunc used to save the // tn 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. GetTNService(selector Selector, apply func(metadata.TNService) 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 Option ¶
type Option func(*cluster)
Option options for create cluster
func WithDisableRefresh ¶
func WithDisableRefresh() Option
WithDisableRefresh disable refresh from hakeeper
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
Selector is used to choose a service from MOCluster
func NewSelectAll ¶ added in v1.0.0
func NewSelectAll() Selector
NewSelectAll will return all CN services.
func NewSelector ¶
func NewSelector() Selector
NewSelector return a default selector, this empty selector will select all instances. For CN type, it only select the ones whose work state is working.
func NewServiceIDSelector ¶
NewServiceIDSelector
func (Selector) SelectByLabel ¶
SelectByLabel select service by label
func (Selector) SelectByServiceID ¶
SelectByServiceID select service by service ID