Documentation ¶
Index ¶
- Variables
- func RegisterRaftProtocolServer(s *grpc.Server, srv RaftProtocolServer)
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (m *Empty) Marshal() (dAtA []byte, err error)
- func (m *Empty) MarshalTo(dAtA []byte) (int, error)
- func (m *Empty) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) Size() (n int)
- func (m *Empty) String() string
- func (m *Empty) Unmarshal(dAtA []byte) error
- func (m *Empty) XXX_DiscardUnknown()
- func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Empty) XXX_Merge(src proto.Message)
- func (m *Empty) XXX_Size() int
- func (m *Empty) XXX_Unmarshal(b []byte) error
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetData() []byte
- func (m *Entry) GetIndex() uint64
- func (m *Entry) GetTerm() uint64
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) Size() (n int)
- func (m *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetCommit() uint64
- func (m *Message) GetEntries() []Entry
- func (m *Message) GetFrom() uint64
- func (m *Message) GetIndex() uint64
- func (m *Message) GetLogTerm() uint64
- func (m *Message) GetProxy() uint64
- func (m *Message) GetSuccess() bool
- func (m *Message) GetTerm() uint64
- func (m *Message) GetTid() int64
- func (m *Message) GetTo() uint64
- func (m *Message) GetType() MessageType
- func (m *Message) Marshal() (dAtA []byte, err error)
- func (m *Message) MarshalTo(dAtA []byte) (int, error)
- func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (m *Message) String() string
- func (m *Message) Unmarshal(dAtA []byte) error
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type MessageType
- type RaftProtocolClient
- type RaftProtocolServer
- type RaftProtocol_CommunicateClient
- type RaftProtocol_CommunicateServer
- type UnimplementedRaftProtocolServer
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) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) XXX_DiscardUnknown ¶
func (m *Empty) XXX_DiscardUnknown()
func (*Empty) XXX_Marshal ¶
func (*Empty) XXX_Unmarshal ¶
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) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶
func (*Entry) XXX_Unmarshal ¶
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) GetEntries ¶
func (*Message) GetLogTerm ¶
func (*Message) GetSuccess ¶
func (*Message) GetType ¶
func (m *Message) GetType() MessageType
func (*Message) MarshalToSizedBuffer ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
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 UnimplementedRaftProtocolServer ¶
type UnimplementedRaftProtocolServer struct { }
UnimplementedRaftProtocolServer can be embedded to have forward compatible implementations.
func (*UnimplementedRaftProtocolServer) Communicate ¶
func (*UnimplementedRaftProtocolServer) Communicate(srv RaftProtocol_CommunicateServer) error
Click to show internal directories.
Click to hide internal directories.