Documentation ¶
Index ¶
- Constants
- Variables
- func PrepareAcquireJobCommand(jobKeys []string, peerID string) []byte
- func PrepareAddPeerCommand(peerID string) []byte
- func PrepareDeleteJobCommand(key string) []byte
- func PrepareInsertJobCommand(jobType string, data []byte) []byte
- func PrepareJobExecutedCommand(jobKey, err string, executedTime time.Time) []byte
- func PrepareRemovePeerCommand(peerID string) []byte
- type AcquireJob
- type AddPeer
- type ApplyLogResponse
- type Client
- func (client *Client) IsLeader() bool
- func (client *Client) Leader() string
- func (client *Client) LeaderCh() <-chan bool
- func (client *Client) LocalID() string
- func (client *Client) Servers() ([]string, error)
- func (client *Client) Shutdown() error
- func (client *Client) SyncApply(command []byte) (*ApplyLogResponse, error)
- func (client *Client) SyncApplyHelper(command []byte, commandName string) (interface{}, error)
- func (client *Client) SyncApplyOnLeader(command []byte) (*ApplyLogResponse, error)
- type DeleteJob
- type InsertJob
- type JobExecuted
- type RemovePeer
- type SocketLeaderClient
Constants ¶
View Source
const ( ApplyCommandEvent = "CONFIG_CLUSTER:APPLY_COMMAND" WebsocketURLPath = "/gds/" PeerIDGetParam = "peer_id" )
View Source
const ( AddPeerCommand RemovePeerCommand InsertJobCommand DeleteJobCommand AcquireJobCommand JobExecutedCommand )
Variables ¶
Functions ¶
func PrepareAddPeerCommand ¶
func PrepareDeleteJobCommand ¶
func PrepareInsertJobCommand ¶
Types ¶
type AcquireJob ¶
type ApplyLogResponse ¶
type ApplyLogResponse struct { ApplyError string Result json2.RawMessage }
func (ApplyLogResponse) Error ¶
func (a ApplyLogResponse) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewRaftClusterClient ¶
func (*Client) SyncApply ¶
func (client *Client) SyncApply(command []byte) (*ApplyLogResponse, error)
func (*Client) SyncApplyHelper ¶
func (*Client) SyncApplyOnLeader ¶
func (client *Client) SyncApplyOnLeader(command []byte) (*ApplyLogResponse, error)
type InsertJob ¶
type InsertJob struct { Job json2.RawMessage Type string }
type RemovePeer ¶
type RemovePeer struct {
PeerID string
}
type SocketLeaderClient ¶
type SocketLeaderClient struct {
// contains filtered or unexported fields
}
func NewSocketLeaderClient ¶
func NewSocketLeaderClient(leaderAddr, localID string) *SocketLeaderClient
func (*SocketLeaderClient) Close ¶
func (c *SocketLeaderClient) Close()
Click to show internal directories.
Click to hide internal directories.