cluster

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 34 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const NumberOfEntries = 30

NumberOfEntries is the max number of StatEntry that preserved, it is the history of a container's heartbeats. The interval of container heartbeats from TiKV is 10s, so we can preserve 30 entries per container which is about 5 minutes.

View Source
const StaleEntriesTimeout = 300 * time.Second

StaleEntriesTimeout is the time before an entry is deleted as stale. It is about 30 entries * 10s

Variables

View Source
var ThreadsCollected = []string{"grpc-server-"}

ThreadsCollected filters the threads to take into the calculation of CPU usage.

Functions

This section is empty.

Types

type CPUEntries

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

CPUEntries saves a history of container statistics

func NewCPUEntries

func NewCPUEntries(size int) *CPUEntries

NewCPUEntries returns the StateEntries with a fixed size

func (*CPUEntries) Append

func (s *CPUEntries) Append(stat *StatEntry, threads ...string) bool

Append a StatEntry, it accepts an optional threads as a filter of CPU usage

func (*CPUEntries) CPU

func (s *CPUEntries) CPU() float64

CPU returns the cpu usage

type ContainerLimiter

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

ContainerLimiter adjust the container limit dynamically

func NewContainerLimiter

func NewContainerLimiter(opt *config.PersistOptions, logger *zap.Logger) *ContainerLimiter

NewContainerLimiter builds a container limiter object using the operator controller

func (*ContainerLimiter) Collect

func (s *ContainerLimiter) Collect(stats *metapb.ContainerStats)

Collect the container statistics and update the cluster state

func (*ContainerLimiter) ContainerLimitScene

func (s *ContainerLimiter) ContainerLimitScene(limitType limit.Type) *limit.Scene

ContainerLimitScene returns the current limit for different scenes

func (*ContainerLimiter) ReplaceContainerLimitScene

func (s *ContainerLimiter) ReplaceContainerLimitScene(scene *limit.Scene, limitType limit.Type)

ReplaceContainerLimitScene replaces the container limit values for different scenes

type LoadState

type LoadState int

LoadState indicates the load of a cluster or container

const (
	LoadStateNone LoadState = iota
	LoadStateIdle
	LoadStateLow
	LoadStateNormal
	LoadStateHigh
)

LoadStates that supported, None means no state determined

func (LoadState) String

func (s LoadState) String() string

String representation of LoadState

type RaftCluster

type RaftCluster struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

RaftCluster is used for cluster config management. Raft cluster key format: cluster 1 -> /1/raft, value is metapb.Cluster cluster 2 -> /2/raft For cluster 1 container 1 -> /1/raft/s/1, value is metadata.Container resource 1 -> /1/raft/r/1, value is metadata.Resource

func NewRaftCluster

func NewRaftCluster(ctx context.Context,
	root string,
	clusterID uint64,
	etcdClient *clientv3.Client,
	adapter metadata.Adapter,
	resourceStateChangedHandler func(res metadata.Resource, from metapb.ResourceState, to metapb.ResourceState),
	logger *zap.Logger) *RaftCluster

NewRaftCluster create a new cluster.

func (*RaftCluster) AddContainerLimit

func (c *RaftCluster) AddContainerLimit(container metadata.Container)

AddContainerLimit add a container limit for a given container ID.

func (*RaftCluster) AddScheduler

func (c *RaftCluster) AddScheduler(scheduler schedule.Scheduler, args ...string) error

AddScheduler adds a scheduler.

func (*RaftCluster) AddSuspectKeyRange

func (c *RaftCluster) AddSuspectKeyRange(group uint64, start, end []byte)

AddSuspectKeyRange adds the key range with the its ruleID as the key The instance of each keyRange is like following format: [2][]byte: start key/end key

func (*RaftCluster) AddSuspectResources

func (c *RaftCluster) AddSuspectResources(resourceIDs ...uint64)

AddSuspectResources adds resources to suspect list.

func (*RaftCluster) AllocID

func (c *RaftCluster) AllocID() (uint64, error)

AllocID allocs ID.

func (*RaftCluster) AttachAvailableFunc

func (c *RaftCluster) AttachAvailableFunc(containerID uint64, limitType limit.Type, f func() bool)

AttachAvailableFunc attaches an available function to a specific container.

