代码拉取完成,页面将自动刷新
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: server.proto
package raft4go
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// node 节点信息
type Node struct {
// 节点ID
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// 节点地址
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
// 节点异常次数,异常次数到达或超过3次,则表示该节点异常
UnusualTimes int32 `protobuf:"varint,3,opt,name=unusualTimes,proto3" json:"unusualTimes,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Node) Reset() { *m = Node{} }
func (m *Node) String() string { return proto.CompactTextString(m) }
func (*Node) ProtoMessage() {}
func (*Node) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{0}
}
func (m *Node) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Node.Unmarshal(m, b)
}
func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Node.Marshal(b, m, deterministic)
}
func (m *Node) XXX_Merge(src proto.Message) {
xxx_messageInfo_Node.Merge(m, src)
}
func (m *Node) XXX_Size() int {
return xxx_messageInfo_Node.Size(m)
}
func (m *Node) XXX_DiscardUnknown() {
xxx_messageInfo_Node.DiscardUnknown(m)
}
var xxx_messageInfo_Node proto.InternalMessageInfo
func (m *Node) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Node) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *Node) GetUnusualTimes() int32 {
if m != nil {
return m.UnusualTimes
}
return 0
}
// data 匹配数据对象
type Data struct {
// 数据key
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// 数据hash
Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
// 当前配置版本 index 递增
Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Data) Reset() { *m = Data{} }
func (m *Data) String() string { return proto.CompactTextString(m) }
func (*Data) ProtoMessage() {}
func (*Data) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{1}
}
func (m *Data) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Data.Unmarshal(m, b)
}
func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Data.Marshal(b, m, deterministic)
}
func (m *Data) XXX_Merge(src proto.Message) {
xxx_messageInfo_Data.Merge(m, src)
}
func (m *Data) XXX_Size() int {
return xxx_messageInfo_Data.Size(m)
}
func (m *Data) XXX_DiscardUnknown() {
xxx_messageInfo_Data.DiscardUnknown(m)
}
var xxx_messageInfo_Data proto.InternalMessageInfo
func (m *Data) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *Data) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
func (m *Data) GetVersion() int32 {
if m != nil {
return m.Version
}
return 0
}
// ReqHeartBeat 用于Leader节点复制日志给其他节点,也作为心跳
//
// prevLogIndex和prevLogTerm表示上一次发送的日志的索引和任期,用于保证收到的日志是连续的
type ReqHeartBeat struct {
// 自身作为Leader节点的任期
Term int32 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
// 自身作为Leader节点的ID
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// 自身作为Leader节点的地址
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
// 自身作为Leader节点所有数据集hash,用于比较彼此数据
Hash string `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqHeartBeat) Reset() { *m = ReqHeartBeat{} }
func (m *ReqHeartBeat) String() string { return proto.CompactTextString(m) }
func (*ReqHeartBeat) ProtoMessage() {}
func (*ReqHeartBeat) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{2}
}
func (m *ReqHeartBeat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqHeartBeat.Unmarshal(m, b)
}
func (m *ReqHeartBeat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqHeartBeat.Marshal(b, m, deterministic)
}
func (m *ReqHeartBeat) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqHeartBeat.Merge(m, src)
}
func (m *ReqHeartBeat) XXX_Size() int {
return xxx_messageInfo_ReqHeartBeat.Size(m)
}
func (m *ReqHeartBeat) XXX_DiscardUnknown() {
xxx_messageInfo_ReqHeartBeat.DiscardUnknown(m)
}
var xxx_messageInfo_ReqHeartBeat proto.InternalMessageInfo
func (m *ReqHeartBeat) GetTerm() int32 {
if m != nil {
return m.Term
}
return 0
}
func (m *ReqHeartBeat) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReqHeartBeat) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *ReqHeartBeat) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
// RespHeartBeat 接收者实现逻辑
//
// 返回false,如果收到的任期比当前任期小
//
// 返回false,如果不包含之前的日志条目(没有匹配prevLogIndex和prevLogTerm)
//
// 如果存在index相同但是term不相同的日志,删除从该位置开始所有的日志
//
// 追加所有不存在的日志
//
// 如果leaderCommit>commitIndex,将commitIndex设置为commitIndex = min(leaderCommit, index of last new entry)
type RespHeartBeat struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespHeartBeat) Reset() { *m = RespHeartBeat{} }
func (m *RespHeartBeat) String() string { return proto.CompactTextString(m) }
func (*RespHeartBeat) ProtoMessage() {}
func (*RespHeartBeat) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{3}
}
func (m *RespHeartBeat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespHeartBeat.Unmarshal(m, b)
}
func (m *RespHeartBeat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespHeartBeat.Marshal(b, m, deterministic)
}
func (m *RespHeartBeat) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespHeartBeat.Merge(m, src)
}
func (m *RespHeartBeat) XXX_Size() int {
return xxx_messageInfo_RespHeartBeat.Size(m)
}
func (m *RespHeartBeat) XXX_DiscardUnknown() {
xxx_messageInfo_RespHeartBeat.DiscardUnknown(m)
}
var xxx_messageInfo_RespHeartBeat proto.InternalMessageInfo
// ReqNodeList 请求当前集群节点集合
type ReqNodeList struct {
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqNodeList) Reset() { *m = ReqNodeList{} }
func (m *ReqNodeList) String() string { return proto.CompactTextString(m) }
func (*ReqNodeList) ProtoMessage() {}
func (*ReqNodeList) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{4}
}
func (m *ReqNodeList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqNodeList.Unmarshal(m, b)
}
func (m *ReqNodeList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqNodeList.Marshal(b, m, deterministic)
}
func (m *ReqNodeList) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqNodeList.Merge(m, src)
}
func (m *ReqNodeList) XXX_Size() int {
return xxx_messageInfo_ReqNodeList.Size(m)
}
func (m *ReqNodeList) XXX_DiscardUnknown() {
xxx_messageInfo_ReqNodeList.DiscardUnknown(m)
}
var xxx_messageInfo_ReqNodeList proto.InternalMessageInfo
func (m *ReqNodeList) GetNodes() []*Node {
if m != nil {
return m.Nodes
}
return nil
}
// RespNodeList 应答当前集群节点集合
type RespNodeList struct {
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespNodeList) Reset() { *m = RespNodeList{} }
func (m *RespNodeList) String() string { return proto.CompactTextString(m) }
func (*RespNodeList) ProtoMessage() {}
func (*RespNodeList) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{5}
}
func (m *RespNodeList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespNodeList.Unmarshal(m, b)
}
func (m *RespNodeList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespNodeList.Marshal(b, m, deterministic)
}
func (m *RespNodeList) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespNodeList.Merge(m, src)
}
func (m *RespNodeList) XXX_Size() int {
return xxx_messageInfo_RespNodeList.Size(m)
}
func (m *RespNodeList) XXX_DiscardUnknown() {
xxx_messageInfo_RespNodeList.DiscardUnknown(m)
}
var xxx_messageInfo_RespNodeList proto.InternalMessageInfo
func (m *RespNodeList) GetNodes() []*Node {
if m != nil {
return m.Nodes
}
return nil
}
// ReqDataList 请求当前集群数据集合
type ReqDataList struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqDataList) Reset() { *m = ReqDataList{} }
func (m *ReqDataList) String() string { return proto.CompactTextString(m) }
func (*ReqDataList) ProtoMessage() {}
func (*ReqDataList) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{6}
}
func (m *ReqDataList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqDataList.Unmarshal(m, b)
}
func (m *ReqDataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqDataList.Marshal(b, m, deterministic)
}
func (m *ReqDataList) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqDataList.Merge(m, src)
}
func (m *ReqDataList) XXX_Size() int {
return xxx_messageInfo_ReqDataList.Size(m)
}
func (m *ReqDataList) XXX_DiscardUnknown() {
xxx_messageInfo_ReqDataList.DiscardUnknown(m)
}
var xxx_messageInfo_ReqDataList proto.InternalMessageInfo
// RespDataList 应答当前集群数据集合
type RespDataList struct {
DataArr []*Data `protobuf:"bytes,1,rep,name=dataArr,proto3" json:"dataArr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespDataList) Reset() { *m = RespDataList{} }
func (m *RespDataList) String() string { return proto.CompactTextString(m) }
func (*RespDataList) ProtoMessage() {}
func (*RespDataList) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{7}
}
func (m *RespDataList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespDataList.Unmarshal(m, b)
}
func (m *RespDataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespDataList.Marshal(b, m, deterministic)
}
func (m *RespDataList) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespDataList.Merge(m, src)
}
func (m *RespDataList) XXX_Size() int {
return xxx_messageInfo_RespDataList.Size(m)
}
func (m *RespDataList) XXX_DiscardUnknown() {
xxx_messageInfo_RespDataList.DiscardUnknown(m)
}
var xxx_messageInfo_RespDataList proto.InternalMessageInfo
func (m *RespDataList) GetDataArr() []*Data {
if m != nil {
return m.DataArr
}
return nil
}
// ReqData 请求当前集群指定key数据
type ReqData struct {
// 数据key
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqData) Reset() { *m = ReqData{} }
func (m *ReqData) String() string { return proto.CompactTextString(m) }
func (*ReqData) ProtoMessage() {}
func (*ReqData) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{8}
}
func (m *ReqData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqData.Unmarshal(m, b)
}
func (m *ReqData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqData.Marshal(b, m, deterministic)
}
func (m *ReqData) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqData.Merge(m, src)
}
func (m *ReqData) XXX_Size() int {
return xxx_messageInfo_ReqData.Size(m)
}
func (m *ReqData) XXX_DiscardUnknown() {
xxx_messageInfo_ReqData.DiscardUnknown(m)
}
var xxx_messageInfo_ReqData proto.InternalMessageInfo
func (m *ReqData) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
// RespData 应答当前集群指定key数据
type RespData struct {
// 当前集群指定key数据信息的值
Value []byte `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespData) Reset() { *m = RespData{} }
func (m *RespData) String() string { return proto.CompactTextString(m) }
func (*RespData) ProtoMessage() {}
func (*RespData) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{9}
}
func (m *RespData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespData.Unmarshal(m, b)
}
func (m *RespData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespData.Marshal(b, m, deterministic)
}
func (m *RespData) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespData.Merge(m, src)
}
func (m *RespData) XXX_Size() int {
return xxx_messageInfo_RespData.Size(m)
}
func (m *RespData) XXX_DiscardUnknown() {
xxx_messageInfo_RespData.DiscardUnknown(m)
}
var xxx_messageInfo_RespData proto.InternalMessageInfo
func (m *RespData) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// ReqSyncData 用于Leader节点同步数据给其他节点
type ReqSyncData struct {
// Leader节点的任期
Term int32 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
// Leader节点的ID
LeaderId string `protobuf:"bytes,2,opt,name=leaderId,proto3" json:"leaderId,omitempty"`
// Leader节点的地址
LeaderUrl string `protobuf:"bytes,3,opt,name=leaderUrl,proto3" json:"leaderUrl,omitempty"`
// 当前配置版本 index 递增
Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
// 当前term同步配置信息的key
Key string `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"`
// 当前term同步配置信息的值
Value []byte `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqSyncData) Reset() { *m = ReqSyncData{} }
func (m *ReqSyncData) String() string { return proto.CompactTextString(m) }
func (*ReqSyncData) ProtoMessage() {}
func (*ReqSyncData) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{10}
}
func (m *ReqSyncData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqSyncData.Unmarshal(m, b)
}
func (m *ReqSyncData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqSyncData.Marshal(b, m, deterministic)
}
func (m *ReqSyncData) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqSyncData.Merge(m, src)
}
func (m *ReqSyncData) XXX_Size() int {
return xxx_messageInfo_ReqSyncData.Size(m)
}
func (m *ReqSyncData) XXX_DiscardUnknown() {
xxx_messageInfo_ReqSyncData.DiscardUnknown(m)
}
var xxx_messageInfo_ReqSyncData proto.InternalMessageInfo
func (m *ReqSyncData) GetTerm() int32 {
if m != nil {
return m.Term
}
return 0
}
func (m *ReqSyncData) GetLeaderId() string {
if m != nil {
return m.LeaderId
}
return ""
}
func (m *ReqSyncData) GetLeaderUrl() string {
if m != nil {
return m.LeaderUrl
}
return ""
}
func (m *ReqSyncData) GetVersion() int32 {
if m != nil {
return m.Version
}
return 0
}
func (m *ReqSyncData) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *ReqSyncData) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// RespSyncData 接收者实现逻辑
//
// 返回false,如果收到的任期比当前任期小
//
// 返回false,如果不包含之前的日志条目(没有匹配prevLogIndex和prevLogTerm)
//
// 如果存在index相同但是term不相同的日志,删除从该位置开始所有的日志
//
// 追加所有不存在的日志
//
// 如果leaderCommit>commitIndex,将commitIndex设置为commitIndex = min(leaderCommit, index of last new entry)
type RespSyncData struct {
// 当前任期号,用于Leader节点更新自己的任期(应该说是如果这个返回值比Leader自身的任期大,那么Leader需要更新自己的任期)
Term int32 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
// 如果Follower节点匹配prevLogIndex和prevLogTerm,返回true
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespSyncData) Reset() { *m = RespSyncData{} }
func (m *RespSyncData) String() string { return proto.CompactTextString(m) }
func (*RespSyncData) ProtoMessage() {}
func (*RespSyncData) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{11}
}
func (m *RespSyncData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespSyncData.Unmarshal(m, b)
}
func (m *RespSyncData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespSyncData.Marshal(b, m, deterministic)
}
func (m *RespSyncData) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespSyncData.Merge(m, src)
}
func (m *RespSyncData) XXX_Size() int {
return xxx_messageInfo_RespSyncData.Size(m)
}
func (m *RespSyncData) XXX_DiscardUnknown() {
xxx_messageInfo_RespSyncData.DiscardUnknown(m)
}
var xxx_messageInfo_RespSyncData proto.InternalMessageInfo
func (m *RespSyncData) GetTerm() int32 {
if m != nil {
return m.Term
}
return 0
}
func (m *RespSyncData) GetSuccess() bool {
if m != nil {
return m.Success
}
return false
}
// reqVote 用于Candidate获取选票
type ReqVote struct {
// Candidate的ID
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// Candidate的URL
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
// Candidate的任期
Term int32 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
// 时间戳ns
Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqVote) Reset() { *m = ReqVote{} }
func (m *ReqVote) String() string { return proto.CompactTextString(m) }
func (*ReqVote) ProtoMessage() {}
func (*ReqVote) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{12}
}
func (m *ReqVote) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqVote.Unmarshal(m, b)
}
func (m *ReqVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqVote.Marshal(b, m, deterministic)
}
func (m *ReqVote) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqVote.Merge(m, src)
}
func (m *ReqVote) XXX_Size() int {
return xxx_messageInfo_ReqVote.Size(m)
}
func (m *ReqVote) XXX_DiscardUnknown() {
xxx_messageInfo_ReqVote.DiscardUnknown(m)
}
var xxx_messageInfo_ReqVote proto.InternalMessageInfo
func (m *ReqVote) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReqVote) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *ReqVote) GetTerm() int32 {
if m != nil {
return m.Term
}
return 0
}
func (m *ReqVote) GetTimestamp() int64 {
if m != nil {
return m.Timestamp
}
return 0
}
// 接收者的实现逻辑
//
// 返回false,如果收到的任期比当前任期小
//
// 如果本地状态中votedFor为null或者candidateId,且candidate的日志等于或多余(按照index判断)接收者的日志,则接收者投票给candidate,即返回true
type RespVote struct {
// true表示给Candidate投票
VoteGranted bool `protobuf:"varint,2,opt,name=voteGranted,proto3" json:"voteGranted,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RespVote) Reset() { *m = RespVote{} }
func (m *RespVote) String() string { return proto.CompactTextString(m) }
func (*RespVote) ProtoMessage() {}
func (*RespVote) Descriptor() ([]byte, []int) {
return fileDescriptor_ad098daeda4239f7, []int{13}
}
func (m *RespVote) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RespVote.Unmarshal(m, b)
}
func (m *RespVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RespVote.Marshal(b, m, deterministic)
}
func (m *RespVote) XXX_Merge(src proto.Message) {
xxx_messageInfo_RespVote.Merge(m, src)
}
func (m *RespVote) XXX_Size() int {
return xxx_messageInfo_RespVote.Size(m)
}
func (m *RespVote) XXX_DiscardUnknown() {
xxx_messageInfo_RespVote.DiscardUnknown(m)
}
var xxx_messageInfo_RespVote proto.InternalMessageInfo
func (m *RespVote) GetVoteGranted() bool {
if m != nil {
return m.VoteGranted
}
return false
}
func init() {
proto.RegisterType((*Node)(nil), "raft4go.Node")
proto.RegisterType((*Data)(nil), "raft4go.Data")
proto.RegisterType((*ReqHeartBeat)(nil), "raft4go.ReqHeartBeat")
proto.RegisterType((*RespHeartBeat)(nil), "raft4go.RespHeartBeat")
proto.RegisterType((*ReqNodeList)(nil), "raft4go.ReqNodeList")
proto.RegisterType((*RespNodeList)(nil), "raft4go.RespNodeList")
proto.RegisterType((*ReqDataList)(nil), "raft4go.ReqDataList")
proto.RegisterType((*RespDataList)(nil), "raft4go.RespDataList")
proto.RegisterType((*ReqData)(nil), "raft4go.ReqData")
proto.RegisterType((*RespData)(nil), "raft4go.RespData")
proto.RegisterType((*ReqSyncData)(nil), "raft4go.ReqSyncData")
proto.RegisterType((*RespSyncData)(nil), "raft4go.RespSyncData")
proto.RegisterType((*ReqVote)(nil), "raft4go.ReqVote")
proto.RegisterType((*RespVote)(nil), "raft4go.RespVote")
}
func init() {
proto.RegisterFile("server.proto", fileDescriptor_ad098daeda4239f7)
}
var fileDescriptor_ad098daeda4239f7 = []byte{
// 517 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4b, 0x8f, 0xd3, 0x3c,
0x14, 0x6d, 0x5e, 0x93, 0xf6, 0xb6, 0xfd, 0x3e, 0xb0, 0x3a, 0x28, 0x2a, 0xb3, 0x88, 0xcc, 0x82,
0x2c, 0xa0, 0x8b, 0x0e, 0x12, 0x42, 0x9a, 0x0d, 0x08, 0xf1, 0x90, 0x46, 0x2c, 0xcc, 0x43, 0x6c,
0x58, 0x78, 0x9a, 0x3b, 0x4c, 0x44, 0x9b, 0x74, 0x6c, 0xa7, 0xd2, 0xfc, 0x18, 0x7e, 0x15, 0x7f,
0x08, 0xd9, 0x89, 0xf3, 0x68, 0x2b, 0x04, 0x3b, 0xdf, 0x13, 0x9f, 0x73, 0x8f, 0x8e, 0x4f, 0x0b,
0x13, 0x89, 0x62, 0x87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0xd4, 0xfe, 0x1e, 0xbb, 0x34, 0x8d, 0xcc, 0xef, 0xf7, 0x28, 0x1a,
0xaa, 0x36, 0x35, 0x7d, 0x9c, 0xed, 0x53, 0x8e, 0x6c, 0x6a, 0xca, 0x6c, 0xa8, 0xcd, 0x93, 0xf5,
0xa8, 0x16, 0xdd, 0xa3, 0x5a, 0xb8, 0x32, 0x69, 0x02, 0xed, 0x99, 0xd4, 0xc8, 0x9e, 0x49, 0x0d,
0xd1, 0xc1, 0xd5, 0x89, 0xf9, 0x07, 0x3b, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xcc, 0x28,
0x57, 0xd1, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// RaftClient is the client API for Raft service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type RaftClient interface {
// Heartbeat 发送心跳
Heartbeat(ctx context.Context, in *ReqHeartBeat, opts ...grpc.CallOption) (*RespHeartBeat, error)
// NodeList 请求集群节点集合
NodeList(ctx context.Context, in *ReqNodeList, opts ...grpc.CallOption) (*RespNodeList, error)
// Data 请求当前集群指定key数据
Data(ctx context.Context, in *ReqData, opts ...grpc.CallOption) (*RespData, error)
// DataList 请求集群数据集合
DataList(ctx context.Context, in *ReqDataList, opts ...grpc.CallOption) (*RespDataList, error)
// SyncData 同步数据
SyncData(ctx context.Context, in *ReqSyncData, opts ...grpc.CallOption) (*RespSyncData, error)
// Vote 发起选举,索要选票
Vote(ctx context.Context, in *ReqVote, opts ...grpc.CallOption) (*RespVote, error)
}
type raftClient struct {
cc grpc.ClientConnInterface
}
func NewRaftClient(cc grpc.ClientConnInterface) RaftClient {
return &raftClient{cc}
}
func (c *raftClient) Heartbeat(ctx context.Context, in *ReqHeartBeat, opts ...grpc.CallOption) (*RespHeartBeat, error) {
out := new(RespHeartBeat)
err := c.cc.Invoke(ctx, "/raft4go.Raft/Heartbeat", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *raftClient) NodeList(ctx context.Context, in *ReqNodeList, opts ...grpc.CallOption) (*RespNodeList, error) {
out := new(RespNodeList)
err := c.cc.Invoke(ctx, "/raft4go.Raft/NodeList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *raftClient) Data(ctx context.Context, in *ReqData, opts ...grpc.CallOption) (*RespData, error) {
out := new(RespData)
err := c.cc.Invoke(ctx, "/raft4go.Raft/Data", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *raftClient) DataList(ctx context.Context, in *ReqDataList, opts ...grpc.CallOption) (*RespDataList, error) {
out := new(RespDataList)
err := c.cc.Invoke(ctx, "/raft4go.Raft/DataList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *raftClient) SyncData(ctx context.Context, in *ReqSyncData, opts ...grpc.CallOption) (*RespSyncData, error) {
out := new(RespSyncData)
err := c.cc.Invoke(ctx, "/raft4go.Raft/SyncData", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *raftClient) Vote(ctx context.Context, in *ReqVote, opts ...grpc.CallOption) (*RespVote, error) {
out := new(RespVote)
err := c.cc.Invoke(ctx, "/raft4go.Raft/Vote", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RaftServer is the server API for Raft service.
type RaftServer interface {
// Heartbeat 发送心跳
Heartbeat(context.Context, *ReqHeartBeat) (*RespHeartBeat, error)
// NodeList 请求集群节点集合
NodeList(context.Context, *ReqNodeList) (*RespNodeList, error)
// Data 请求当前集群指定key数据
Data(context.Context, *ReqData) (*RespData, error)
// DataList 请求集群数据集合
DataList(context.Context, *ReqDataList) (*RespDataList, error)
// SyncData 同步数据
SyncData(context.Context, *ReqSyncData) (*RespSyncData, error)
// Vote 发起选举,索要选票
Vote(context.Context, *ReqVote) (*RespVote, error)
}
// UnimplementedRaftServer can be embedded to have forward compatible implementations.
type UnimplementedRaftServer struct {
}
func (*UnimplementedRaftServer) Heartbeat(ctx context.Context, req *ReqHeartBeat) (*RespHeartBeat, error) {
return nil, status.Errorf(codes.Unimplemented, "method Heartbeat not implemented")
}
func (*UnimplementedRaftServer) NodeList(ctx context.Context, req *ReqNodeList) (*RespNodeList, error) {
return nil, status.Errorf(codes.Unimplemented, "method NodeList not implemented")
}
func (*UnimplementedRaftServer) Data(ctx context.Context, req *ReqData) (*RespData, error) {
return nil, status.Errorf(codes.Unimplemented, "method Data not implemented")
}
func (*UnimplementedRaftServer) DataList(ctx context.Context, req *ReqDataList) (*RespDataList, error) {
return nil, status.Errorf(codes.Unimplemented, "method DataList not implemented")
}
func (*UnimplementedRaftServer) SyncData(ctx context.Context, req *ReqSyncData) (*RespSyncData, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncData not implemented")
}
func (*UnimplementedRaftServer) Vote(ctx context.Context, req *ReqVote) (*RespVote, error) {
return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented")
}
func RegisterRaftServer(s *grpc.Server, srv RaftServer) {
s.RegisterService(&_Raft_serviceDesc, srv)
}
func _Raft_Heartbeat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqHeartBeat)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).Heartbeat(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/Heartbeat",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).Heartbeat(ctx, req.(*ReqHeartBeat))
}
return interceptor(ctx, in, info, handler)
}
func _Raft_NodeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqNodeList)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).NodeList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/NodeList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).NodeList(ctx, req.(*ReqNodeList))
}
return interceptor(ctx, in, info, handler)
}
func _Raft_Data_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqData)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).Data(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/Data",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).Data(ctx, req.(*ReqData))
}
return interceptor(ctx, in, info, handler)
}
func _Raft_DataList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqDataList)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).DataList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/DataList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).DataList(ctx, req.(*ReqDataList))
}
return interceptor(ctx, in, info, handler)
}
func _Raft_SyncData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqSyncData)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).SyncData(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/SyncData",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).SyncData(ctx, req.(*ReqSyncData))
}
return interceptor(ctx, in, info, handler)
}
func _Raft_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqVote)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RaftServer).Vote(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/raft4go.Raft/Vote",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RaftServer).Vote(ctx, req.(*ReqVote))
}
return interceptor(ctx, in, info, handler)
}
var _Raft_serviceDesc = grpc.ServiceDesc{
ServiceName: "raft4go.Raft",
HandlerType: (*RaftServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Heartbeat",
Handler: _Raft_Heartbeat_Handler,
},
{
MethodName: "NodeList",
Handler: _Raft_NodeList_Handler,
},
{
MethodName: "Data",
Handler: _Raft_Data_Handler,
},
{
MethodName: "DataList",
Handler: _Raft_DataList_Handler,
},
{
MethodName: "SyncData",
Handler: _Raft_SyncData_Handler,
},
{
MethodName: "Vote",
Handler: _Raft_Vote_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "server.proto",
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。