pb

package
v0.0.0-...-234e2d1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthRaft        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRaft          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRaft = fmt.Errorf("proto: unexpected end of group")
)
View Source
var MessageType_name = map[int32]string{
	0: "MsgUnknown",
	1: "MsgApp",
	2: "MsgAppResp",
	3: "MsgRead",
	4: "MsgReadResp",
	5: "MsgProp",
	6: "MsgPropResp",
	7: "MsgVote",
	8: "MsgVoteResp",
}
View Source
var MessageType_value = map[string]int32{
	"MsgUnknown":  0,
	"MsgApp":      1,
	"MsgAppResp":  2,
	"MsgRead":     3,
	"MsgReadResp": 4,
	"MsgProp":     5,
	"MsgPropResp": 6,
	"MsgVote":     7,
	"MsgVoteResp": 8,
}

Functions

func RegisterRaftProtocolServer

func RegisterRaftProtocolServer(s *grpc.Server, srv RaftProtocolServer)

Types

type Empty

type Empty struct {
}

func (*Empty) Descriptor

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

func (*Empty) Marshal

func (m *Empty) Marshal() (dAtA []byte, err error)

func (*Empty) MarshalTo

func (m *Empty) MarshalTo(dAtA []byte) (int, error)

func (*Empty) MarshalToSizedBuffer

func (m *Empty) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) Size

func (m *Empty) Size() (n int)

func (*Empty) String

func (m *Empty) String() string

func (*Empty) Unmarshal

func (m *Empty) Unmarshal(dAtA []byte) error

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (m *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type Entry

type Entry struct {
	Index uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
	Term  uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
	Data  []byte `protobuf:"bytes,3,opt,name=data" json:"data"`
}

func (*Entry) Descriptor

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

func (*Entry) GetData

func (m *Entry) GetData() []byte

func (*Entry) GetIndex

func (m *Entry) GetIndex() uint64

func (*Entry) GetTerm

func (m *Entry) GetTerm() uint64

func (*Entry) Marshal

func (m *Entry) Marshal() (dAtA []byte, err error)

func (*Entry) MarshalTo

func (m *Entry) MarshalTo(dAtA []byte) (int, error)

func (*Entry) MarshalToSizedBuffer

func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) Reset

func (m *Entry) Reset()

func (*Entry) Size

func (m *Entry) Size() (n int)

func (*Entry) String

func (m *Entry) String() string

func (*Entry) Unmarshal

func (m *Entry) Unmarshal(dAtA []byte) error

func (*Entry) XXX_DiscardUnknown

func (m *Entry) XXX_DiscardUnknown()

func (*Entry) XXX_Marshal

func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Entry) XXX_Merge

func (m *Entry) XXX_Merge(src proto.Message)

func (*Entry) XXX_Size

func (m *Entry) XXX_Size() int

func (*Entry) XXX_Unmarshal

func (m *Entry) XXX_Unmarshal(b []byte) error

type Message

type Message struct {
	Term    uint64      `protobuf:"varint,1,opt,name=term" json:"term"`
	From    uint64      `protobuf:"varint,2,opt,name=from" json:"from"`
	To      uint64      `protobuf:"varint,3,opt,name=to" json:"to"`
	Type    MessageType `protobuf:"varint,4,opt,name=type,enum=pb.MessageType" json:"type"`
	Index   uint64      `protobuf:"varint,5,opt,name=index" json:"index"`
	LogTerm uint64      `protobuf:"varint,6,opt,name=logTerm" json:"logTerm"`
	Commit  uint64      `protobuf:"varint,7,opt,name=commit" json:"commit"`
	Tid     int64       `protobuf:"varint,8,opt,name=tid" json:"tid"`
	Proxy   uint64      `protobuf:"varint,9,opt,name=proxy" json:"proxy"`
	Entries []Entry     `protobuf:"bytes,10,rep,name=entries" json:"entries"`
	Success bool        `protobuf:"varint,11,opt,name=success" json:"success"`
}

func (*Message) Descriptor

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

func (*Message) GetCommit

func (m *Message) GetCommit() uint64

func (*Message) GetEntries

func (m *Message) GetEntries() []Entry

func (*Message) GetFrom

func (m *Message) GetFrom() uint64

func (*Message) GetIndex

func (m *Message) GetIndex() uint64

func (*Message) GetLogTerm

