server

package
v0.0.0-...-028f6a4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2017 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

Package server is a generated protocol buffer package.

It is generated from these files:

proto/server/server.proto

It has these top-level messages:

CommandRequest
CommandResponse
LogEntry
RequestVoteRequest
RequestVoteResponse
AppendEntriesRequest
AppendEntriesResponse
Peer
Node
RaftGroup
ServerConfig
ApproveAppendResponse
Client
Nothing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBFTRaftServer

func RegisterBFTRaftServer(s *grpc.Server, srv BFTRaftServer)

Types

type AppendEntriesRequest

type AppendEntriesRequest struct {
	Group        uint64                 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	Term         uint64                 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"`
	LeaderId     uint64                 `protobuf:"varint,3,opt,name=leader_id,json=leaderId" json:"leader_id,omitempty"`
	PrevLogIndex uint64                 `protobuf:"varint,4,opt,name=prev_log_index,json=prevLogIndex" json:"prev_log_index,omitempty"`
	PrevLogTerm  uint64                 `protobuf:"varint,5,opt,name=prev_log_term,json=prevLogTerm" json:"prev_log_term,omitempty"`
	Signature    []byte                 `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"`
	QuorumVotes  []*RequestVoteResponse `protobuf:"bytes,7,rep,name=quorum_votes,json=quorumVotes" json:"quorum_votes,omitempty"`
	Entries      []*LogEntry            `protobuf:"bytes,8,rep,name=entries" json:"entries,omitempty"`
}

func (*AppendEntriesRequest) Descriptor

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

func (*AppendEntriesRequest) GetEntries

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

func (*AppendEntriesRequest) GetGroup

func (m *AppendEntriesRequest) GetGroup() uint64

func (*AppendEntriesRequest) GetLeaderId

func (m *AppendEntriesRequest) GetLeaderId() uint64

func (*AppendEntriesRequest) GetPrevLogIndex

func (m *AppendEntriesRequest) GetPrevLogIndex() uint64

func (*AppendEntriesRequest) GetPrevLogTerm

func (m *AppendEntriesRequest) GetPrevLogTerm() uint64

func (*AppendEntriesRequest) GetQuorumVotes

func (m *AppendEntriesRequest) GetQuorumVotes() []*RequestVoteResponse

func (*AppendEntriesRequest) GetSignature

func (m *AppendEntriesRequest) GetSignature() []byte

func (*AppendEntriesRequest) GetTerm

func (m *AppendEntriesRequest) GetTerm() uint64

func (*AppendEntriesRequest) ProtoMessage

func (*AppendEntriesRequest) ProtoMessage()

func (*AppendEntriesRequest) Reset

func (m *AppendEntriesRequest) Reset()

func (*AppendEntriesRequest) String

func (m *AppendEntriesRequest) String() string

type AppendEntriesResponse

type AppendEntriesResponse struct {
	Group     uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	Term      uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"`
	Index     uint64 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"`
	Peer      uint64 `protobuf:"varint,4,opt,name=peer" json:"peer,omitempty"`
	Successed bool   `protobuf:"varint,5,opt,name=successed" json:"successed,omitempty"`
	Convinced bool   `protobuf:"varint,6,opt,name=convinced" json:"convinced,omitempty"`
	Hash      []byte `protobuf:"bytes,7,opt,name=hash,proto3" json:"hash,omitempty"`
	Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*AppendEntriesResponse) Descriptor

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

func (*AppendEntriesResponse) GetConvinced

func (m *AppendEntriesResponse) GetConvinced() bool

func (*AppendEntriesResponse) GetGroup

func (m *AppendEntriesResponse) GetGroup() uint64

func (*AppendEntriesResponse) GetHash

func (m *AppendEntriesResponse) GetHash() []byte

func (*AppendEntriesResponse) GetIndex

func (m *AppendEntriesResponse) GetIndex() uint64

func (*AppendEntriesResponse) GetPeer

func (m *AppendEntriesResponse) GetPeer() uint64

func (*AppendEntriesResponse) GetSignature

func (m *AppendEntriesResponse) GetSignature() []byte

func (*AppendEntriesResponse) GetSuccessed

func (m *AppendEntriesResponse) GetSuccessed() bool

func (*AppendEntriesResponse) GetTerm

func (m *AppendEntriesResponse) GetTerm() uint64

func (*AppendEntriesResponse) ProtoMessage

func (*AppendEntriesResponse) ProtoMessage()

func (*AppendEntriesResponse) Reset

func (m *AppendEntriesResponse) Reset()

func (*AppendEntriesResponse) String

func (m *AppendEntriesResponse) String() string

type ApproveAppendResponse

