...
Package v3electionpb
Overview ▹
Index ▹
Variables
var ( ErrInvalidLengthV3Election = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowV3Election = fmt.Errorf("proto: integer overflow") )
func RegisterElectionServer ¶
func RegisterElectionServer(s *grpc.Server, srv ElectionServer)
type CampaignRequest ¶
type CampaignRequest struct { // name is the election's identifier for the campaign. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // lease is the ID of the lease attached to leadership of the election. If the // lease expires or is revoked before resigning leadership, then the // leadership is transferred to the next campaigner, if any. Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"` // value is the initial proclaimed value set when the campaigner wins the // election. Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` }
func (*CampaignRequest) Descriptor ¶
func (*CampaignRequest) Descriptor() ([]byte, []int)
func (*CampaignRequest) Marshal ¶
func (m *CampaignRequest) Marshal() (dAtA []byte, err error)
func (*CampaignRequest) MarshalTo ¶
func (m *CampaignRequest) MarshalTo(dAtA []byte) (int, error)
func (*CampaignRequest) ProtoMessage ¶
func (*CampaignRequest) ProtoMessage()
func (*CampaignRequest) Reset ¶
func (m *CampaignRequest) Reset()
func (*CampaignRequest) Size ¶
func (m *CampaignRequest) Size() (n int)
func (*CampaignRequest) String ¶
func (m *CampaignRequest) String() string
func (*CampaignRequest) Unmarshal ¶
func (m *CampaignRequest) Unmarshal(dAtA []byte) error
type CampaignResponse ¶
type CampaignResponse struct {
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
// leader describes the resources used for holding leadereship of the election.
Leader *LeaderKey `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"`
}
func (*CampaignResponse) Descriptor ¶
func (*CampaignResponse) Descriptor() ([]byte, []int)
func (*CampaignResponse) GetHeader ¶
func (m *CampaignResponse) GetHeader() *etcdserverpb.ResponseHeader
func (*CampaignResponse) GetLeader ¶
func (m *CampaignResponse) GetLeader() *LeaderKey
func (*CampaignResponse) Marshal ¶
func (m *CampaignResponse) Marshal() (dAtA []byte, err error)
func (*CampaignResponse) MarshalTo ¶
func (m *CampaignResponse) MarshalTo(dAtA []byte) (int, error)
func (*CampaignResponse) ProtoMessage ¶
func (*CampaignResponse) ProtoMessage()
func (*CampaignResponse) Reset ¶
func (m *CampaignResponse) Reset()
func (*CampaignResponse) Size ¶
func (m *CampaignResponse) Size() (n int)
func (*CampaignResponse) String ¶
func (m *CampaignResponse) String() string
func (*CampaignResponse) Unmarshal ¶
func (m *CampaignResponse) Unmarshal(dAtA []byte) error
type ElectionClient ¶
type ElectionClient interface { // Campaign waits to acquire leadership in an election, returning a LeaderKey // representing the leadership if successful. The LeaderKey can then be used // to issue new values on the election, transactionally guard API requests on // leadership still being held, and resign from the election. Campaign(ctx context.Context, in *CampaignRequest, opts ...grpc.CallOption) (*CampaignResponse, error) // Proclaim updates the leader's posted value with a new value. Proclaim(ctx context.Context, in *ProclaimRequest, opts ...grpc.CallOption) (*ProclaimResponse, error) // Leader returns the current election proclamation, if any. Leader(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderResponse, error) // Observe streams election proclamations in-order as made by the election's // elected leaders. Observe(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (Election_ObserveClient, error) // Resign releases election leadership so other campaigners may acquire // leadership on the election. Resign(ctx context.Context, in *ResignRequest, opts ...grpc.CallOption) (*ResignResponse, error) }
func NewElectionClient ¶
func NewElectionClient(cc *grpc.ClientConn) ElectionClient
type ElectionServer ¶
type ElectionServer interface { // Campaign waits to acquire leadership in an election, returning a LeaderKey // representing the leadership if successful. The LeaderKey can then be used // to issue new values on the election, transactionally guard API requests on // leadership still being held, and resign from the election. Campaign(context.Context, *CampaignRequest) (*CampaignResponse, error) // Proclaim updates the leader's posted value with a new value. Proclaim(context.Context, *ProclaimRequest) (*ProclaimResponse, error) // Leader returns the current election proclamation, if any. Leader(context.Context, *LeaderRequest) (*LeaderResponse, error) // Observe streams election proclamations in-order as made by the election's // elected leaders. Observe(*LeaderRequest, Election_ObserveServer) error // Resign releases election leadership so other campaigners may acquire // leadership on the election. Resign(context.Context, *ResignRequest) (*ResignResponse, error) }
type Election_ObserveClient ¶
type Election_ObserveClient interface { Recv() (*LeaderResponse, error) grpc.ClientStream }
type Election_ObserveServer ¶
type Election_ObserveServer interface { Send(*LeaderResponse) error grpc.ServerStream }
type LeaderKey ¶
type LeaderKey struct { // name is the election identifier that correponds to the leadership key. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // key is an opaque key representing the ownership of the election. If the key // is deleted, then leadership is lost. Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // rev is the creation revision of the key. It can be used to test for ownership // of an election during transactions by testing the key's creation revision // matches rev. Rev int64 `protobuf:"varint,3,opt,name=rev,proto3" json:"rev,omitempty"` // lease is the lease ID of the election leader. Lease int64 `protobuf:"varint,4,opt,name=lease,proto3" json:"lease,omitempty"` }
func (*LeaderKey) Descriptor ¶
func (*LeaderKey) Descriptor() ([]byte, []int)
func (*LeaderKey) Marshal ¶
func (m *LeaderKey) Marshal() (dAtA []byte, err error)
func (*LeaderKey) MarshalTo ¶
func (m *LeaderKey) MarshalTo(dAtA []byte) (int, error)
func (*LeaderKey) ProtoMessage ¶
func (*LeaderKey) ProtoMessage()
func (*LeaderKey) Reset ¶
func (m *LeaderKey) Reset()
func (*LeaderKey) Size ¶
func (m *LeaderKey) Size() (n int)
func (*LeaderKey) String ¶
func (m *LeaderKey) String() string
func (*LeaderKey) Unmarshal ¶
func (m *LeaderKey) Unmarshal(dAtA []byte) error
type LeaderRequest ¶
type LeaderRequest struct {
// name is the election identifier for the leadership information.
Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (*LeaderRequest) Descriptor ¶
func (*LeaderRequest) Descriptor() ([]byte, []int)
func (*LeaderRequest) Marshal ¶
func (m *LeaderRequest) Marshal() (dAtA []byte, err error)
func (*LeaderRequest) MarshalTo ¶
func (m *LeaderRequest) MarshalTo(dAtA []byte) (int, error)
func (*LeaderRequest) ProtoMessage ¶
func (*LeaderRequest) ProtoMessage()
func (*LeaderRequest) Reset ¶
func (m *LeaderRequest) Reset()
func (*LeaderRequest) Size ¶
func (m *LeaderRequest) Size() (n int)
func (*LeaderRequest) String ¶
func (m *LeaderRequest) String() string
func (*LeaderRequest) Unmarshal ¶
func (m *LeaderRequest) Unmarshal(dAtA []byte) error
type LeaderResponse ¶
type LeaderResponse struct {
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
// kv is the key-value pair representing the latest leader update.
Kv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv,omitempty"`
}
func (*LeaderResponse) Descriptor ¶
func (*LeaderResponse) Descriptor() ([]byte, []int)
func (*LeaderResponse) GetHeader ¶
func (m *LeaderResponse) GetHeader() *etcdserverpb.ResponseHeader
func (*LeaderResponse) GetKv ¶
func (m *LeaderResponse) GetKv() *mvccpb.KeyValue
func (*LeaderResponse) Marshal ¶
func (m *LeaderResponse) Marshal() (dAtA []byte, err error)
func (*LeaderResponse) MarshalTo ¶
func (m *LeaderResponse) MarshalTo(dAtA []byte) (int, error)
func (*LeaderResponse) ProtoMessage ¶
func (*LeaderResponse) ProtoMessage()
func (*LeaderResponse) Reset ¶
func (m *LeaderResponse) Reset()
func (*LeaderResponse) Size ¶
func (m *LeaderResponse) Size() (n int)
func (*LeaderResponse) String ¶
func (m *LeaderResponse) String() string
func (*LeaderResponse) Unmarshal ¶
func (m *LeaderResponse) Unmarshal(dAtA []byte) error
type ProclaimRequest ¶
type ProclaimRequest struct { // leader is the leadership hold on the election. Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` // value is an update meant to overwrite the leader's current value. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
func (*ProclaimRequest) Descriptor ¶
func (*ProclaimRequest) Descriptor() ([]byte, []int)
func (*ProclaimRequest) GetLeader ¶
func (m *ProclaimRequest) GetLeader() *LeaderKey
func (*ProclaimRequest) Marshal ¶
func (m *ProclaimRequest) Marshal() (dAtA []byte, err error)
func (*ProclaimRequest) MarshalTo ¶
func (m *ProclaimRequest) MarshalTo(dAtA []byte) (int, error)
func (*ProclaimRequest) ProtoMessage ¶
func (*ProclaimRequest) ProtoMessage()
func (*ProclaimRequest) Reset ¶
func (m *ProclaimRequest) Reset()
func (*ProclaimRequest) Size ¶
func (m *ProclaimRequest) Size() (n int)
func (*ProclaimRequest) String ¶
func (m *ProclaimRequest) String() string
func (*ProclaimRequest) Unmarshal ¶
func (m *ProclaimRequest) Unmarshal(dAtA []byte) error
type ProclaimResponse ¶
type ProclaimResponse struct { Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` }
func (*ProclaimResponse) Descriptor ¶
func (*ProclaimResponse) Descriptor() ([]byte, []int)
func (*ProclaimResponse) GetHeader ¶
func (m *ProclaimResponse) GetHeader() *etcdserverpb.ResponseHeader
func (*ProclaimResponse) Marshal ¶
func (m *ProclaimResponse) Marshal() (dAtA []byte, err error)
func (*ProclaimResponse) MarshalTo ¶
func (m *ProclaimResponse) MarshalTo(dAtA []byte) (int, error)
func (*ProclaimResponse) ProtoMessage ¶
func (*ProclaimResponse) ProtoMessage()
func (*ProclaimResponse) Reset ¶
func (m *ProclaimResponse) Reset()
func (*ProclaimResponse) Size ¶
func (m *ProclaimResponse) Size() (n int)
func (*ProclaimResponse) String ¶
func (m *ProclaimResponse) String() string
func (*ProclaimResponse) Unmarshal ¶
func (m *ProclaimResponse) Unmarshal(dAtA []byte) error
type ResignRequest ¶
type ResignRequest struct {
// leader is the leadership to relinquish by resignation.
Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"`
}
func (*ResignRequest) Descriptor ¶
func (*ResignRequest) Descriptor() ([]byte, []int)
func (*ResignRequest) GetLeader ¶
func (m *ResignRequest) GetLeader() *LeaderKey
func (*ResignRequest) Marshal ¶
func (m *ResignRequest) Marshal() (dAtA []byte, err error)
func (*ResignRequest) MarshalTo ¶
func (m *ResignRequest) MarshalTo(dAtA []byte) (int, error)
func (*ResignRequest) ProtoMessage ¶
func (*ResignRequest) ProtoMessage()
func (*ResignRequest) Reset ¶
func (m *ResignRequest) Reset()
func (*ResignRequest) Size ¶
func (m *ResignRequest) Size() (n int)
func (*ResignRequest) String ¶
func (m *ResignRequest) String() string
func (*ResignRequest) Unmarshal ¶
func (m *ResignRequest) Unmarshal(dAtA []byte) error
type ResignResponse ¶
type ResignResponse struct { Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` }
func (*ResignResponse) Descriptor ¶
func (*ResignResponse) Descriptor() ([]byte, []int)
func (*ResignResponse) GetHeader ¶
func (m *ResignResponse) GetHeader() *etcdserverpb.ResponseHeader
func (*ResignResponse) Marshal ¶
func (m *ResignResponse) Marshal() (dAtA []byte, err error)
func (*ResignResponse) MarshalTo ¶
func (m *ResignResponse) MarshalTo(dAtA []byte) (int, error)
func (*ResignResponse) ProtoMessage ¶
func (*ResignResponse) ProtoMessage()
func (*ResignResponse) Reset ¶
func (m *ResignResponse) Reset()
func (*ResignResponse) Size ¶
func (m *ResignResponse) Size() (n int)
func (*ResignResponse) String ¶
func (m *ResignResponse) String() string
func (*ResignResponse) Unmarshal ¶
func (m *ResignResponse) Unmarshal(dAtA []byte) error