protobuf

package
v0.0.0-...-819c8a5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 5 Imported by: 0

README

1. 确保 $GOPATH 和 $PATH(go的bin要加进去)都没问题,这里可以用echo $GOPATH查看

2. 确保 github.com/gogo/protobuf/gogoproto/gogo 被get下来了,并且在$GOPATH的src里面
go get github.com/gogo/protobuf/protoc-gen-gogo
3. 关于proto文件格式

syntax = "proto2"; //这个我用的版本是proto2,根据自己情况 
package protobuf;   
option go_package = "github.com/bedragon/raft/protobuf"; //这个最终会成为包名,所以不能乱弄 
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; // 这个是目前最新的gogo包
4. 执行 protoc --go_out=. -I/Users/这里就是gopath/go/src -I=. *.proto

这里-I我替换成为过 /Users/这里就是gopath/go/src/github.com/gogo/protobuf/gogoproto 

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_append_entries_request_proto protoreflect.FileDescriptor
View Source
var File_append_entries_responses_proto protoreflect.FileDescriptor
View Source
var File_log_entry_proto protoreflect.FileDescriptor
View Source
var File_request_vote_request_proto protoreflect.FileDescriptor
View Source
var File_request_vote_responses_proto protoreflect.FileDescriptor
View Source
var File_snapshot_recovery_request_proto protoreflect.FileDescriptor
View Source
var File_snapshot_recovery_response_proto protoreflect.FileDescriptor
View Source
var File_snapshot_request_proto protoreflect.FileDescriptor
View Source
var File_snapshot_response_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AppendEntriesRequest