func (*RaftCluster) ChangedEventNotifier

func (c *RaftCluster) ChangedEventNotifier() <-chan rpcpb.EventNotify

ChangedEventNotifier changedEventNotifier

func (*RaftCluster) CheckReadStatus

func (c *RaftCluster) CheckReadStatus(res *core.CachedResource) []*statistics.HotPeerStat

CheckReadStatus checks the read status, returns whether need update statistics and item.

func (*RaftCluster) CheckWriteStatus

func (c *RaftCluster) CheckWriteStatus(res *core.CachedResource) []*statistics.HotPeerStat

CheckWriteStatus checks the write status, returns whether need update statistics and item.

func (*RaftCluster) ClearSuspectKeyRanges

func (c *RaftCluster) ClearSuspectKeyRanges()

ClearSuspectKeyRanges clears the suspect keyRanges, only for unit test

func (*RaftCluster) DisableJointConsensus

func (c *RaftCluster) DisableJointConsensus()

DisableJointConsensus do nothing

func (*RaftCluster) DropCacheResource

func (c *RaftCluster) DropCacheResource(id uint64)

DropCacheResource removes a resource from the cache.

func (*RaftCluster) FitResource

func (c *RaftCluster) FitResource(res *core.CachedResource) *placement.ResourceFit

FitResource tries to fit the resource with placement rules.

func (*RaftCluster) GetAdjacentResources

func (c *RaftCluster) GetAdjacentResources(res *core.CachedResource) (*core.CachedResource, *core.CachedResource)

GetAdjacentResources returns resources' information that are adjacent with the specific resource ID.

func (*RaftCluster) GetAllContainersLimit

func (c *RaftCluster) GetAllContainersLimit() map[uint64]config.ContainerLimitConfig

GetAllContainersLimit returns all container limit

func (*RaftCluster) GetAverageResourceSize

func (c *RaftCluster) GetAverageResourceSize() int64

GetAverageResourceSize returns the average resource approximate size.

func (*RaftCluster) GetCacheCluster

func (c *RaftCluster) GetCacheCluster() *core.BasicCluster

GetCacheCluster gets the cached cluster.

func (*RaftCluster) GetClusterVersion

func (c *RaftCluster) GetClusterVersion() string

GetClusterVersion returns the current cluster version.

func (*RaftCluster) GetContainer

func (c *RaftCluster) GetContainer(containerID uint64) *core.CachedContainer

GetContainer gets container from cluster.

func (*RaftCluster) GetContainerCount

func (c *RaftCluster) GetContainerCount() int

GetContainerCount returns the count of containers.

func (*RaftCluster) GetContainerLimitByType

func (c *RaftCluster) GetContainerLimitByType(containerID uint64, typ limit.Type) float64

GetContainerLimitByType returns the container limit for a given container ID and type.

func (*RaftCluster) GetContainerLimiter

func (c *RaftCluster) GetContainerLimiter() *ContainerLimiter

GetContainerLimiter returns the dynamic adjusting limiter

func (*RaftCluster) GetContainerResourceCount

func (c *RaftCluster) GetContainerResourceCount(groupKey string, containerID uint64) int

GetContainerResourceCount returns the number of resources for a given container.

func (*RaftCluster) GetContainerResources

func (c *RaftCluster) GetContainerResources(groupKey string, containerID uint64) []*core.CachedResource

GetContainerResources returns all resources' information with a given containerID.

func (*RaftCluster) GetContainers

func (c *RaftCluster) GetContainers() []*core.CachedContainer

GetContainers returns all containers in the cluster.

func (*RaftCluster) GetContainersLoads

func (c *RaftCluster) GetContainersLoads() map[uint64][]float64

GetContainersLoads returns load stats of all containers.

func (*RaftCluster) GetContainersStats

func (c *RaftCluster) GetContainersStats() *statistics.ContainersStats

GetContainersStats returns containers' statistics from cluster. And it will be unnecessary to filter unhealthy container, because it has been solved in process heartbeat

func (*RaftCluster) GetDestroyingResources added in v0.2.0

func (c *RaftCluster) GetDestroyingResources() []*core.CachedResource

GetDestroyingResources returns all resources in destroying state

func (*RaftCluster) GetFollowerContainers

