Documentation ¶
Index ¶
- Variables
- func RegisterRaftServer(s *grpc.Server, srv RaftServer)
- type AppendEntriesRequest
- func (*AppendEntriesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AppendEntriesRequest) GetEntries() []*Entry
- func (x *AppendEntriesRequest) GetLeaderCommit() int64
- func (x *AppendEntriesRequest) GetLeaderId() uint64
- func (x *AppendEntriesRequest) GetPrevLogIndex() int64
- func (x *AppendEntriesRequest) GetPrevLogTerm() uint64
- func (x *AppendEntriesRequest) GetTerm() uint64
- func (*AppendEntriesRequest) ProtoMessage()
- func (x *AppendEntriesRequest) ProtoReflect() protoreflect.Message
- func (x *AppendEntriesRequest) Reset()
- func (x *AppendEntriesRequest) String() string
- type AppendEntriesResponse
- func (*AppendEntriesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AppendEntriesResponse) GetId() uint64
- func (x *AppendEntriesResponse) GetSuccess() bool
- func (x *AppendEntriesResponse) GetTerm() uint64
- func (*AppendEntriesResponse) ProtoMessage()
- func (x *AppendEntriesResponse) ProtoReflect() protoreflect.Message
- func (x *AppendEntriesResponse) Reset()
- func (x *AppendEntriesResponse) String() string
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)deprecated
- func (x *Entry) GetData() []byte
- func (x *Entry) GetIndex() int64
- func (x *Entry) GetTerm() uint64
- func (x *Entry) GetType() []byte
- func (*Entry) ProtoMessage()
- func (x *Entry) ProtoReflect() protoreflect.Message
- func (x *Entry) Reset()
- func (x *Entry) String() string
- type RaftClient
- type RaftServer
- type UnimplementedRaftServer
- type VoteRequest
- func (*VoteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *VoteRequest) GetCandidateId() uint64
- func (x *VoteRequest) GetLastLogIndex() int64
- func (x *VoteRequest) GetLastLogTerm() uint64
- func (x *VoteRequest) GetTerm() uint64
- func (*VoteRequest) ProtoMessage()
- func (x *VoteRequest) ProtoReflect() protoreflect.Message
- func (x *VoteRequest) Reset()
- func (x *VoteRequest) String() string
- type VoteResponse
- func (*VoteResponse) Descriptor() ([]byte, []int)deprecated
- func (x *VoteResponse) GetTerm() uint64
- func (x *VoteResponse) GetVoteGranted() bool
- func (*VoteResponse) ProtoMessage()
- func (x *VoteResponse) ProtoReflect() protoreflect.Message
- func (x *VoteResponse) Reset()
- func (x *VoteResponse) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var File_raft_proto protoreflect.FileDescriptor
Functions ¶
func RegisterRaftServer ¶
func RegisterRaftServer(s *grpc.Server, srv RaftServer)
Types ¶
type AppendEntriesRequest ¶
type AppendEntriesRequest struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` LeaderId uint64 `protobuf:"varint,2,opt,name=leaderId,proto3" json:"leaderId,omitempty"` PrevLogIndex int64 `protobuf:"varint,3,opt,name=prevLogIndex,proto3" json:"prevLogIndex,omitempty"` PrevLogTerm uint64 `protobuf:"varint,4,opt,name=prevLogTerm,proto3" json:"prevLogTerm,omitempty"` LeaderCommit int64 `protobuf:"varint,6,opt,name=leaderCommit,proto3" json:"leaderCommit,omitempty"` Entries []*Entry `protobuf:"bytes,5,rep,name=entries,proto3" json:"entries,omitempty"` // contains filtered or unexported fields }
func (*AppendEntriesRequest) Descriptor
deprecated
func (*AppendEntriesRequest) Descriptor() ([]byte, []int)
Deprecated: Use AppendEntriesRequest.ProtoReflect.Descriptor instead.
func (*AppendEntriesRequest) GetEntries ¶
func (x *AppendEntriesRequest) GetEntries() []*Entry
func (*AppendEntriesRequest) GetLeaderCommit ¶
func (x *AppendEntriesRequest) GetLeaderCommit() int64
func (*AppendEntriesRequest) GetLeaderId ¶
func (x *AppendEntriesRequest) GetLeaderId() uint64
func (*AppendEntriesRequest) GetPrevLogIndex ¶
func (x *AppendEntriesRequest) GetPrevLogIndex() int64
func (*AppendEntriesRequest) GetPrevLogTerm ¶
func (x *AppendEntriesRequest) GetPrevLogTerm() uint64
func (*AppendEntriesRequest) GetTerm ¶
func (x *AppendEntriesRequest) GetTerm() uint64
func (*AppendEntriesRequest) ProtoMessage ¶
func (*AppendEntriesRequest) ProtoMessage()
func (*AppendEntriesRequest) ProtoReflect ¶
func (x *AppendEntriesRequest) ProtoReflect() protoreflect.Message
func (*AppendEntriesRequest) Reset ¶
func (x *AppendEntriesRequest) Reset()
func (*AppendEntriesRequest) String ¶
func (x *AppendEntriesRequest) String() string
type AppendEntriesResponse ¶
type AppendEntriesResponse struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*AppendEntriesResponse) Descriptor
deprecated
func (*AppendEntriesResponse) Descriptor() ([]byte, []int)
Deprecated: Use AppendEntriesResponse.ProtoReflect.Descriptor instead.
func (*AppendEntriesResponse) GetId ¶
func (x *AppendEntriesResponse) GetId() uint64
func (*AppendEntriesResponse) GetSuccess ¶
func (x *AppendEntriesResponse) GetSuccess() bool
func (*AppendEntriesResponse) GetTerm ¶
func (x *AppendEntriesResponse) GetTerm() uint64
func (*AppendEntriesResponse) ProtoMessage ¶
func (*AppendEntriesResponse) ProtoMessage()
func (*AppendEntriesResponse) ProtoReflect ¶
func (x *AppendEntriesResponse) ProtoReflect() protoreflect.Message
func (*AppendEntriesResponse) Reset ¶
func (x *AppendEntriesResponse) Reset()
func (*AppendEntriesResponse) String ¶
func (x *AppendEntriesResponse) String() string
type Entry ¶
type Entry struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` Type []byte `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // contains filtered or unexported fields }
func (*Entry) Descriptor
deprecated
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) ProtoReflect ¶
func (x *Entry) ProtoReflect() protoreflect.Message
type RaftClient ¶
type RaftClient interface { RequestVote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteResponse, error) AppendEntry(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error) }
RaftClient is the client API for Raft service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewRaftClient ¶
func NewRaftClient(cc grpc.ClientConnInterface) RaftClient
type RaftServer ¶
type RaftServer interface { RequestVote(context.Context, *VoteRequest) (*VoteResponse, error) AppendEntry(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error) }
RaftServer is the server API for Raft service.
type UnimplementedRaftServer ¶
type UnimplementedRaftServer struct { }
UnimplementedRaftServer can be embedded to have forward compatible implementations.
func (*UnimplementedRaftServer) AppendEntry ¶
func (*UnimplementedRaftServer) AppendEntry(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error)
func (*UnimplementedRaftServer) RequestVote ¶
func (*UnimplementedRaftServer) RequestVote(context.Context, *VoteRequest) (*VoteResponse, error)
type VoteRequest ¶
type VoteRequest struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` CandidateId uint64 `protobuf:"varint,2,opt,name=candidateId,proto3" json:"candidateId,omitempty"` LastLogIndex int64 `protobuf:"varint,3,opt,name=lastLogIndex,proto3" json:"lastLogIndex,omitempty"` LastLogTerm uint64 `protobuf:"varint,4,opt,name=lastLogTerm,proto3" json:"lastLogTerm,omitempty"` // contains filtered or unexported fields }
func (*VoteRequest) Descriptor
deprecated
func (*VoteRequest) Descriptor() ([]byte, []int)
Deprecated: Use VoteRequest.ProtoReflect.Descriptor instead.
func (*VoteRequest) GetCandidateId ¶
func (x *VoteRequest) GetCandidateId() uint64
func (*VoteRequest) GetLastLogIndex ¶
func (x *VoteRequest) GetLastLogIndex() int64
func (*VoteRequest) GetLastLogTerm ¶
func (x *VoteRequest) GetLastLogTerm() uint64
func (*VoteRequest) GetTerm ¶
func (x *VoteRequest) GetTerm() uint64
func (*VoteRequest) ProtoMessage ¶
func (*VoteRequest) ProtoMessage()
func (*VoteRequest) ProtoReflect ¶
func (x *VoteRequest) ProtoReflect() protoreflect.Message
func (*VoteRequest) Reset ¶
func (x *VoteRequest) Reset()
func (*VoteRequest) String ¶
func (x *VoteRequest) String() string
type VoteResponse ¶
type VoteResponse struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` VoteGranted bool `protobuf:"varint,2,opt,name=voteGranted,proto3" json:"voteGranted,omitempty"` // contains filtered or unexported fields }
func (*VoteResponse) Descriptor
deprecated
func (*VoteResponse) Descriptor() ([]byte, []int)
Deprecated: Use VoteResponse.ProtoReflect.Descriptor instead.
func (*VoteResponse) GetTerm ¶
func (x *VoteResponse) GetTerm() uint64
func (*VoteResponse) GetVoteGranted ¶
func (x *VoteResponse) GetVoteGranted() bool
func (*VoteResponse) ProtoMessage ¶
func (*VoteResponse) ProtoMessage()
func (*VoteResponse) ProtoReflect ¶
func (x *VoteResponse) ProtoReflect() protoreflect.Message
func (*VoteResponse) Reset ¶
func (x *VoteResponse) Reset()
func (*VoteResponse) String ¶
func (x *VoteResponse) String() string
Click to show internal directories.
Click to hide internal directories.