type ApproveAppendResponse struct {
	Group     uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	Peer      uint64 `protobuf:"varint,2,opt,name=peer" json:"peer,omitempty"`
	Index     uint64 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"`
	Appended  bool   `protobuf:"varint,4,opt,name=appended" json:"appended,omitempty"`
	Delayed   bool   `protobuf:"varint,5,opt,name=delayed" json:"delayed,omitempty"`
	Failed    bool   `protobuf:"varint,6,opt,name=failed" json:"failed,omitempty"`
	Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*ApproveAppendResponse) Descriptor

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

func (*ApproveAppendResponse) GetAppended

func (m *ApproveAppendResponse) GetAppended() bool

func (*ApproveAppendResponse) GetDelayed

func (m *ApproveAppendResponse) GetDelayed() bool

func (*ApproveAppendResponse) GetFailed

func (m *ApproveAppendResponse) GetFailed() bool

func (*ApproveAppendResponse) GetGroup

func (m *ApproveAppendResponse) GetGroup() uint64

func (*ApproveAppendResponse) GetIndex

func (m *ApproveAppendResponse) GetIndex() uint64

func (*ApproveAppendResponse) GetPeer

func (m *ApproveAppendResponse) GetPeer() uint64

func (*ApproveAppendResponse) GetSignature

func (m *ApproveAppendResponse) GetSignature() []byte

func (*ApproveAppendResponse) ProtoMessage

func (*ApproveAppendResponse) ProtoMessage()

func (*ApproveAppendResponse) Reset

func (m *ApproveAppendResponse) Reset()

func (*ApproveAppendResponse) String

func (m *ApproveAppendResponse) String() string

type BFTRaftClient

type BFTRaftClient interface {
	ExecCommand(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (*CommandResponse, error)
	RequestVote(ctx context.Context, in *RequestVoteRequest, opts ...grpc.CallOption) (*RequestVoteResponse, error)
	AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error)
	ApproveAppend(ctx context.Context, in *AppendEntriesResponse, opts ...grpc.CallOption) (*ApproveAppendResponse, error)
}

func NewBFTRaftClient

func NewBFTRaftClient(cc *grpc.ClientConn) BFTRaftClient

type Client

type Client struct {
	Id         uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Address    string `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
	PrivateKey []byte `protobuf:"bytes,3,opt,name=privateKey,proto3" json:"privateKey,omitempty"`
}

func (*Client) Descriptor

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

func (*Client) GetAddress

func (m *Client) GetAddress() string

func (*Client) GetId

func (m *Client) GetId() uint64

func (*Client) GetPrivateKey

func (m *Client) GetPrivateKey() []byte

func (*Client) ProtoMessage

func (*Client) ProtoMessage()

func (*Client) Reset

func (m *Client) Reset()

func (*Client) String

func (m *Client) String() string

type CommandRequest

type CommandRequest struct {
	Group     uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	ClientId  uint64 `protobuf:"varint,2,opt,name=client_id,json=clientId" json:"client_id,omitempty"`
	RequestId uint64 `protobuf:"varint,3,opt,name=request_id,json=requestId" json:"request_id,omitempty"`
	FuncId    uint64 `protobuf:"varint,4,opt,name=func_id,json=funcId" json:"func_id,omitempty"`
	Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
	Arg       []byte `protobuf:"bytes,6,opt,name=arg,proto3" json:"arg,omitempty"`
}

func (*CommandRequest) Descriptor

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

func (*CommandRequest) GetArg

func (m *CommandRequest) GetArg() []byte

func (*CommandRequest) GetClientId

func (m *CommandRequest) GetClientId() uint64

func (*CommandRequest) GetFuncId

func (m *CommandRequest) GetFuncId() uint64

func (*CommandRequest) GetGroup

func (m *CommandRequest) GetGroup() uint64

func (*CommandRequest) GetRequestId

func (m *CommandRequest) GetRequestId() uint64

func (*CommandRequest) GetSignature

func (m *CommandRequest) GetSignature() []byte

func (*CommandRequest) ProtoMessage

func (*CommandRequest) ProtoMessage()

func (*CommandRequest) Reset

func (m *CommandRequest) Reset()

func (*CommandRequest) String

func (m *CommandRequest) String() string

type CommandResponse

type CommandResponse struct {
	Group     uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	LeaderId  uint64 `protobuf:"varint,2,opt,name=leader_id,json=leaderId" json:"leader_id,omitempty"`
	NodeId    uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id,omitempty"`
	RequestId uint64 `protobuf:"varint,4,opt,name=request_id,json=requestId" json:"request_id,omitempty"`
	Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
	Result    []byte `protobuf:"bytes,6,opt,name=result,proto3" json:"result,omitempty"`
}

func (*CommandResponse) Descriptor

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