func (c *RaftCluster) GetFollowerContainers(res *core.CachedResource) []*core.CachedContainer

GetFollowerContainers returns all containers that contains the resource's follower peer.

func (*RaftCluster) GetHeartbeatStreams

func (c *RaftCluster) GetHeartbeatStreams() *hbstream.HeartbeatStreams

GetHeartbeatStreams returns the heartbeat streams.

func (*RaftCluster) GetHotReadResources

func (c *RaftCluster) GetHotReadResources() *statistics.ContainerHotPeersInfos

GetHotReadResources gets hot read resources' info.

func (*RaftCluster) GetHotWriteResources

func (c *RaftCluster) GetHotWriteResources() *statistics.ContainerHotPeersInfos

GetHotWriteResources gets hot write resources' info.

func (*RaftCluster) GetLeaderContainer

func (c *RaftCluster) GetLeaderContainer(res *core.CachedResource) *core.CachedContainer

GetLeaderContainer returns all containers that contains the resource's leader peer.

func (*RaftCluster) GetLogger added in v0.2.0

func (c *RaftCluster) GetLogger() *zap.Logger

GetLogger returns zap logger

func (*RaftCluster) GetMergeChecker

func (c *RaftCluster) GetMergeChecker() *checker.MergeChecker

GetMergeChecker returns merge checker.

func (*RaftCluster) GetMetaContainers

func (c *RaftCluster) GetMetaContainers() []metadata.Container

GetMetaContainers gets containers from cluster.

func (*RaftCluster) GetMetaResources

func (c *RaftCluster) GetMetaResources() []metadata.Resource

GetMetaResources gets resources from cluster.

func (*RaftCluster) GetOfflineResourceStatsByType

func (c *RaftCluster) GetOfflineResourceStatsByType(typ statistics.ResourceStatisticType) []*core.CachedResource

GetOfflineResourceStatsByType gets the status of the offline resource by types.

func (*RaftCluster) GetOperatorController

func (c *RaftCluster) GetOperatorController() *schedule.OperatorController

GetOperatorController returns the operator controller.

func (*RaftCluster) GetOpts

func (c *RaftCluster) GetOpts() *config.PersistOptions

GetOpts returns cluster's configuration.

func (*RaftCluster) GetPrevResourceByKey

func (c *RaftCluster) GetPrevResourceByKey(group uint64, resourceKey []byte) *core.CachedResource

GetPrevResourceByKey gets previous resource and leader peer by the resource key from cluster.

func (*RaftCluster) GetReplicationConfig

func (c *RaftCluster) GetReplicationConfig() *config.ReplicationConfig

GetReplicationConfig get the replication config.

func (*RaftCluster) GetResource

func (c *RaftCluster) GetResource(resourceID uint64) *core.CachedResource

GetResource searches for a resource by ID.

func (*RaftCluster) GetResourceByKey

func (c *RaftCluster) GetResourceByKey(group uint64, resourceKey []byte) *core.CachedResource

GetResourceByKey gets CachedResource by resource key from cluster.

func (*RaftCluster) GetResourceContainers

func (c *RaftCluster) GetResourceContainers(res *core.CachedResource) []*core.CachedContainer

GetResourceContainers returns all containers that contains the resource's peer.

func (*RaftCluster) GetResourceCount

func (c *RaftCluster) GetResourceCount() int

GetResourceCount returns total count of resources

func (*RaftCluster) GetResourceFactory

func (c *RaftCluster) GetResourceFactory() func() metadata.Resource

GetResourceFactory resource factory

func (*RaftCluster) GetResourceScatter

func (c *RaftCluster) GetResourceScatter() *schedule.ResourceScatterer

GetResourceScatter returns the resource scatter.

func (*RaftCluster) GetResourceSplitter

func (c *RaftCluster) GetResourceSplitter() *schedule.ResourceSplitter

GetResourceSplitter returns the resource splitter

func (*RaftCluster) GetResourceStats

func (c *RaftCluster) GetResourceStats(group uint64, startKey, endKey []byte) *statistics.ResourceStats

GetResourceStats returns resource statistics from cluster.

func (*RaftCluster) GetResourceStatsByType

func (c *RaftCluster) GetResourceStatsByType(typ statistics.ResourceStatisticType) []*core.CachedResource

