transport

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPCResolver

func NewRPCResolver(isLocalHost bool, rpcPort int) rpcAddressResolver

Types

type Client

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

Client is used for communication with remote nodes in a RAFT cluster.

func NewClient

func NewClient(r rpcAddressResolver, rpcMessageMaxSize int) *Client

func (*Client) Apply

func (cl *Client) Apply(leaderAddr string, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)

func (*Client) Close

func (cl *Client) Close() 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 New

func New(ms members, ex executor, address string, l *logrus.Logger, grpcMessageMaxSize int) *Service

func (*Service) Apply

func (s *Service) Apply(_ context.Context, req *cmd.ApplyRequest) (*cmd.ApplyResponse, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) JoinPeer

func (*Service) Leader

func (s *Service) Leader() string

func (*Service) NotifyPeer

func (*Service) Open

func (s *Service) Open() error

func (*Service) Query

func (s *Service) Query(ctx context.Context, req *cmd.QueryRequest) (*cmd.QueryResponse, error)

func (*Service) RemovePeer

Jump to

Keyboard shortcuts

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