protobuf

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogEntry_LogEntryType_name = map[int32]string{
		0: "LOG_ENTRY_TYPE_NOOP_UNSPECIFIED",
		1: "LOG_ENTRY_TYPE_OPERATION",
	}
	LogEntry_LogEntryType_value = map[string]int32{
		"LOG_ENTRY_TYPE_NOOP_UNSPECIFIED": 0,
		"LOG_ENTRY_TYPE_OPERATION":        1,
	}
)

Enum value maps for LogEntry_LogEntryType.

View Source
var File_internal_protobuf_raft_proto protoreflect.FileDescriptor
View Source
var Raft_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Raft",
	HandlerType: (*RaftServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AppendEntries",
			Handler:    _Raft_AppendEntries_Handler,
		},
		{
			MethodName: "RequestVote",
			Handler:    _Raft_RequestVote_Handler,
		},
		{
			MethodName: "InstallSnapshot",
			Handler:    _Raft_InstallSnapshot_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/protobuf/raft.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 AppendEntriesRequest

type AppendEntriesRequest struct {
	LeaderId     string      `protobuf:"bytes,1,opt,name=leader_id,json=leaderId,proto3" json:"leader_id,omitempty"`
	Term         uint64      `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	LeaderCommit uint64      `protobuf:"varint,3,opt,name=leader_commit,json=leaderCommit,proto3" json:"leader_commit,omitempty"`
	PrevLogIndex uint64      `protobuf:"varint,4,opt,name=prev_log_index,json=prevLogIndex,proto3" json:"prev_log_index,omitempty"`
	PrevLogTerm  uint64      `protobuf:"varint,5,opt,name=prev_log_term,json=prevLogTerm,proto3" json:"prev_log_term,omitempty"`
	Entries      []*LogEntry `protobuf:"bytes,6,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() []*LogEntry

func (*AppendEntriesRequest) GetLeaderCommit

func (x *AppendEntriesRequest) GetLeaderCommit() uint64

func (*AppendEntriesRequest) GetLeaderId

func (x *AppendEntriesRequest) GetLeaderId() string

func (*AppendEntriesRequest) GetPrevLogIndex

func (x *AppendEntriesRequest) GetPrevLogIndex() uint64

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 {
	Term    uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	Index   uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,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) GetIndex

func (x *AppendEntriesResponse) GetIndex() 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 Configuration added in v0.1.6

type Configuration struct {
	Members map[string]string `` /* 155-byte string literal not displayed */
	IsVoter map[string]bool   `` /* 171-byte string literal not displayed */
	Index   uint64            `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
	// contains filtered or unexported fields
}

func (*Configuration) Descriptor deprecated added in v0.1.6

func (*Configuration) Descriptor() ([]byte, []int)

Deprecated: Use Configuration.ProtoReflect.Descriptor instead.

func (*Configuration) GetIndex added in v0.1.6

func (x *Configuration) GetIndex() uint64

func (*Configuration) GetIsVoter added in v0.1.6

func (x *Configuration) GetIsVoter() map[string]bool

func (*Configuration) GetMembers added in v0.1.6

func (x *Configuration) GetMembers() map[string]string

func (*Configuration) ProtoMessage added in v0.1.6

func (*Configuration) ProtoMessage()

func (*Configuration) ProtoReflect added in v0.1.6

func (x *Configuration) ProtoReflect() protoreflect.Message

func (*Configuration) Reset added in v0.1.6

func (x *Configuration) Reset()

func (*Configuration) String added in v0.1.6

func (x *Configuration) String() string

type InstallSnapshotRequest

type InstallSnapshotRequest struct {
	Term              uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	Leader            string `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"`
	LastIncludedIndex uint64 `protobuf:"varint,3,opt,name=last_included_index,json=lastIncludedIndex,proto3" json:"last_included_index,omitempty"`
	LastIncludedTerm  uint64 `protobuf:"varint,4,opt,name=last_included_term,json=lastIncludedTerm,proto3" json:"last_included_term,omitempty"`
	Configuration     []byte `protobuf:"bytes,5,opt,name=configuration,proto3" json:"configuration,omitempty"`
	Offset            int64  `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
	Data              []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
	Done              bool   `protobuf:"varint,8,opt,name=done,proto3" json:"done,omitempty"`
	// contains filtered or unexported fields
}

func (*InstallSnapshotRequest) Descriptor deprecated

func (*InstallSnapshotRequest) Descriptor() ([]byte, []int)

Deprecated: Use InstallSnapshotRequest.ProtoReflect.Descriptor instead.

func (*InstallSnapshotRequest) GetConfiguration added in v0.1.6

func (x *InstallSnapshotRequest) GetConfiguration() []byte

func (*InstallSnapshotRequest) GetData

func (x *InstallSnapshotRequest) GetData() []byte

func (*InstallSnapshotRequest) GetDone

func (x *InstallSnapshotRequest) GetDone() bool

func (*InstallSnapshotRequest) GetLastIncludedIndex

func (x *InstallSnapshotRequest) GetLastIncludedIndex() uint64

func (*InstallSnapshotRequest) GetLastIncludedTerm

func (x *InstallSnapshotRequest) GetLastIncludedTerm() uint64

func (*InstallSnapshotRequest) GetLeader

func (x *InstallSnapshotRequest) GetLeader() string

func (*InstallSnapshotRequest) GetOffset

func (x *InstallSnapshotRequest) GetOffset() int64

func (*InstallSnapshotRequest) GetTerm

func (x *InstallSnapshotRequest) GetTerm() uint64

func (*InstallSnapshotRequest) ProtoMessage

func (*InstallSnapshotRequest) ProtoMessage()

func (*InstallSnapshotRequest) ProtoReflect

func (x *InstallSnapshotRequest) ProtoReflect() protoreflect.Message

func (*InstallSnapshotRequest) Reset

func (x *InstallSnapshotRequest) Reset()

func (*InstallSnapshotRequest) String

func (x *InstallSnapshotRequest) String() string

type InstallSnapshotResponse

type InstallSnapshotResponse struct {
	Term         uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	BytesWritten int64  `protobuf:"varint,2,opt,name=bytes_written,json=bytesWritten,proto3" json:"bytes_written,omitempty"`
	// contains filtered or unexported fields
}

func (*InstallSnapshotResponse) Descriptor deprecated

func (*InstallSnapshotResponse) Descriptor() ([]byte, []int)

Deprecated: Use InstallSnapshotResponse.ProtoReflect.Descriptor instead.

func (*InstallSnapshotResponse) GetBytesWritten added in v0.1.6

func (x *InstallSnapshotResponse) GetBytesWritten() int64

func (*InstallSnapshotResponse) GetTerm

func (x *InstallSnapshotResponse) GetTerm() uint64

func (*InstallSnapshotResponse) ProtoMessage

func (*InstallSnapshotResponse) ProtoMessage()

func (*InstallSnapshotResponse) ProtoReflect

func (x *InstallSnapshotResponse) ProtoReflect() protoreflect.Message

func (*InstallSnapshotResponse) Reset

func (x *InstallSnapshotResponse) Reset()

func (*InstallSnapshotResponse) String

func (x *InstallSnapshotResponse) String() string

type LogEntry

type LogEntry struct {
	Index     uint64                `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Term      uint64                `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	Offset    int64                 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	Data      []byte                `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	EntryType LogEntry_LogEntryType `protobuf:"varint,5,opt,name=entry_type,json=entryType,proto3,enum=LogEntry_LogEntryType" json:"entry_type,omitempty"`
	// contains filtered or unexported fields
}

func (*LogEntry) Descriptor deprecated

func (*LogEntry) Descriptor() ([]byte, []int)

Deprecated: Use LogEntry.ProtoReflect.Descriptor instead.

func (*LogEntry) GetData

func (x *LogEntry) GetData() []byte

func (*LogEntry) GetEntryType added in v0.1.5

func (x *LogEntry) GetEntryType() LogEntry_LogEntryType

func (*LogEntry) GetIndex

func (x *LogEntry) GetIndex() uint64

func (*LogEntry) GetOffset

func (x *LogEntry) GetOffset() int64

func (*LogEntry) GetTerm

func (x *LogEntry) GetTerm() uint64

func (*LogEntry) ProtoMessage

func (*LogEntry) ProtoMessage()

func (*LogEntry) ProtoReflect

func (x *LogEntry) ProtoReflect() protoreflect.Message

func (*LogEntry) Reset

func (x *LogEntry) Reset()

func (*LogEntry) String

func (x *LogEntry) String() string

type LogEntry_LogEntryType added in v0.1.5

type LogEntry_LogEntryType int32
const (
	LogEntry_LOG_ENTRY_TYPE_NOOP_UNSPECIFIED LogEntry_LogEntryType = 0
	LogEntry_LOG_ENTRY_TYPE_OPERATION        LogEntry_LogEntryType = 1
)

func (LogEntry_LogEntryType) Descriptor added in v0.1.5

func (LogEntry_LogEntryType) Enum added in v0.1.5

func (LogEntry_LogEntryType) EnumDescriptor deprecated added in v0.1.5

func (LogEntry_LogEntryType) EnumDescriptor() ([]byte, []int)

Deprecated: Use LogEntry_LogEntryType.Descriptor instead.

func (LogEntry_LogEntryType) Number added in v0.1.5

func (LogEntry_LogEntryType) String added in v0.1.5

func (x LogEntry_LogEntryType) String() string

func (LogEntry_LogEntryType) Type added in v0.1.5

type RaftClient

type RaftClient interface {
	AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error)
	RequestVote(ctx context.Context, in *RequestVoteRequest, opts ...grpc.CallOption) (*RequestVoteResponse, error)
	InstallSnapshot(ctx context.Context, in *InstallSnapshotRequest, opts ...grpc.CallOption) (*InstallSnapshotResponse, error)
}

RaftClient is the client API for Raft service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewRaftClient

func NewRaftClient(cc grpc.ClientConnInterface) RaftClient

type RaftServer

type RaftServer interface {
	AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error)
	RequestVote(context.Context, *RequestVoteRequest) (*RequestVoteResponse, error)
	InstallSnapshot(context.Context, *InstallSnapshotRequest) (*InstallSnapshotResponse, error)
	// contains filtered or unexported methods
}

