Documentation
¶
Index ¶
- func NewRPCResolver(isLocalHost bool, rpcPort int) rpcAddressResolver
- type Client
- func (cl *Client) Apply(leaderAddr string, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)
- func (cl *Client) Close() error
- func (cl *Client) Join(ctx context.Context, leaderAddress string, req *cmd.JoinPeerRequest) (*cmd.JoinPeerResponse, error)
- func (cl *Client) Notify(ctx context.Context, rAddr string, req *cmd.NotifyPeerRequest) (*cmd.NotifyPeerResponse, error)
- func (cl *Client) Query(ctx context.Context, leaderAddress string, req *cmd.QueryRequest) (*cmd.QueryResponse, error)
- func (cl *Client) Remove(ctx context.Context, leaderAddress string, req *cmd.RemovePeerRequest) (*cmd.RemovePeerResponse, error)
- type Service
- func (s *Service) Apply(_ context.Context, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)
- func (s *Service) Close()
- func (s *Service) JoinPeer(_ context.Context, req *cmd.JoinPeerRequest) (*cmd.JoinPeerResponse, error)
- func (s *Service) Leader() string
- func (s *Service) NotifyPeer(_ context.Context, req *cmd.NotifyPeerRequest) (*cmd.NotifyPeerResponse, error)
- func (s *Service) Open() error
- func (s *Service) Query(ctx context.Context, req *cmd.QueryRequest) (*cmd.QueryResponse, error)
- func (s *Service) RemovePeer(_ context.Context, req *cmd.RemovePeerRequest) (*cmd.RemovePeerResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRPCResolver ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for communication with remote nodes in a RAFT cluster.
func (*Client) Apply ¶
func (cl *Client) Apply(leaderAddr string, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)
func (*Client) Join ¶
func (cl *Client) Join(ctx context.Context, leaderAddress string, req *cmd.JoinPeerRequest) (*cmd.JoinPeerResponse, error)
Join joins this node to an existing cluster identified by its leader's address. If a new leader has been elected, the request is redirected to the new leader.
func (*Client) Notify ¶
func (cl *Client) Notify(ctx context.Context, rAddr string, req *cmd.NotifyPeerRequest) (*cmd.NotifyPeerResponse, error)
Notify informs a remote node rAddr of this node's readiness to join.
func (*Client) Query ¶
func (cl *Client) Query(ctx context.Context, leaderAddress string, req *cmd.QueryRequest) (*cmd.QueryResponse, error)
func (*Client) Remove ¶
func (cl *Client) Remove(ctx context.Context, leaderAddress string, req *cmd.RemovePeerRequest) (*cmd.RemovePeerResponse, error)
Remove removes this node from an existing cluster identified by its leader's address. If a new leader has been elected, the request is redirected to the new leader.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Apply ¶
func (s *Service) Apply(_ context.Context, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)
func (*Service) JoinPeer ¶
func (s *Service) JoinPeer(_ context.Context, req *cmd.JoinPeerRequest) (*cmd.JoinPeerResponse, error)
func (*Service) NotifyPeer ¶
func (s *Service) NotifyPeer(_ context.Context, req *cmd.NotifyPeerRequest) (*cmd.NotifyPeerResponse, error)
func (*Service) Query ¶
func (s *Service) Query(ctx context.Context, req *cmd.QueryRequest) (*cmd.QueryResponse, error)
func (*Service) RemovePeer ¶
func (s *Service) RemovePeer(_ context.Context, req *cmd.RemovePeerRequest) (*cmd.RemovePeerResponse, error)
Click to show internal directories.
Click to hide internal directories.