type AppendEntriesRequest struct {
	Term         *uint64     `protobuf:"varint,1,req,name=Term" json:"Term,omitempty"`
	PrevLogIndex *uint64     `protobuf:"varint,2,req,name=PrevLogIndex" json:"PrevLogIndex,omitempty"`
	PrevLogTerm  *uint64     `protobuf:"varint,3,req,name=PrevLogTerm" json:"PrevLogTerm,omitempty"`
	CommitIndex  *uint64     `protobuf:"varint,4,req,name=CommitIndex" json:"CommitIndex,omitempty"`
	LeaderName   *string     `protobuf:"bytes,5,req,name=LeaderName" json:"LeaderName,omitempty"`
	Entries      []*LogEntry `protobuf:"bytes,6,rep,name=Entries" 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) GetCommitIndex

func (x *AppendEntriesRequest) GetCommitIndex() uint64

func (*AppendEntriesRequest) GetEntries

func (x *AppendEntriesRequest) GetEntries() []*LogEntry

func (*AppendEntriesRequest) GetLeaderName

func (x *AppendEntriesRequest) GetLeaderName() 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,req,name=Term" json:"Term,omitempty"`
	Index       *uint64 `protobuf:"varint,2,req,name=Index" json:"Index,omitempty"`
	CommitIndex *uint64 `protobuf:"varint,3,req,name=CommitIndex" json:"CommitIndex,omitempty"`
	Success     *bool   `protobuf:"varint,4,req,name=Success" 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) GetCommitIndex

func (x *AppendEntriesResponse) GetCommitIndex() uint64

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 LogEntry

type LogEntry struct {
	Index       *uint64 `protobuf:"varint,1,req,name=Index" json:"Index,omitempty"`
	Term        *uint64 `protobuf:"varint,2,req,name=Term" json:"Term,omitempty"`
	CommandName *string `protobuf:"bytes,3,req,name=CommandName" json:"CommandName,omitempty"`
	Command     []byte  `protobuf:"bytes,4,opt,name=Command" json:"Command,omitempty"` // for nop-command
	// contains filtered or unexported fields
}

func (*LogEntry) Descriptor deprecated

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

Deprecated: Use LogEntry.ProtoReflect.Descriptor instead.

func (*LogEntry) GetCommand

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

func (*LogEntry) GetCommandName

func (x *LogEntry) GetCommandName() string

func (*LogEntry) GetIndex

func (x *LogEntry) GetIndex() uint64

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 RequestVoteRequest

type RequestVoteRequest struct {
	Term          *uint64 `protobuf:"varint,1,req,name=Term" json:"Term,omitempty"`
	LastLogIndex  *uint64 `protobuf:"varint,2,req,name=LastLogIndex" json:"LastLogIndex,omitempty"`
	LastLogTerm   *uint64 `protobuf:"varint,3,req,name=LastLogTerm" json:"LastLogTerm,omitempty"`
	CandidateName *string `protobuf:"bytes,4,req,name=CandidateName" json:"CandidateName,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestVoteRequest) Descriptor deprecated

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

Deprecated: Use RequestVoteRequest.ProtoReflect.Descriptor instead.

func (*RequestVoteRequest) GetCandidateName

func (x *RequestVoteRequest) GetCandidateName() string

func (*RequestVoteRequest) GetLastLogIndex

func (x *RequestVoteRequest) GetLastLogIndex() uint64

func (*RequestVoteRequest) GetLastLogTerm

func (x *RequestVoteRequest) GetLastLogTerm() uint64

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,req,name=Term" json:"Term,omitempty"`
	VoteGranted *bool   `protobuf:"varint,2,req,name=VoteGranted" json:"VoteGranted,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 SnapshotRecoveryRequest

type SnapshotRecoveryRequest struct {
	LeaderName *string                         `protobuf:"bytes,1,req,name=LeaderName" json:"LeaderName,omitempty"`
	LastIndex  *uint64                         `protobuf:"varint,2,req,name=LastIndex" json:"LastIndex,omitempty"`
	LastTerm   *uint64                         `protobuf:"varint,3,req,name=LastTerm" json:"LastTerm,omitempty"`
	Peers      []*SnapshotRecoveryRequest_Peer `protobuf:"bytes,4,rep,name=Peers" json:"Peers,omitempty"`
	State      []byte                          `protobuf:"bytes,5,req,name=State" json:"State,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotRecoveryRequest) Descriptor deprecated

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

Deprecated: Use SnapshotRecoveryRequest.ProtoReflect.Descriptor instead.

func (*SnapshotRecoveryRequest) GetLastIndex

func (x *SnapshotRecoveryRequest) GetLastIndex() uint64

func (*SnapshotRecoveryRequest) GetLastTerm

func (x *SnapshotRecoveryRequest) GetLastTerm() uint64

func (*SnapshotRecoveryRequest) GetLeaderName

func (x *SnapshotRecoveryRequest) GetLeaderName() string

func (*SnapshotRecoveryRequest) GetPeers

func (*SnapshotRecoveryRequest) GetState

func (x *SnapshotRecoveryRequest) GetState() []byte

func (*SnapshotRecoveryRequest) ProtoMessage

func (*SnapshotRecoveryRequest) ProtoMessage()

func (*SnapshotRecoveryRequest) ProtoReflect

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

func (*SnapshotRecoveryRequest) Reset

func (x *SnapshotRecoveryRequest) Reset()

func (*SnapshotRecoveryRequest) String

func (x *SnapshotRecoveryRequest) String() string

type SnapshotRecoveryRequest_Peer

type SnapshotRecoveryRequest_Peer struct {
	Name             *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
	ConnectionString *string `protobuf:"bytes,2,req,name=ConnectionString" json:"ConnectionString,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotRecoveryRequest_Peer) Descriptor deprecated

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

Deprecated: Use SnapshotRecoveryRequest_Peer.ProtoReflect.Descriptor instead.

func (*SnapshotRecoveryRequest_Peer) GetConnectionString

func (x *SnapshotRecoveryRequest_Peer) GetConnectionString() string

func (*SnapshotRecoveryRequest_Peer) GetName

func (x *SnapshotRecoveryRequest_Peer) GetName() string

func (*SnapshotRecoveryRequest_Peer) ProtoMessage

func (*SnapshotRecoveryRequest_Peer) ProtoMessage()

func (*SnapshotRecoveryRequest_Peer) ProtoReflect

func (*SnapshotRecoveryRequest_Peer) Reset

func (x *SnapshotRecoveryRequest_Peer) Reset()

func (*SnapshotRecoveryRequest_Peer) String

type SnapshotRecoveryResponse

type SnapshotRecoveryResponse struct {
	Term        *uint64 `protobuf:"varint,1,req,name=Term" json:"Term,omitempty"`
	Success     *bool   `protobuf:"varint,2,req,name=Success" json:"Success,omitempty"`
	CommitIndex *uint64 `protobuf:"varint,3,req,name=CommitIndex" json:"CommitIndex,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotRecoveryResponse) Descriptor deprecated

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

Deprecated: Use SnapshotRecoveryResponse.ProtoReflect.Descriptor instead.

func (*SnapshotRecoveryResponse) GetCommitIndex

func (x *SnapshotRecoveryResponse) GetCommitIndex() uint64

func (*SnapshotRecoveryResponse) GetSuccess

func (x *SnapshotRecoveryResponse) GetSuccess() bool

func (*SnapshotRecoveryResponse) GetTerm

func (x *SnapshotRecoveryResponse) GetTerm() uint64

func (*SnapshotRecoveryResponse) ProtoMessage

func (*SnapshotRecoveryResponse) ProtoMessage()

func (*SnapshotRecoveryResponse) ProtoReflect

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

func (*SnapshotRecoveryResponse) Reset

func (x *SnapshotRecoveryResponse) Reset()

func (*SnapshotRecoveryResponse) String

func (x *SnapshotRecoveryResponse) String() string

type SnapshotRequest

type SnapshotRequest struct {
	LeaderName *string `protobuf:"bytes,1,req,name=LeaderName" json:"LeaderName,omitempty"`
	LastIndex  *uint64 `protobuf:"varint,2,req,name=LastIndex" json:"LastIndex,omitempty"`
	LastTerm   *uint64 `protobuf:"varint,3,req,name=LastTerm" json:"LastTerm,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotRequest) Descriptor deprecated

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

Deprecated: Use SnapshotRequest.ProtoReflect.Descriptor instead.

func (*SnapshotRequest) GetLastIndex

func (x *SnapshotRequest) GetLastIndex() uint64

func (*SnapshotRequest) GetLastTerm

func (x *SnapshotRequest) GetLastTerm() uint64

func (*SnapshotRequest) GetLeaderName

func (x *SnapshotRequest) GetLeaderName() string

func (*SnapshotRequest) ProtoMessage

func (*SnapshotRequest) ProtoMessage()

func (*SnapshotRequest) ProtoReflect

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

func (*SnapshotRequest) Reset

func (x *SnapshotRequest) Reset()

func (*SnapshotRequest) String

func (x *SnapshotRequest) String() string

type SnapshotResponse

type SnapshotResponse struct {
	Success *bool `protobuf:"varint,1,req,name=Success" json:"Success,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotResponse) Descriptor deprecated

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

Deprecated: Use SnapshotResponse.ProtoReflect.Descriptor instead.

func (*SnapshotResponse) GetSuccess

func (x *SnapshotResponse) GetSuccess() bool

func (*SnapshotResponse) ProtoMessage

func (*SnapshotResponse) ProtoMessage()

func (*SnapshotResponse) ProtoReflect

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

func (*SnapshotResponse) Reset

func (x *SnapshotResponse) Reset()

func (*SnapshotResponse) String

func (x *SnapshotResponse) String() string

Jump to

Keyboard shortcuts

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