Documentation ¶
Index ¶
- Variables
- func RegisterRaftServer(s grpc.ServiceRegistrar, srv RaftServer)
- type AppendReply
- func (*AppendReply) Descriptor() ([]byte, []int)deprecated
- func (x *AppendReply) GetCommitIndex() uint64
- func (x *AppendReply) GetIndex() uint64
- func (x *AppendReply) GetRemote() string
- func (x *AppendReply) GetSuccess() bool
- func (x *AppendReply) GetTerm() uint64
- func (*AppendReply) ProtoMessage()
- func (x *AppendReply) ProtoReflect() protoreflect.Message
- func (x *AppendReply) Reset()
- func (x *AppendReply) String() string
- type AppendRequest
- func (*AppendRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AppendRequest) GetEntries() []*LogEntry
- func (x *AppendRequest) GetLeader() string
- func (x *AppendRequest) GetLeaderCommit() uint64
- func (x *AppendRequest) GetPrevLogIndex() uint64
- func (x *AppendRequest) GetPrevLogTerm() uint64
- func (x *AppendRequest) GetTerm() uint64
- func (*AppendRequest) ProtoMessage()
- func (x *AppendRequest) ProtoReflect() protoreflect.Message
- func (x *AppendRequest) Reset()
- func (x *AppendRequest) String() string
- type CommitReply
- func (*CommitReply) Descriptor() ([]byte, []int)deprecated
- func (x *CommitReply) GetEntry() *LogEntry
- func (x *CommitReply) GetError() string
- func (x *CommitReply) GetRedirect() string
- func (x *CommitReply) GetSuccess() bool
- func (*CommitReply) ProtoMessage()
- func (x *CommitReply) ProtoReflect() protoreflect.Message
- func (x *CommitReply) Reset()
- func (x *CommitReply) String() string
- type CommitRequest
- func (*CommitRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CommitRequest) GetIdentity() string
- func (x *CommitRequest) GetName() string
- func (x *CommitRequest) GetValue() []byte
- func (*CommitRequest) ProtoMessage()
- func (x *CommitRequest) ProtoReflect() protoreflect.Message
- func (x *CommitRequest) Reset()
- func (x *CommitRequest) String() string
- type LogEntry
- func (*LogEntry) Descriptor() ([]byte, []int)deprecated
- func (x *LogEntry) GetIndex() uint64
- func (x *LogEntry) GetName() string
- func (x *LogEntry) GetTerm() uint64
- func (x *LogEntry) GetValue() []byte
- func (e *LogEntry) IsZero() bool
- func (*LogEntry) ProtoMessage()
- func (x *LogEntry) ProtoReflect() protoreflect.Message
- func (x *LogEntry) Reset()
- func (x *LogEntry) String() string
- type LogMeta
- func (*LogMeta) Descriptor() ([]byte, []int)deprecated
- func (x *LogMeta) GetCommitIndex() uint64
- func (x *LogMeta) GetCreated() *Time
- func (x *LogMeta) GetLastApplied() uint64
- func (x *LogMeta) GetLength() uint64
- func (x *LogMeta) GetUpdated() *Time
- func (*LogMeta) ProtoMessage()
- func (x *LogMeta) ProtoReflect() protoreflect.Message
- func (x *LogMeta) Reset()
- func (x *LogMeta) String() string
- type LogSnapshot
- func (*LogSnapshot) Descriptor() ([]byte, []int)deprecated
- func (x *LogSnapshot) GetEntries() []*LogEntry
- func (x *LogSnapshot) GetMeta() *LogMeta
- func (*LogSnapshot) ProtoMessage()
- func (x *LogSnapshot) ProtoReflect() protoreflect.Message
- func (x *LogSnapshot) Reset()
- func (x *LogSnapshot) String() string
- type RaftClient
- type RaftServer
- type Raft_AppendEntriesClient
- type Raft_AppendEntriesServer
- type Time
- func (*Time) Descriptor() ([]byte, []int)deprecated
- func (t *Time) Get() (time.Time, error)
- func (x *Time) GetRfc3339() []byte
- func (*Time) ProtoMessage()
- func (x *Time) ProtoReflect() protoreflect.Message
- func (x *Time) Reset()
- func (t *Time) Set(ts time.Time) (err error)
- func (x *Time) String() string
- type UnimplementedRaftServer
- type UnsafeRaftServer
- type VoteReply
- func (*VoteReply) Descriptor() ([]byte, []int)deprecated
- func (x *VoteReply) GetGranted() bool
- func (x *VoteReply) GetRemote() string
- func (x *VoteReply) GetTerm() uint64
- func (*VoteReply) ProtoMessage()
- func (x *VoteReply) ProtoReflect() protoreflect.Message
- func (x *VoteReply) Reset()
- func (x *VoteReply) String() string
- type VoteRequest
- func (*VoteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *VoteRequest) GetCandidate() string
- func (x *VoteRequest) GetLastLogIndex() uint64
- 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
Constants ¶
This section is empty.
Variables ¶
var File_raft_v1beta1_append_proto protoreflect.FileDescriptor
var File_raft_v1beta1_client_proto protoreflect.FileDescriptor
var File_raft_v1beta1_log_proto protoreflect.FileDescriptor
var File_raft_v1beta1_service_proto protoreflect.FileDescriptor
var File_raft_v1beta1_time_proto protoreflect.FileDescriptor
var File_raft_v1beta1_vote_proto protoreflect.FileDescriptor
var NullEntry = &LogEntry{Index: 0, Term: 0, Name: "", Value: nil}
NullEntry is an empty entry that is appended to the log.
var Raft_ServiceDesc = grpc.ServiceDesc{ ServiceName: "raft.v1beta1.Raft", HandlerType: (*RaftServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Commit", Handler: _Raft_Commit_Handler, }, { MethodName: "RequestVote", Handler: _Raft_RequestVote_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "AppendEntries", Handler: _Raft_AppendEntries_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "raft/v1beta1/service.proto", }
Raft_ServiceDesc is the grpc.ServiceDesc for Raft service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRaftServer ¶
func RegisterRaftServer(s grpc.ServiceRegistrar, srv RaftServer)
Types ¶
type AppendReply ¶
type AppendReply struct { Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` // Identity of the follower Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` // Epoch the follower is currently in Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` // If entries were appended or not Index uint64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` // Latest index in follower's log CommitIndex uint64 `protobuf:"varint,5,opt,name=commitIndex,proto3" json:"commitIndex,omitempty"` // The commit index of follower // contains filtered or unexported fields }
func (*AppendReply) Descriptor
deprecated
func (*AppendReply) Descriptor() ([]byte, []int)
Deprecated: Use AppendReply.ProtoReflect.Descriptor instead.
func (*AppendReply) GetCommitIndex ¶
func (x *AppendReply) GetCommitIndex() uint64
func (*AppendReply) GetIndex ¶
func (x *AppendReply) GetIndex() uint64
func (*AppendReply) GetRemote ¶
func (x *AppendReply) GetRemote() string
func (*AppendReply) GetSuccess ¶
func (x *AppendReply) GetSuccess() bool
func (*AppendReply) GetTerm ¶
func (x *AppendReply) GetTerm() uint64
func (*AppendReply) ProtoMessage ¶
func (*AppendReply) ProtoMessage()
func (*AppendReply) ProtoReflect ¶
func (x *AppendReply) ProtoReflect() protoreflect.Message
func (*AppendReply) Reset ¶
func (x *AppendReply) Reset()
func (*AppendReply) String ¶
func (x *AppendReply) String() string
type AppendRequest ¶
type AppendRequest struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` // Epoch of the leader Leader string `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"` // Identity of the leader PrevLogIndex uint64 `protobuf:"varint,3,opt,name=prevLogIndex,proto3" json:"prevLogIndex,omitempty"` // Latest index in leader's log PrevLogTerm uint64 `protobuf:"varint,4,opt,name=prevLogTerm,proto3" json:"prevLogTerm,omitempty"` // Epoch of the leader's prev log entry LeaderCommit uint64 `protobuf:"varint,5,opt,name=leaderCommit,proto3" json:"leaderCommit,omitempty"` // The commit index of the leader for local commit Entries []*LogEntry `protobuf:"bytes,6,rep,name=entries,proto3" json:"entries,omitempty"` // Entries to append to the remote's log // contains filtered or unexported fields }
func (*AppendRequest) Descriptor
deprecated
func (*AppendRequest) Descriptor() ([]byte, []int)
Deprecated: Use AppendRequest.ProtoReflect.Descriptor instead.
func (*AppendRequest) GetEntries ¶
func (x *AppendRequest) GetEntries() []*LogEntry
func (*AppendRequest) GetLeader ¶
func (x *AppendRequest) GetLeader() string
func (*AppendRequest) GetLeaderCommit ¶
func (x *AppendRequest) GetLeaderCommit() uint64
func (*AppendRequest) GetPrevLogIndex ¶
func (x *AppendRequest) GetPrevLogIndex() uint64
func (*AppendRequest) GetPrevLogTerm ¶
func (x *AppendRequest) GetPrevLogTerm() uint64
func (*AppendRequest) GetTerm ¶
func (x *AppendRequest) GetTerm() uint64
func (*AppendRequest) ProtoMessage ¶
func (*AppendRequest) ProtoMessage()
func (*AppendRequest) ProtoReflect ¶
func (x *AppendRequest) ProtoReflect() protoreflect.Message
func (*AppendRequest) Reset ¶
func (x *AppendRequest) Reset()
func (*AppendRequest) String ¶
func (x *AppendRequest) String() string
type CommitReply ¶
type CommitReply struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Redirect string `protobuf:"bytes,2,opt,name=redirect,proto3" json:"redirect,omitempty"` Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` Entry *LogEntry `protobuf:"bytes,4,opt,name=entry,proto3" json:"entry,omitempty"` // contains filtered or unexported fields }
func (*CommitReply) Descriptor
deprecated
func (*CommitReply) Descriptor() ([]byte, []int)
Deprecated: Use CommitReply.ProtoReflect.Descriptor instead.
func (*CommitReply) GetEntry ¶
func (x *CommitReply) GetEntry() *LogEntry
func (*CommitReply) GetError ¶
func (x *CommitReply) GetError() string
func (*CommitReply) GetRedirect ¶
func (x *CommitReply) GetRedirect() string
func (*CommitReply) GetSuccess ¶
func (x *CommitReply) GetSuccess() bool
func (*CommitReply) ProtoMessage ¶
func (*CommitReply) ProtoMessage()
func (*CommitReply) ProtoReflect ¶
func (x *CommitReply) ProtoReflect() protoreflect.Message
func (*CommitReply) Reset ¶
func (x *CommitReply) Reset()
func (*CommitReply) String ¶
func (x *CommitReply) String() string
type CommitRequest ¶
type CommitRequest struct { Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*CommitRequest) Descriptor
deprecated
func (*CommitRequest) Descriptor() ([]byte, []int)
Deprecated: Use CommitRequest.ProtoReflect.Descriptor instead.
func (*CommitRequest) GetIdentity ¶
func (x *CommitRequest) GetIdentity() string
func (*CommitRequest) GetName ¶
func (x *CommitRequest) GetName() string
func (*CommitRequest) GetValue ¶
func (x *CommitRequest) GetValue() []byte
func (*CommitRequest) ProtoMessage ¶
func (*CommitRequest) ProtoMessage()
func (*CommitRequest) ProtoReflect ¶
func (x *CommitRequest) ProtoReflect() protoreflect.Message
func (*CommitRequest) Reset ¶
func (x *CommitRequest) Reset()
func (*CommitRequest) String ¶
func (x *CommitRequest) String() string
type LogEntry ¶
type LogEntry struct { Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` // The expected position of the log entry Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` // The term of the log entry Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // The name of the command or object Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` // The value of the object or command (nil for noop) // contains filtered or unexported fields }
Defines an entry in the log
func (*LogEntry) Descriptor
deprecated
func (*LogEntry) ProtoMessage ¶
func (*LogEntry) ProtoMessage()
func (*LogEntry) ProtoReflect ¶
func (x *LogEntry) ProtoReflect() protoreflect.Message
type LogMeta ¶
type LogMeta struct { LastApplied uint64 `protobuf:"varint,1,opt,name=lastApplied,proto3" json:"lastApplied,omitempty"` // The index of the last applied entry CommitIndex uint64 `protobuf:"varint,2,opt,name=commitIndex,proto3" json:"commitIndex,omitempty"` // The index of the last committed entry Length uint64 `protobuf:"varint,3,opt,name=length,proto3" json:"length,omitempty"` // Number of entries in the log Created *Time `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"` // Timestamp the log was created Updated *Time `protobuf:"bytes,5,opt,name=updated,proto3" json:"updated,omitempty"` // Timestamp the log was last updated // contains filtered or unexported fields }
Defines meta data for the log
func (*LogMeta) Descriptor
deprecated
func (*LogMeta) GetCommitIndex ¶
func (*LogMeta) GetCreated ¶
func (*LogMeta) GetLastApplied ¶
func (*LogMeta) GetUpdated ¶
func (*LogMeta) ProtoMessage ¶
func (*LogMeta) ProtoMessage()
func (*LogMeta) ProtoReflect ¶
func (x *LogMeta) ProtoReflect() protoreflect.Message
type LogSnapshot ¶
type LogSnapshot struct { Meta *LogMeta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"` // the meta data of the log Entries []*LogEntry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` // the entries in the snapshot // contains filtered or unexported fields }
A complete log (entries and meta) that is written to disk but cannot be modified in place, e.g. has to be written in its entirety.
func (*LogSnapshot) Descriptor
deprecated
func (*LogSnapshot) Descriptor() ([]byte, []int)
Deprecated: Use LogSnapshot.ProtoReflect.Descriptor instead.
func (*LogSnapshot) GetEntries ¶
func (x *LogSnapshot) GetEntries() []*LogEntry
func (*LogSnapshot) GetMeta ¶
func (x *LogSnapshot) GetMeta() *LogMeta
func (*LogSnapshot) ProtoMessage ¶
func (*LogSnapshot) ProtoMessage()
func (*LogSnapshot) ProtoReflect ¶
func (x *LogSnapshot) ProtoReflect() protoreflect.Message
func (*LogSnapshot) Reset ¶
func (x *LogSnapshot) Reset()
func (*LogSnapshot) String ¶
func (x *LogSnapshot) String() string
type RaftClient ¶
type RaftClient interface { Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitReply, error) RequestVote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteReply, error) AppendEntries(ctx context.Context, opts ...grpc.CallOption) (Raft_AppendEntriesClient, error) }
RaftClient is the client API for Raft service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewRaftClient ¶
func NewRaftClient(cc grpc.ClientConnInterface) RaftClient
type RaftServer ¶
type RaftServer interface { Commit(context.Context, *CommitRequest) (*CommitReply, error) RequestVote(context.Context, *VoteRequest) (*VoteReply, error) AppendEntries(Raft_AppendEntriesServer) error // contains filtered or unexported methods }
RaftServer is the server API for Raft service. All implementations must embed UnimplementedRaftServer for forward compatibility
type Raft_AppendEntriesClient ¶
type Raft_AppendEntriesClient interface { Send(*AppendRequest) error Recv() (*AppendReply, error) grpc.ClientStream }
type Raft_AppendEntriesServer ¶
type Raft_AppendEntriesServer interface { Send(*AppendReply) error Recv() (*AppendRequest, error) grpc.ServerStream }
type Time ¶
type Time struct { Rfc3339 []byte `protobuf:"bytes,1,opt,name=rfc3339,proto3" json:"rfc3339,omitempty"` // contains filtered or unexported fields }
Serializes a time.Time object as an RFC 3339 encoded string.
func (*Time) Descriptor
deprecated
func (*Time) GetRfc3339 ¶
func (*Time) ProtoMessage ¶
func (*Time) ProtoMessage()
func (*Time) ProtoReflect ¶
func (x *Time) ProtoReflect() protoreflect.Message
type UnimplementedRaftServer ¶
type UnimplementedRaftServer struct { }
UnimplementedRaftServer must be embedded to have forward compatible implementations.
func (UnimplementedRaftServer) AppendEntries ¶
func (UnimplementedRaftServer) AppendEntries(Raft_AppendEntriesServer) error
func (UnimplementedRaftServer) Commit ¶
func (UnimplementedRaftServer) Commit(context.Context, *CommitRequest) (*CommitReply, error)
func (UnimplementedRaftServer) RequestVote ¶
func (UnimplementedRaftServer) RequestVote(context.Context, *VoteRequest) (*VoteReply, error)
type UnsafeRaftServer ¶
type UnsafeRaftServer interface {
// contains filtered or unexported methods
}
UnsafeRaftServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RaftServer will result in compilation errors.
type VoteReply ¶
type VoteReply struct { Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` // Identity of the follower Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` // Current epoch of the follower Granted bool `protobuf:"varint,3,opt,name=granted,proto3" json:"granted,omitempty"` // At least one vote is granted // contains filtered or unexported fields }
func (*VoteReply) Descriptor
deprecated
func (*VoteReply) GetGranted ¶
func (*VoteReply) ProtoMessage ¶
func (*VoteReply) ProtoMessage()
func (*VoteReply) ProtoReflect ¶
func (x *VoteReply) ProtoReflect() protoreflect.Message
type VoteRequest ¶
type VoteRequest struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` // The epoch the candidate wants to be in Candidate string `protobuf:"bytes,2,opt,name=candidate,proto3" json:"candidate,omitempty"` // The identity of the candidate LastLogIndex uint64 `protobuf:"varint,3,opt,name=lastLogIndex,proto3" json:"lastLogIndex,omitempty"` // The last index in the candidate's log LastLogTerm uint64 `protobuf:"varint,4,opt,name=lastLogTerm,proto3" json:"lastLogTerm,omitempty"` // The last epoch in the candidate's log // contains filtered or unexported fields }
func (*VoteRequest) Descriptor
deprecated
func (*VoteRequest) Descriptor() ([]byte, []int)
Deprecated: Use VoteRequest.ProtoReflect.Descriptor instead.
func (*VoteRequest) GetCandidate ¶
func (x *VoteRequest) GetCandidate() string
func (*VoteRequest) GetLastLogIndex ¶
func (x *VoteRequest) GetLastLogIndex() uint64
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