func (*CommandResponse) GetGroup

func (m *CommandResponse) GetGroup() uint64

func (*CommandResponse) GetLeaderId

func (m *CommandResponse) GetLeaderId() uint64

func (*CommandResponse) GetNodeId

func (m *CommandResponse) GetNodeId() uint64

func (*CommandResponse) GetRequestId

func (m *CommandResponse) GetRequestId() uint64

func (*CommandResponse) GetResult

func (m *CommandResponse) GetResult() []byte

func (*CommandResponse) GetSignature

func (m *CommandResponse) GetSignature() []byte

func (*CommandResponse) ProtoMessage

func (*CommandResponse) ProtoMessage()

func (*CommandResponse) Reset

func (m *CommandResponse) Reset()

func (*CommandResponse) String

func (m *CommandResponse) String() string

type LogEntry

type LogEntry struct {
	Term    uint64          `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	Index   uint64          `protobuf:"varint,2,opt,name=index" json:"index,omitempty"`
	Hash    []byte          `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"`
	Command *CommandRequest `protobuf:"bytes,4,opt,name=command" json:"command,omitempty"`
}

func (*LogEntry) Descriptor

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

func (*LogEntry) GetCommand

func (m *LogEntry) GetCommand() *CommandRequest

func (*LogEntry) GetHash

func (m *LogEntry) GetHash() []byte

func (*LogEntry) GetIndex

func (m *LogEntry) GetIndex() uint64

func (*LogEntry) GetTerm

func (m *LogEntry) GetTerm() uint64

func (*LogEntry) ProtoMessage

func (*LogEntry) ProtoMessage()

func (*LogEntry) Reset

func (m *LogEntry) Reset()

func (*LogEntry) String

func (m *LogEntry) String() string

type Node

type Node struct {
	Id         uint64   `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	LastSeen   uint64   `protobuf:"varint,2,opt,name=last_seen,json=lastSeen" json:"last_seen,omitempty"`
	Online     bool     `protobuf:"varint,3,opt,name=online" json:"online,omitempty"`
	ServerAddr string   `protobuf:"bytes,4,opt,name=server_addr,json=serverAddr" json:"server_addr,omitempty"`
	PublicKey  []byte   `protobuf:"bytes,5,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	Peers      []uint64 `protobuf:"varint,6,rep,packed,name=peers" json:"peers,omitempty"`
}

func (*Node) Descriptor

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

func (*Node) GetId

func (m *Node) GetId() uint64

func (*Node) GetLastSeen

func (m *Node) GetLastSeen() uint64

func (*Node) GetOnline

func (m *Node) GetOnline() bool

func (*Node) GetPeers

func (m *Node) GetPeers() []uint64

func (*Node) GetPublicKey

func (m *Node) GetPublicKey() []byte

func (*Node) GetServerAddr

func (m *Node) GetServerAddr() string

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) String

func (m *Node) String() string

type Nothing

type Nothing struct {
}

func (*Nothing) Descriptor

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

func (*Nothing) ProtoMessage

func (*Nothing) ProtoMessage()

func (*Nothing) Reset

func (m *Nothing) Reset()

func (*Nothing) String

func (m *Nothing) String() string

type Peer

type Peer struct {
	Id         uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Group      uint64 `protobuf:"varint,2,opt,name=group" json:"group,omitempty"`
	Host       uint64 `protobuf:"varint,3,opt,name=host" json:"host,omitempty"`
	NextIndex  uint64 `protobuf:"varint,4,opt,name=next_index,json=nextIndex" json:"next_index,omitempty"`
	MatchIndex uint64 `protobuf:"varint,5,opt,name=match_index,json=matchIndex" json:"match_index,omitempty"`
	LastSeen   uint64 `protobuf:"varint,6,opt,name=last_seen,json=lastSeen" json:"last_seen,omitempty"`
}

func (*Peer) Descriptor

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

func (*Peer) GetGroup

func (m *Peer) GetGroup() uint64

func (*Peer) GetHost

func (m *Peer) GetHost() uint64

func (*Peer) GetId

func (m *Peer) GetId() uint64

func (*Peer) GetLastSeen

func (m *Peer) GetLastSeen() uint64

func (*Peer) GetMatchIndex

func (m *Peer) GetMatchIndex() uint64

func (*Peer) GetNextIndex

func (m *Peer) GetNextIndex() uint64

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) Reset

func (m *Peer) Reset()

func (*Peer) String

func (m *Peer) String() string

type RaftGroup

type RaftGroup struct {
	Replications uint32 `protobuf:"varint,1,opt,name=replications" json:"replications,omitempty"`
	Id           uint64 `protobuf:"varint,2,opt,name=id" json:"id,omitempty"`
	LeaderPeer   uint64 `protobuf:"varint,3,opt,name=leader_peer,json=leaderPeer" json:"leader_peer,omitempty"`
	Term         uint64 `protobuf:"varint,4,opt,name=term" json:"term,omitempty"`
}

