Documentation ¶
Overview ¶
Package rpc is a generated protocol buffer package.
It is generated from these files:
goraft.proto
It has these top-level messages:
AppendEntriesRequest AppendEntriesResponse RequestVoteRequest RequestVoteResponse
Index ¶
- func RegisterGoRaftServer(s *grpc.Server, srv GoRaftServer)
- func RunServer(port string)
- type AppendEntriesRequest
- func (*AppendEntriesRequest) Descriptor() ([]byte, []int)
- func (m *AppendEntriesRequest) GetEntries() []*AppendEntriesRequest_Entry
- func (m *AppendEntriesRequest) GetLeaderCommit() uint32
- func (m *AppendEntriesRequest) GetLeaderId() string
- func (m *AppendEntriesRequest) GetPrevLogIndex() uint32
- func (m *AppendEntriesRequest) GetPrevLogTerm() uint32
- func (m *AppendEntriesRequest) GetTerm() uint32
- func (*AppendEntriesRequest) ProtoMessage()
- func (m *AppendEntriesRequest) Reset()
- func (m *AppendEntriesRequest) String() string
- type AppendEntriesRequest_Entry
- func (*AppendEntriesRequest_Entry) Descriptor() ([]byte, []int)
- func (m *AppendEntriesRequest_Entry) GetKey() string
- func (m *AppendEntriesRequest_Entry) GetValue() string
- func (*AppendEntriesRequest_Entry) ProtoMessage()
- func (m *AppendEntriesRequest_Entry) Reset()
- func (m *AppendEntriesRequest_Entry) String() string
- type AppendEntriesResponse
- type GoRaftClient
- type GoRaftServer
- type RequestVoteRequest
- func (*RequestVoteRequest) Descriptor() ([]byte, []int)
- func (m *RequestVoteRequest) GetCandidateId() string
- func (m *RequestVoteRequest) GetLastLogIndex() uint32
- func (m *RequestVoteRequest) GetLastLogTerm() uint32
- func (m *RequestVoteRequest) GetTerm() uint32
- func (*RequestVoteRequest) ProtoMessage()
- func (m *RequestVoteRequest) Reset()
- func (m *RequestVoteRequest) String() string
- type RequestVoteResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGoRaftServer ¶
func RegisterGoRaftServer(s *grpc.Server, srv GoRaftServer)
Types ¶
type AppendEntriesRequest ¶
type AppendEntriesRequest struct { Term uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` LeaderId string `protobuf:"bytes,2,opt,name=leaderId" json:"leaderId,omitempty"` PrevLogIndex uint32 `protobuf:"varint,3,opt,name=prevLogIndex" json:"prevLogIndex,omitempty"` PrevLogTerm uint32 `protobuf:"varint,4,opt,name=prevLogTerm" json:"prevLogTerm,omitempty"` Entries []*AppendEntriesRequest_Entry `protobuf:"bytes,5,rep,name=entries" json:"entries,omitempty"` LeaderCommit uint32 `protobuf:"varint,6,opt,name=leaderCommit" json:"leaderCommit,omitempty"` }
func (*AppendEntriesRequest) Descriptor ¶
func (*AppendEntriesRequest) Descriptor() ([]byte, []int)
func (*AppendEntriesRequest) GetEntries ¶
func (m *AppendEntriesRequest) GetEntries() []*AppendEntriesRequest_Entry
func (*AppendEntriesRequest) GetLeaderCommit ¶
func (m *AppendEntriesRequest) GetLeaderCommit() uint32
func (*AppendEntriesRequest) GetLeaderId ¶
func (m *AppendEntriesRequest) GetLeaderId() string
func (*AppendEntriesRequest) GetPrevLogIndex ¶
func (m *AppendEntriesRequest) GetPrevLogIndex() uint32
func (*AppendEntriesRequest) GetPrevLogTerm ¶
func (m *AppendEntriesRequest) GetPrevLogTerm() uint32
func (*AppendEntriesRequest) GetTerm ¶
func (m *AppendEntriesRequest) GetTerm() uint32
func (*AppendEntriesRequest) ProtoMessage ¶
func (*AppendEntriesRequest) ProtoMessage()
func (*AppendEntriesRequest) Reset ¶
func (m *AppendEntriesRequest) Reset()
func (*AppendEntriesRequest) String ¶
func (m *AppendEntriesRequest) String() string
type AppendEntriesRequest_Entry ¶
type AppendEntriesRequest_Entry struct { Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` }
func (*AppendEntriesRequest_Entry) Descriptor ¶
func (*AppendEntriesRequest_Entry) Descriptor() ([]byte, []int)
func (*AppendEntriesRequest_Entry) GetKey ¶
func (m *AppendEntriesRequest_Entry) GetKey() string
func (*AppendEntriesRequest_Entry) GetValue ¶
func (m *AppendEntriesRequest_Entry) GetValue() string
func (*AppendEntriesRequest_Entry) ProtoMessage ¶
func (*AppendEntriesRequest_Entry) ProtoMessage()
func (*AppendEntriesRequest_Entry) Reset ¶
func (m *AppendEntriesRequest_Entry) Reset()
func (*AppendEntriesRequest_Entry) String ¶
func (m *AppendEntriesRequest_Entry) String() string
type AppendEntriesResponse ¶
type AppendEntriesResponse struct { Term uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` Success bool `protobuf:"varint,2,opt,name=success" json:"success,omitempty"` }
func SendAppendEntries ¶
func SendAppendEntries(address string, request *AppendEntriesRequest) (*AppendEntriesResponse, error)
SendAppendEntries sends an AppendEntries request to the specified address.
func (*AppendEntriesResponse) Descriptor ¶
func (*AppendEntriesResponse) Descriptor() ([]byte, []int)
func (*AppendEntriesResponse) GetSuccess ¶
func (m *AppendEntriesResponse) GetSuccess() bool
func (*AppendEntriesResponse) GetTerm ¶
func (m *AppendEntriesResponse) GetTerm() uint32
func (*AppendEntriesResponse) ProtoMessage ¶
func (*AppendEntriesResponse) ProtoMessage()
func (*AppendEntriesResponse) Reset ¶
func (m *AppendEntriesResponse) Reset()
func (*AppendEntriesResponse) String ¶
func (m *AppendEntriesResponse) String() string
type GoRaftClient ¶
type GoRaftClient interface { AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error) RequestVote(ctx context.Context, in *RequestVoteRequest, opts ...grpc.CallOption) (*RequestVoteResponse, error) }
func NewGoRaftClient ¶
func NewGoRaftClient(cc *grpc.ClientConn) GoRaftClient
type GoRaftServer ¶
type GoRaftServer interface { AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error) RequestVote(context.Context, *RequestVoteRequest) (*RequestVoteResponse, error) }
type RequestVoteRequest ¶
type RequestVoteRequest struct { Term uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` CandidateId string `protobuf:"bytes,2,opt,name=candidateId" json:"candidateId,omitempty"` LastLogIndex uint32 `protobuf:"varint,3,opt,name=lastLogIndex" json:"lastLogIndex,omitempty"` LastLogTerm uint32 `protobuf:"varint,4,opt,name=lastLogTerm" json:"lastLogTerm,omitempty"` }
func (*RequestVoteRequest) Descriptor ¶
func (*RequestVoteRequest) Descriptor() ([]byte, []int)
func (*RequestVoteRequest) GetCandidateId ¶
func (m *RequestVoteRequest) GetCandidateId() string
func (*RequestVoteRequest) GetLastLogIndex ¶
func (m *RequestVoteRequest) GetLastLogIndex() uint32
func (*RequestVoteRequest) GetLastLogTerm ¶
func (m *RequestVoteRequest) GetLastLogTerm() uint32
func (*RequestVoteRequest) GetTerm ¶
func (m *RequestVoteRequest) GetTerm() uint32
func (*RequestVoteRequest) ProtoMessage ¶
func (*RequestVoteRequest) ProtoMessage()
func (*RequestVoteRequest) Reset ¶
func (m *RequestVoteRequest) Reset()
func (*RequestVoteRequest) String ¶
func (m *RequestVoteRequest) String() string
type RequestVoteResponse ¶
type RequestVoteResponse struct { Term uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` VoteGranted bool `protobuf:"varint,2,opt,name=voteGranted" json:"voteGranted,omitempty"` }
func SendRequestVote ¶
func SendRequestVote(address string, request *RequestVoteRequest) (*RequestVoteResponse, error)
SendRequestVote sends a RequestVote request to the specified address.
func (*RequestVoteResponse) Descriptor ¶
func (*RequestVoteResponse) Descriptor() ([]byte, []int)
func (*RequestVoteResponse) GetTerm ¶
func (m *RequestVoteResponse) GetTerm() uint32
func (*RequestVoteResponse) GetVoteGranted ¶
func (m *RequestVoteResponse) GetVoteGranted() bool
func (*RequestVoteResponse) ProtoMessage ¶
func (*RequestVoteResponse) ProtoMessage()
func (*RequestVoteResponse) Reset ¶
func (m *RequestVoteResponse) Reset()
func (*RequestVoteResponse) String ¶
func (m *RequestVoteResponse) String() string
Click to show internal directories.
Click to hide internal directories.