GetResourceStatsByType gets the status of the resource by types.

func (*RaftCluster) GetResources

func (c *RaftCluster) GetResources() []*core.CachedResource

GetResources returns all resources' information in detail.

func (*RaftCluster) GetRuleManager

func (c *RaftCluster) GetRuleManager() *placement.RuleManager

GetRuleManager returns the rule manager reference.

func (*RaftCluster) GetScheduleGroupKeys added in v0.2.0

func (c *RaftCluster) GetScheduleGroupKeys() []string

GetScheduleGroupKeys returns group keys

func (*RaftCluster) GetScheduleGroupKeysWithPrefix added in v0.2.0

func (c *RaftCluster) GetScheduleGroupKeysWithPrefix(prefix string) []string

func (*RaftCluster) GetSchedulerHandlers

func (c *RaftCluster) GetSchedulerHandlers() map[string]http.Handler

GetSchedulerHandlers gets all scheduler handlers.

func (*RaftCluster) GetSchedulers

func (c *RaftCluster) GetSchedulers() []string

GetSchedulers gets all schedulers.

func (*RaftCluster) GetStorage

func (c *RaftCluster) GetStorage() storage.Storage

GetStorage returns the storage.

func (*RaftCluster) GetSuspectResources

func (c *RaftCluster) GetSuspectResources() []uint64

GetSuspectResources gets all suspect resources.

func (*RaftCluster) HandleAddScheduleGroupRule added in v0.2.0

func (c *RaftCluster) HandleAddScheduleGroupRule(request *rpcpb.Request) error

func (*RaftCluster) HandleAppliedRules

func (c *RaftCluster) HandleAppliedRules(request *rpcpb.Request) (*rpcpb.GetAppliedRulesRsp, error)

HandleAppliedRules handle get applied rules

func (*RaftCluster) HandleAskBatchSplit

func (c *RaftCluster) HandleAskBatchSplit(request *rpcpb.Request) (*rpcpb.AskBatchSplitRsp, error)

HandleAskBatchSplit handles the batch split request.

func (*RaftCluster) HandleCheckResourceState

func (c *RaftCluster) HandleCheckResourceState(request *rpcpb.Request) (*rpcpb.CheckResourceStateRsp, error)

HandleCheckResourceState handle check resource state

func (*RaftCluster) HandleContainerHeartbeat

func (c *RaftCluster) HandleContainerHeartbeat(stats *metapb.ContainerStats) error

HandleContainerHeartbeat updates the container status.

func (*RaftCluster) HandleCreateDestroying added in v0.2.0

func (c *RaftCluster) HandleCreateDestroying(req rpcpb.CreateDestroyingReq) (metapb.ResourceState, error)

HandleCreateDestroying handle create destroying

func (*RaftCluster) HandleCreateResources

func (c *RaftCluster) HandleCreateResources(request *rpcpb.Request) (*rpcpb.CreateResourcesRsp, error)

HandleCreateResources handle create resources. It will create resources with full replica peers.

func (*RaftCluster) HandleGetDestroying added in v0.2.0

func (c *RaftCluster) HandleGetDestroying(req rpcpb.GetDestroyingReq) (*metapb.DestroyingStatus, error)

HandleGetDestroying returns resource destroying status

func (*RaftCluster) HandleGetScheduleGroupRule added in v0.2.0

func (c *RaftCluster) HandleGetScheduleGroupRule(request *rpcpb.Request) ([]metapb.ScheduleGroupRule, error)

func (*RaftCluster) HandlePutPlacementRule

func (c *RaftCluster) HandlePutPlacementRule(request *rpcpb.Request) error

HandlePutPlacementRule handle put placement rule

func (*RaftCluster) HandleRemoveResources

func (c *RaftCluster) HandleRemoveResources(request *rpcpb.Request) (*rpcpb.RemoveResourcesRsp, error)

HandleRemoveResources handle remove resources

func (*RaftCluster) HandleReportDestroyed added in v0.2.0

func (c *RaftCluster) HandleReportDestroyed(req rpcpb.ReportDestroyedReq) (metapb.ResourceState, error)

HandleReportDestroyed handle report destroyed

func (*RaftCluster) HandleResourceHeartbeat

func (c *RaftCluster) HandleResourceHeartbeat(res *core.CachedResource) error