RaftServer is the server API for Raft service. All implementations must embed UnimplementedRaftServer for forward compatibility

type RequestVoteRequest

type RequestVoteRequest struct {
	CandidateId  string `protobuf:"bytes,1,opt,name=candidate_id,json=candidateId,proto3" json:"candidate_id,omitempty"`
	Term         uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	LastLogIndex uint64 `protobuf:"varint,3,opt,name=last_log_index,json=lastLogIndex,proto3" json:"last_log_index,omitempty"`
	LastLogTerm  uint64 `protobuf:"varint,4,opt,name=last_log_term,json=lastLogTerm,proto3" json:"last_log_term,omitempty"`
	Prevote      bool   `protobuf:"varint,5,opt,name=prevote,proto3" json:"prevote,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestVoteRequest) Descriptor deprecated

func (*RequestVoteRequest) Descriptor() ([]byte, []int)

Deprecated: Use RequestVoteRequest.ProtoReflect.Descriptor instead.

func (*RequestVoteRequest) GetCandidateId

func (x *RequestVoteRequest) GetCandidateId() string

func (*RequestVoteRequest) GetLastLogIndex

func (x *RequestVoteRequest) GetLastLogIndex() uint64

func (*RequestVoteRequest) GetLastLogTerm

func (x *RequestVoteRequest) GetLastLogTerm() uint64

func (*RequestVoteRequest) GetPrevote added in v0.1.6

func (x *RequestVoteRequest) GetPrevote() bool

func (*RequestVoteRequest) GetTerm

func (x *RequestVoteRequest) GetTerm() uint64

func (*RequestVoteRequest) ProtoMessage

func (*RequestVoteRequest) ProtoMessage()

func (*RequestVoteRequest) ProtoReflect

func (x *RequestVoteRequest) ProtoReflect() protoreflect.Message

func (*RequestVoteRequest) Reset

func (x *RequestVoteRequest) Reset()

func (*RequestVoteRequest) String

func (x *RequestVoteRequest) String() string

type RequestVoteResponse

type RequestVoteResponse struct {
	Term        uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	VoteGranted bool   `protobuf:"varint,2,opt,name=vote_granted,json=voteGranted,proto3" json:"vote_granted,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestVoteResponse) Descriptor deprecated

func (*RequestVoteResponse) Descriptor() ([]byte, []int)

Deprecated: Use RequestVoteResponse.ProtoReflect.Descriptor instead.

func (*RequestVoteResponse) GetTerm

func (x *RequestVoteResponse) GetTerm() uint64

func (*RequestVoteResponse) GetVoteGranted

func (x *RequestVoteResponse) GetVoteGranted() bool

func (*RequestVoteResponse) ProtoMessage

func (*RequestVoteResponse) ProtoMessage()

func (*RequestVoteResponse) ProtoReflect

func (x *RequestVoteResponse) ProtoReflect() protoreflect.Message

func (*RequestVoteResponse) Reset

func (x *RequestVoteResponse) Reset()

func (*RequestVoteResponse) String

func (x *RequestVoteResponse) String() string

type StorageState

type StorageState struct {
	Term     uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	VotedFor string `protobuf:"bytes,2,opt,name=voted_for,json=votedFor,proto3" json:"voted_for,omitempty"`
	// contains filtered or unexported fields
}

func (*StorageState) Descriptor deprecated

func (*StorageState) Descriptor() ([]byte, []int)

Deprecated: Use StorageState.ProtoReflect.Descriptor instead.

func (*StorageState) GetTerm

func (x *StorageState) GetTerm() uint64

func (*StorageState) GetVotedFor

func (x *StorageState) GetVotedFor() string

func (*StorageState) ProtoMessage

func (*StorageState) ProtoMessage()

func (*StorageState) ProtoReflect

func (x *StorageState) ProtoReflect() protoreflect.Message

func (*StorageState) Reset

func (x *StorageState) Reset()

func (*StorageState) String

func (x *StorageState) String() string

type UnimplementedRaftServer

type UnimplementedRaftServer struct {
}

UnimplementedRaftServer must be embedded to have forward compatible implementations.

func (UnimplementedRaftServer) AppendEntries

func (UnimplementedRaftServer) InstallSnapshot

func (UnimplementedRaftServer) RequestVote

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL