Documentation ¶
Index ¶
- Variables
- func NewRaftGRPC(nhConfig config.NodeHostConfig, requestHandler raftio.RequestHandler, ...) raftio.IRaftRPC
- type GRPCConnection
- type GRPCSnapshotConnection
- type RaftGRPC
- func (g *RaftGRPC) GetConnection(ctx context.Context, target string) (raftio.IConnection, error)
- func (g *RaftGRPC) GetSnapshotConnection(ctx context.Context, target string) (raftio.ISnapshotConnection, error)
- func (g *RaftGRPC) Name() string
- func (g *RaftGRPC) RaftMessage(stream pb.Transport_RaftMessageServer) error
- func (g *RaftGRPC) RaftSnapshot(stream pb.Transport_RaftSnapshotServer) error
- func (g *RaftGRPC) Start() error
- func (g *RaftGRPC) Stop()
Constants ¶
This section is empty.
Variables ¶
var (
// GRPCRaftRPCName is the type name of the grpc raft RPC module.
GRPCRaftRPCName = "grpc-transport"
)
Functions ¶
func NewRaftGRPC ¶
func NewRaftGRPC(nhConfig config.NodeHostConfig, requestHandler raftio.RequestHandler, sinkFactory raftio.ChunkSinkFactory) raftio.IRaftRPC
NewRaftGRPC creates the GRPC based raft RPC instance.
Types ¶
type GRPCConnection ¶
type GRPCConnection struct {
// contains filtered or unexported fields
}
GRPCConnection is the GRPC based client for sending raft messages.
func NewGRPCConnection ¶
func NewGRPCConnection(ctx context.Context, conn *grpc.ClientConn) (*GRPCConnection, error)
NewGRPCConnection create a GRPCConnection instance.
func (*GRPCConnection) Close ¶
func (c *GRPCConnection) Close()
Close closes the GRPCConnection instance.
func (*GRPCConnection) SendMessageBatch ¶
func (c *GRPCConnection) SendMessageBatch(batch raftpb.MessageBatch) error
SendMessageBatch sends the specified message batch.
type GRPCSnapshotConnection ¶
type GRPCSnapshotConnection struct {
// contains filtered or unexported fields
}
GRPCSnapshotConnection is the GRPC based ISnapshotConnection instance for sending snapshot data.
func NewGRPCSnapshotConnection ¶
func NewGRPCSnapshotConnection(ctx context.Context, conn *grpc.ClientConn) (*GRPCSnapshotConnection, error)
NewGRPCSnapshotConnection creates a GRPCSnapshotConnection intance.
func (*GRPCSnapshotConnection) Close ¶
func (c *GRPCSnapshotConnection) Close()
Close closes the GRPCSnapshotConnection instance.
func (*GRPCSnapshotConnection) SendSnapshotChunk ¶
func (c *GRPCSnapshotConnection) SendSnapshotChunk(chunk raftpb.SnapshotChunk) error
SendSnapshotChunk sends the specified snapshot chunk.
type RaftGRPC ¶
type RaftGRPC struct {
// contains filtered or unexported fields
}
RaftGRPC is the GRPC based RPC moldule.
func (*RaftGRPC) GetConnection ¶
GetConnection gets the IConnection instance used for sending raft messages.
func (*RaftGRPC) GetSnapshotConnection ¶
func (g *RaftGRPC) GetSnapshotConnection(ctx context.Context, target string) (raftio.ISnapshotConnection, error)
GetSnapshotConnection gets the ISnapshotConnection instance used for sending raft snapshot chunks.
func (*RaftGRPC) RaftMessage ¶
func (g *RaftGRPC) RaftMessage(stream pb.Transport_RaftMessageServer) error
RaftMessage is the gRPC server side service method.
func (*RaftGRPC) RaftSnapshot ¶
func (g *RaftGRPC) RaftSnapshot(stream pb.Transport_RaftSnapshotServer) error
RaftSnapshot is the gRPC server side service method.