HandleResourceHeartbeat processes CachedResource reports from client.

func (*RaftCluster) InitCluster

func (c *RaftCluster) InitCluster(opt *config.PersistOptions, storage storage.Storage, basicCluster *core.BasicCluster)

InitCluster initializes the raft cluster.

func (*RaftCluster) IsResourceHot

func (c *RaftCluster) IsResourceHot(res *core.CachedResource) bool

IsResourceHot checks if a resource is in hot state.

func (*RaftCluster) IsRunning

func (c *RaftCluster) IsRunning() bool

IsRunning return if the cluster is running.

func (*RaftCluster) IsSchedulerDisabled

func (c *RaftCluster) IsSchedulerDisabled(name string) (bool, error)

IsSchedulerDisabled checks if a scheduler is disabled.

func (*RaftCluster) IsSchedulerPaused

func (c *RaftCluster) IsSchedulerPaused(name string) (bool, error)

IsSchedulerPaused checks if a scheduler is paused.

func (*RaftCluster) JointConsensusEnabled

func (c *RaftCluster) JointConsensusEnabled() bool

JointConsensusEnabled always returns true

func (*RaftCluster) LoadClusterInfo

func (c *RaftCluster) LoadClusterInfo() (*RaftCluster, error)

LoadClusterInfo loads cluster related info.

func (*RaftCluster) PauseLeaderTransfer

func (c *RaftCluster) PauseLeaderTransfer(containerID uint64) error

PauseLeaderTransfer prevents the container from been selected as source or target container of TransferLeader.

func (*RaftCluster) PauseOrResumeScheduler

func (c *RaftCluster) PauseOrResumeScheduler(name string, t int64) error

PauseOrResumeScheduler pauses or resumes a scheduler.

func (*RaftCluster) PopOneSuspectKeyRange

func (c *RaftCluster) PopOneSuspectKeyRange() (uint64, [2][]byte, bool)

PopOneSuspectKeyRange gets one suspect keyRange group. it would return value and true if pop success, or return empty [][2][]byte and false if suspectKeyRanges couldn't pop keyRange group.

func (*RaftCluster) PutContainer

func (c *RaftCluster) PutContainer(container metadata.Container) error

PutContainer puts a container.

func (*RaftCluster) RandFollowerResource

func (c *RaftCluster) RandFollowerResource(groupKey string, containerID uint64, ranges []core.KeyRange, opts ...core.ResourceOption) *core.CachedResource

RandFollowerResource returns a random resource that has a follower on the container.

func (*RaftCluster) RandHotResourceFromContainer

func (c *RaftCluster) RandHotResourceFromContainer(container uint64, kind statistics.FlowKind) *core.CachedResource

RandHotResourceFromContainer randomly picks a hot resource in specified container.

func (*RaftCluster) RandLeaderResource

func (c *RaftCluster) RandLeaderResource(groupKey string, containerID uint64, ranges []core.KeyRange, opts ...core.ResourceOption) *core.CachedResource

RandLeaderResource returns a random resource that has leader on the container.

func (*RaftCluster) RandLearnerResource

func (c *RaftCluster) RandLearnerResource(groupKey string, containerID uint64, ranges []core.KeyRange, opts ...core.ResourceOption) *core.CachedResource

RandLearnerResource returns a random resource that has a learner peer on the container.

func (*RaftCluster) RandPendingResource

func (c *RaftCluster) RandPendingResource(groupKey string, containerID uint64, ranges []core.KeyRange, opts ...core.ResourceOption) *core.CachedResource

RandPendingResource returns a random resource that has a pending peer on the container.

func (*RaftCluster) RemoveContainer

func (c *RaftCluster) RemoveContainer(containerID uint64, physicallyDestroyed bool) error

RemoveContainer marks a container as offline in cluster. State transition: Up -> Offline.

func (*RaftCluster) RemoveContainerLimit

func (c *RaftCluster) RemoveContainerLimit(containerID uint64)

RemoveContainerLimit remove a container limit for a given container ID.

func (*RaftCluster) RemoveScheduler

func (c *RaftCluster) RemoveScheduler(name string) error

RemoveScheduler removes a scheduler.

func (*RaftCluster) RemoveSuspectResource

