Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrClosed error of client closed ErrClosed = errors.New("client is closed") // ErrTimeout timeout ErrTimeout = errors.New("rpc timeout") )
Functions ¶
Types ¶
type Client ¶
type Client interface { Close() error AllocID() (uint64, error) CreateDestroying(id uint64, index uint64, removeData bool, replicas []uint64) (metapb.ResourceState, error) ReportDestroyed(id uint64, replicaID uint64) (metapb.ResourceState, error) GetDestroying(id uint64) (*metapb.DestroyingStatus, error) PutContainer(container metadata.Container) error GetContainer(containerID uint64) (metadata.Container, error) ResourceHeartbeat(meta metadata.Resource, hb rpcpb.ResourceHeartbeatReq) error ContainerHeartbeat(hb rpcpb.ContainerHeartbeatReq) (rpcpb.ContainerHeartbeatRsp, error) AskBatchSplit(res metadata.Resource, count uint32) ([]rpcpb.SplitID, error) NewWatcher(flag uint32) (Watcher, error) GetResourceHeartbeatRspNotifier() (chan rpcpb.ResourceHeartbeatRsp, error) // AsyncAddResources add resources asynchronously. The operation add new resources meta on the // prophet leader cache and embed etcd. And porphet leader has a background goroutine to notify // all related containers to create resource replica peer at local. AsyncAddResources(resources ...metadata.Resource) error // AsyncAddResourcesWithLeastPeers same of `AsyncAddResources`, but if the number of peers successfully // allocated exceed the `leastPeers`, no error will be returned. AsyncAddResourcesWithLeastPeers(resources []metadata.Resource, leastPeers []int) error // AsyncRemoveResources remove resource asynchronously. The operation only update the resource state // on the prophet leader cache and embed etcd. The resource actual destroy triggered in three ways as below: // a) Each cube node starts a backgroud goroutine to check all the resources state, and resource will // destroyed if encounter removed state. // b) Resource heartbeat received a DestroyDirectly schedule command. // c) If received a resource removed event. AsyncRemoveResources(ids ...uint64) error // CheckResourceState returns resources state CheckResourceState(resources *roaring64.Bitmap) (rpcpb.CheckResourceStateRsp, error) // PutPlacementRule put placement rule PutPlacementRule(rule rpcpb.PlacementRule) error // GetAppliedRules returns applied rules of the resource GetAppliedRules(id uint64) ([]rpcpb.PlacementRule, error) // AddSchedulingRule Add scheduling rules, scheduling rules are effective for all schedulers. // The scheduling rules are based on the Label of the Resource to group all resources and do // scheduling independently for these grouped resources.`ruleName` is unique within the group. AddSchedulingRule(group uint64, ruleName string, groupByLabel string) error // GetSchedulingRules get all schedule group rules GetSchedulingRules() ([]metapb.ScheduleGroupRule, error) // CreateJob create job CreateJob(metapb.Job) error // RemoveJob remove job RemoveJob(metapb.Job) error // ExecuteJob execute on job and returns the execute result ExecuteJob(metapb.Job, []byte) ([]byte, error) }
Client prophet client
type Option ¶
type Option func(*options)
Option client option
func WithLeaderGetter ¶
WithLeaderGetter set a func to get a leader
func WithRPCTimeout ¶
WithRPCTimeout set rpc timeout
type Prophet ¶
type Prophet interface { // Start start the prophet instance, this will start the lead election, heartbeat loop and listen requests Start() // Stop stop the prophet instance Stop() // GetStorage returns the storage GetStorage() storage.Storage // GetClient returns the prophet client GetClient() Client // GetLeader returns leader GetLeader() *metapb.Member // GetMember returns self GetMember() *member.Member // GetConfig returns cfg GetConfig() *pconfig.Config // GetClusterID return cluster id GetClusterID() uint64 // GetBasicCluster returns basic cluster GetBasicCluster() *core.BasicCluster }
Prophet is the distributed scheduler and coordinator
type Watcher ¶
type Watcher interface { // GetNotify returns event notify channel GetNotify() chan rpcpb.EventNotify // Close close watcher Close() }
Watcher watcher
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mockclient
Package mockclient is a generated GoMock package.
|
Package mockclient is a generated GoMock package. |
mockjob
Package mockjob is a generated GoMock package.
|
Package mockjob is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.