func (m *Message) GetLogTerm() uint64

func (*Message) GetProxy

func (m *Message) GetProxy() uint64

func (*Message) GetSuccess

func (m *Message) GetSuccess() bool

func (*Message) GetTerm

func (m *Message) GetTerm() uint64

func (*Message) GetTid

func (m *Message) GetTid() int64

func (*Message) GetTo

func (m *Message) GetTo() uint64

func (*Message) GetType

func (m *Message) GetType() MessageType

func (*Message) Marshal

func (m *Message) Marshal() (dAtA []byte, err error)

func (*Message) MarshalTo

func (m *Message) MarshalTo(dAtA []byte) (int, error)

func (*Message) MarshalToSizedBuffer

func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) Size

func (m *Message) Size() (n int)

func (*Message) String

func (m *Message) String() string

func (*Message) Unmarshal

func (m *Message) Unmarshal(dAtA []byte) error

func (*Message) XXX_DiscardUnknown

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal

func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Message) XXX_Merge

func (m *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_Size

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal

func (m *Message) XXX_Unmarshal(b []byte) error

type MessageType

type MessageType int32
const (
	MsgUnknown MessageType = 0
	// MsgApp Fields
	// * index:    previous entry index
	// * logTerm:  previous entry term
	// * commit:   leader's commit
	// * tid:      read request context if ConsistencyStrict,
	//             lease start if ConsistencyLease,
	//             otherwise 0
	// * proxy:    read request context, otherwise 0 if none
	// * entries:  entries to append, ignored if there is read request context
	MsgApp MessageType = 1
	// MsgAppResp Fields
	// * index:    index of the largest match index,
	// * tid:      read request context if ConsistencyStrict,
	//             lease start if ConsistencyLease,
	//             otherwise 0
	// * proxy:    read request context if ConsistencyStrict, otherwise 0
	// * success:  whether or not the append request was successful
	MsgAppResp MessageType = 2
	// MsgRead Fields
	// * tid: read request context
	MsgRead MessageType = 3
	// MsgReadResp Fields
	// * tid:   read request context
	// * index: read index
	MsgReadResp MessageType = 4
	// MsgProp Fields
	// * tid:      context associated with a proposal request
	// * entries:  contains only 1 entry, of which only the data field is used
	//             to contain the proposed data
	MsgProp MessageType = 5
	// MsgPropResp Fields
	// * tid:      context associated with a proposal request
	// * index:    index of the successfully proposed entry, 0 if unsuccessful
	// * logTerm:  term of the successfully proposed entry, 0 if unsuccessful
	MsgPropResp MessageType = 6
	// MsgVote Fields
	// * index:   index of the candidate's last entry
	// * logTerm: term of the candidate's last entry
	MsgVote MessageType = 7
	// MsgVoteResp Fields (none)
	MsgVoteResp MessageType = 8
)

func (MessageType) Enum

func (x MessageType) Enum() *MessageType

func (MessageType) EnumDescriptor

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

func (MessageType) String

func (x MessageType) String() string

func (*MessageType) UnmarshalJSON

func (x *MessageType) UnmarshalJSON(data []byte) error

type RaftProtocolClient

type RaftProtocolClient interface {
	Communicate(ctx context.Context, opts ...grpc.CallOption) (RaftProtocol_CommunicateClient, error)
}

RaftProtocolClient is the client API for RaftProtocol service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRaftProtocolClient

func NewRaftProtocolClient(cc *grpc.ClientConn) RaftProtocolClient

type RaftProtocolServer

type RaftProtocolServer interface {
	Communicate(RaftProtocol_CommunicateServer) error
}

RaftProtocolServer is the server API for RaftProtocol service.

type RaftProtocol_CommunicateClient

type RaftProtocol_CommunicateClient interface {
	Send(*Message) error
	CloseAndRecv() (*Empty, error)
	grpc.ClientStream
}

type RaftProtocol_CommunicateServer

type RaftProtocol_CommunicateServer interface {
	SendAndClose(*Empty) error
	Recv() (*Message, error)
	grpc.ServerStream
}

type UnimplementedRaftProtocolServer

type UnimplementedRaftProtocolServer struct {
}

UnimplementedRaftProtocolServer can be embedded to have forward compatible implementations.

func (*UnimplementedRaftProtocolServer) Communicate

Jump to

Keyboard shortcuts

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