func (c *RaftCluster) RemoveSuspectResource(id uint64)

RemoveSuspectResource removes resource from suspect list.

func (*RaftCluster) RemoveTombStoneRecords

func (c *RaftCluster) RemoveTombStoneRecords() error

RemoveTombStoneRecords removes the tombStone Records.

func (*RaftCluster) ResourceReadStats

func (c *RaftCluster) ResourceReadStats() map[uint64][]*statistics.HotPeerStat

ResourceReadStats returns hot resource's read stats. The result only includes peers that are hot enough.

func (*RaftCluster) ResourceWriteStats

func (c *RaftCluster) ResourceWriteStats() map[uint64][]*statistics.HotPeerStat

ResourceWriteStats returns hot resource's write stats. The result only includes peers that are hot enough.

func (*RaftCluster) ResumeLeaderTransfer

func (c *RaftCluster) ResumeLeaderTransfer(containerID uint64)

ResumeLeaderTransfer cleans a container's pause state. The container can be selected as source or target of TransferLeader again.

func (*RaftCluster) ScanResources

func (c *RaftCluster) ScanResources(group uint64, startKey, endKey []byte, limit int) []*core.CachedResource

ScanResources scans resource with start key, until the resource contains endKey, or total number greater than limit.

func (*RaftCluster) SetAllContainersLimit

func (c *RaftCluster) SetAllContainersLimit(typ limit.Type, ratePerMin float64) error

SetAllContainersLimit sets all container limit for a given type and rate.

func (*RaftCluster) SetContainerLimit

func (c *RaftCluster) SetContainerLimit(containerID uint64, typ limit.Type, ratePerMin float64) error

SetContainerLimit sets a container limit for a given type and rate.

func (*RaftCluster) SetContainerWeight

func (c *RaftCluster) SetContainerWeight(containerID uint64, leaderWeight, resourceWeight float64) error

SetContainerWeight sets up a container's leader/resource balance weight.

func (*RaftCluster) SetStorage

func (c *RaftCluster) SetStorage(s storage.Storage)

SetStorage set the storage for test purpose.

func (*RaftCluster) Start

func (c *RaftCluster) Start(s Server) error

Start starts a cluster.

func (*RaftCluster) Stop

func (c *RaftCluster) Stop()

Stop stops the cluster.

func (*RaftCluster) UpContainer

func (c *RaftCluster) UpContainer(containerID uint64) error

UpContainer up a store from offline

func (*RaftCluster) UpdateContainerLabels

func (c *RaftCluster) UpdateContainerLabels(containerID uint64, labels []metapb.Pair, force bool) error

UpdateContainerLabels updates a container's location labels If 'force' is true, then update the container's labels forcibly.

func (*RaftCluster) ValidRequestResource

func (c *RaftCluster) ValidRequestResource(reqResource metadata.Resource) error

ValidRequestResource is used to decide if the resource is valid.

type Server

type Server interface {
	GetConfig() *config.Config
	GetPersistOptions() *config.PersistOptions
	GetStorage() storage.Storage
	GetHBStreams() *hbstream.HeartbeatStreams
	GetRaftCluster() *RaftCluster
	GetBasicCluster() *core.BasicCluster
}

Server is the interface for cluster.

type StatEntries

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

StatEntries saves the StatEntries for each container in the cluster

func NewStatEntries

func NewStatEntries(size int) *StatEntries

NewStatEntries returns a statistics object for the cluster

func (*StatEntries) Append

func (cst *StatEntries) Append(stat *StatEntry) bool

Append an container StatEntry

func (*StatEntries) CPU

func (cst *StatEntries) CPU(excludes ...uint64) float64

CPU returns the cpu usage of the cluster

type StatEntry

type StatEntry metapb.ContainerStats

StatEntry is an entry of container statistics

type State

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

State collects information from container heartbeat and calculates the load state of the cluster

func NewState

func NewState() *State

NewState return the LoadState object which collects information from container heartbeats and gives the current state of the cluster

func (*State) Collect

func (cs *State) Collect(stat *StatEntry)

Collect statistics from container heartbeat

func (*State) State

func (cs *State) State(excludes ...uint64) LoadState

State returns the state of the cluster, excludes is the list of container ID to be excluded

Jump to

Keyboard shortcuts

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