func (*RaftGroup) Descriptor

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

func (*RaftGroup) GetId

func (m *RaftGroup) GetId() uint64

func (*RaftGroup) GetLeaderPeer

func (m *RaftGroup) GetLeaderPeer() uint64

func (*RaftGroup) GetReplications

func (m *RaftGroup) GetReplications() uint32

func (*RaftGroup) GetTerm

func (m *RaftGroup) GetTerm() uint64

func (*RaftGroup) ProtoMessage

func (*RaftGroup) ProtoMessage()

func (*RaftGroup) Reset

func (m *RaftGroup) Reset()

func (*RaftGroup) String

func (m *RaftGroup) String() string

type RequestVoteRequest

type RequestVoteRequest struct {
	Group       uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	Term        uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"`
	LogIndex    uint64 `protobuf:"varint,3,opt,name=log_index,json=logIndex" json:"log_index,omitempty"`
	LogTerm     uint64 `protobuf:"varint,4,opt,name=log_term,json=logTerm" json:"log_term,omitempty"`
	CandidateId uint64 `protobuf:"varint,5,opt,name=candidate_id,json=candidateId" json:"candidate_id,omitempty"`
	Signature   []byte `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*RequestVoteRequest) Descriptor

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

func (*RequestVoteRequest) GetCandidateId

func (m *RequestVoteRequest) GetCandidateId() uint64

func (*RequestVoteRequest) GetGroup

func (m *RequestVoteRequest) GetGroup() uint64

func (*RequestVoteRequest) GetLogIndex

func (m *RequestVoteRequest) GetLogIndex() uint64

func (*RequestVoteRequest) GetLogTerm

func (m *RequestVoteRequest) GetLogTerm() uint64

func (*RequestVoteRequest) GetSignature

func (m *RequestVoteRequest) GetSignature() []byte

func (*RequestVoteRequest) GetTerm

func (m *RequestVoteRequest) GetTerm() uint64

func (*RequestVoteRequest) ProtoMessage

func (*RequestVoteRequest) ProtoMessage()

func (*RequestVoteRequest) Reset

func (m *RequestVoteRequest) Reset()

func (*RequestVoteRequest) String

func (m *RequestVoteRequest) String() string

type RequestVoteResponse

type RequestVoteResponse struct {
	Group       uint64 `protobuf:"varint,1,opt,name=group" json:"group,omitempty"`
	Term        uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"`
	LogIndex    uint64 `protobuf:"varint,3,opt,name=log_index,json=logIndex" json:"log_index,omitempty"`
	CandidateId uint64 `protobuf:"varint,5,opt,name=candidate_id,json=candidateId" json:"candidate_id,omitempty"`
	Voter       uint64 `protobuf:"varint,6,opt,name=voter" json:"voter,omitempty"`
	Granted     bool   `protobuf:"varint,7,opt,name=granted" json:"granted,omitempty"`
	Signature   []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*RequestVoteResponse) Descriptor

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

func (*RequestVoteResponse) GetCandidateId

func (m *RequestVoteResponse) GetCandidateId() uint64

func (*RequestVoteResponse) GetGranted

func (m *RequestVoteResponse) GetGranted() bool

func (*RequestVoteResponse) GetGroup

func (m *RequestVoteResponse) GetGroup() uint64

func (*RequestVoteResponse) GetLogIndex

func (m *RequestVoteResponse) GetLogIndex() uint64

func (*RequestVoteResponse) GetSignature

func (m *RequestVoteResponse) GetSignature() []byte

func (*RequestVoteResponse) GetTerm

func (m *RequestVoteResponse) GetTerm() uint64

func (*RequestVoteResponse) GetVoter

func (m *RequestVoteResponse) GetVoter() uint64

func (*RequestVoteResponse) ProtoMessage

func (*RequestVoteResponse) ProtoMessage()

func (*RequestVoteResponse) Reset

func (m *RequestVoteResponse) Reset()

func (*RequestVoteResponse) String

func (m *RequestVoteResponse) String() string

type ServerConfig

type ServerConfig struct {
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
}

func (*ServerConfig) Descriptor

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

func (*ServerConfig) GetPublicKey

func (m *ServerConfig) GetPublicKey() []byte

func (*ServerConfig) ProtoMessage

func (*ServerConfig) ProtoMessage()

func (*ServerConfig) Reset

func (m *ServerConfig) Reset()

func (*ServerConfig) String

func (m *ServerConfig) String() string

Jump to

Keyboard shortcuts

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