Documentation ¶
Overview ¶
Package server implements a server to handle grpc requests to the storage engine and raft engine.
Index ¶
- Variables
- type Server
- func (s *Server) AppendEntries(ctx context.Context, req *pb.AppendEntriesReq) (*pb.AppendEntriesResp, error)
- func (s *Server) Del(ctx context.Context, req *pb.DelReq) (*pb.DelResp, error)
- func (s *Server) Get(ctx context.Context, req *pb.GetReq) (*pb.GetResp, error)
- func (s *Server) Put(ctx context.Context, req *pb.PutReq) (*pb.PutResp, error)
- func (s *Server) RequestVote(ctx context.Context, req *pb.RequestVoteReq) (*pb.RequestVoteResp, error)
- func (s *Server) Serve(storageAddr string, raftAddr string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotReady error = errors.New("Serve not ready") ErrCanceled error = errors.New("Request canceled by client") ErrInternal error = errors.New("Internal server error (please see server's logs for more details)") ErrLeaderNotFound error = errors.New("Leader not found (please try again)") )
Errors returned by grpc servers.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves grpc requests coming from storage and raft clients.
func New ¶
func New(level int, rootdir string, flushThresh store.KVLen, blockSize store.KVLen) (*Server, error)
New creates a Server with given logging level and storage engine configurations.
func (*Server) AppendEntries ¶
func (s *Server) AppendEntries(ctx context.Context, req *pb.AppendEntriesReq) (*pb.AppendEntriesResp, error)
AppendEntries invoked by raft leader to replicate log entries, also used as heartbeat.
func (*Server) RequestVote ¶
func (s *Server) RequestVote(ctx context.Context, req *pb.RequestVoteReq) (*pb.RequestVoteResp, error)
RequestVote invoked by raft candidates to gather votes.
Click to show internal directories.
Click to hide internal directories.