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)
GetContainer(containerID uint64) (metadata.Container, error)
ResourceHeartbeat(meta metadata.Resource, hb rpcpb.ResourceHeartbeatReq) error
ContainerHeartbeat(hb rpcpb.ContainerHeartbeatReq) (rpcpb.ContainerHeartbeatRsp, error)
AskSplit(res metadata.Resource) (rpcpb.SplitID, error)
ReportSplit(left, right metadata.Resource) error
AskBatchSplit(res metadata.Resource, count uint32) ([]rpcpb.SplitID, error)
ReportBatchSplit(results ...metadata.Resource) error
NewWatcher(flag uint32) (Watcher, error)
GetResourceHeartbeatRspNotifier() (chan rpcpb.ResourceHeartbeatRsp, 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() *config.Config
// GetClusterID return cluster id
GetClusterID() uint64
}
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
¶
Click to show internal directories.
Click to hide internal directories.