Documentation ¶
Index ¶
- func NewGrpcConn[T nodeMessage](addr string) (conn[T], error)
- type GrpcNodeServer
- func (gns *GrpcNodeServer[T]) AppendEntries(ctx context.Context, req *proto.LogRequest) (*proto.LogReply, error)
- func (gns *GrpcNodeServer[T]) GetMetadata(context.Context, *proto.MetadataRequest) (*proto.MetadataReply, error)
- func (gns *GrpcNodeServer[T]) ProxyPush(ctx context.Context, req *proto.ProxyPushRequest) (*proto.ProxyPushReply, error)
- func (gns *GrpcNodeServer[T]) RequestVote(ctx context.Context, req *proto.VoteRequest) (*proto.VoteReply, error)
- func (gns *GrpcNodeServer[T]) Start(ctx context.Context) error
- type LogReply
- type LogRequest
- type MemoryStorage
- func (ms *MemoryStorage[T]) Append(command ...T) (int64, error)
- func (ms *MemoryStorage[T]) Commit(offset int64) ([]T, error)
- func (ms *MemoryStorage[T]) Commited() int64
- func (ms *MemoryStorage[T]) Discard(start int64, end int64) error
- func (ms *MemoryStorage[T]) Get(start int64, end int64) ([]T, error)
- func (ms *MemoryStorage[T]) Length() int64
- type Message
- type NodeMode
- type ProxyPush
- type ProxyPushReply
- type RaftNode
- type Storage
- type VoteReply
- type VoteRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGrpcConn ¶
Types ¶
type GrpcNodeServer ¶
type GrpcNodeServer[T nodeMessage] struct { proto.UnsafeNodeServer // contains filtered or unexported fields }
func NewGrpcNodeServer ¶
func NewGrpcNodeServer[T nodeMessage](n RaftNode[T], addr string) *GrpcNodeServer[T]
func (*GrpcNodeServer[T]) AppendEntries ¶
func (gns *GrpcNodeServer[T]) AppendEntries(ctx context.Context, req *proto.LogRequest) (*proto.LogReply, error)
AppendEntries implements proto.NodeServer.
func (*GrpcNodeServer[T]) GetMetadata ¶
func (gns *GrpcNodeServer[T]) GetMetadata(context.Context, *proto.MetadataRequest) (*proto.MetadataReply, error)
GetMetadata implements proto.NodeServer.
func (*GrpcNodeServer[T]) ProxyPush ¶
func (gns *GrpcNodeServer[T]) ProxyPush(ctx context.Context, req *proto.ProxyPushRequest) (*proto.ProxyPushReply, error)
ProxyPush implements proto.NodeServer.
func (*GrpcNodeServer[T]) RequestVote ¶
func (gns *GrpcNodeServer[T]) RequestVote(ctx context.Context, req *proto.VoteRequest) (*proto.VoteReply, error)
RequestVote implements proto.NodeServer.
type LogRequest ¶
type MemoryStorage ¶
type MemoryStorage[T any] struct { // contains filtered or unexported fields }
func (*MemoryStorage[T]) Append ¶
func (ms *MemoryStorage[T]) Append(command ...T) (int64, error)
func (*MemoryStorage[T]) Commit ¶
func (ms *MemoryStorage[T]) Commit(offset int64) ([]T, error)
func (*MemoryStorage[T]) Commited ¶
func (ms *MemoryStorage[T]) Commited() int64
func (*MemoryStorage[T]) Discard ¶
func (ms *MemoryStorage[T]) Discard(start int64, end int64) error
func (*MemoryStorage[T]) Length ¶
func (ms *MemoryStorage[T]) Length() int64
type ProxyPushReply ¶
type ProxyPushReply struct {
Ok bool
}
type RaftNode ¶
type VoteRequest ¶
Click to show internal directories.
Click to hide internal directories.