Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthV3Election = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowV3Election   = fmt.Errorf("proto: integer overflow")
)

Functions

func RegisterElectionServer

func RegisterElectionServer(s *grpc.Server, srv ElectionServer)

Types

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CampaignRequest) Descriptor

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

func (*CampaignRequest) GetLease

func (m *CampaignRequest) GetLease() int64

func (*CampaignRequest) GetName

func (m *CampaignRequest) GetName() []byte

func (*CampaignRequest) GetValue

func (m *CampaignRequest) GetValue() []byte

func (*CampaignRequest) Marshal

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

func (*CampaignRequest) MarshalTo

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

func (*CampaignRequest) MarshalToSizedBuffer

func (m *CampaignRequest) MarshalToSizedBuffer(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

func (*CampaignRequest) XXX_DiscardUnknown

func (m *CampaignRequest) XXX_DiscardUnknown()

func (*CampaignRequest) XXX_Marshal

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

func (*CampaignRequest) XXX_Merge

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

func (*CampaignRequest) XXX_Size

func (m *CampaignRequest) XXX_Size() int

func (*CampaignRequest) XXX_Unmarshal

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

type CampaignResponse

type CampaignResponse struct {
	Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// leader describes the resources used for holding leadereship of the election.
	Leader               *LeaderKey `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*CampaignResponse) Descriptor

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

func (*CampaignResponse) GetHeader

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) MarshalToSizedBuffer

func (m *CampaignResponse) MarshalToSizedBuffer(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

func (*CampaignResponse) XXX_DiscardUnknown

func (m *CampaignResponse) XXX_DiscardUnknown()

func (*CampaignResponse) XXX_Marshal

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

func (*CampaignResponse) XXX_Merge

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

func (*CampaignResponse) XXX_Size

func (m *CampaignResponse) XXX_Size() int

func (*CampaignResponse) XXX_Unmarshal

func (m *CampaignResponse) XXX_Unmarshal(b []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)
}

    ElectionClient is the client API for Election service.

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

    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)
    }

      ElectionServer is the server API for Election service.

      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"`
      	XXX_NoUnkeyedLiteral struct{} `json:"-"`
      	XXX_unrecognized     []byte   `json:"-"`
      	XXX_sizecache        int32    `json:"-"`
      }

      func (*LeaderKey) Descriptor

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

      func (*LeaderKey) GetKey

      func (m *LeaderKey) GetKey() []byte

      func (*LeaderKey) GetLease

      func (m *LeaderKey) GetLease() int64

      func (*LeaderKey) GetName

      func (m *LeaderKey) GetName() []byte

      func (*LeaderKey) GetRev

      func (m *LeaderKey) GetRev() int64

      func (*LeaderKey) Marshal

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

      func (*LeaderKey) MarshalTo

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

      func (*LeaderKey) MarshalToSizedBuffer

      func (m *LeaderKey) MarshalToSizedBuffer(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

      func (*LeaderKey) XXX_DiscardUnknown

      func (m *LeaderKey) XXX_DiscardUnknown()

      func (*LeaderKey) XXX_Marshal

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

      func (*LeaderKey) XXX_Merge

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

      func (*LeaderKey) XXX_Size

      func (m *LeaderKey) XXX_Size() int

      func (*LeaderKey) XXX_Unmarshal

      func (m *LeaderKey) XXX_Unmarshal(b []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"`
      	XXX_NoUnkeyedLiteral struct{} `json:"-"`
      	XXX_unrecognized     []byte   `json:"-"`
      	XXX_sizecache        int32    `json:"-"`
      }

      func (*LeaderRequest) Descriptor

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

      func (*LeaderRequest) GetName

      func (m *LeaderRequest) GetName() []byte

      func (*LeaderRequest) Marshal

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

      func (*LeaderRequest) MarshalTo

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

      func (*LeaderRequest) MarshalToSizedBuffer

      func (m *LeaderRequest) MarshalToSizedBuffer(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

      func (*LeaderRequest) XXX_DiscardUnknown

      func (m *LeaderRequest) XXX_DiscardUnknown()

      func (*LeaderRequest) XXX_Marshal

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

      func (*LeaderRequest) XXX_Merge

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

      func (*LeaderRequest) XXX_Size

      func (m *LeaderRequest) XXX_Size() int

      func (*LeaderRequest) XXX_Unmarshal

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

      type LeaderResponse

      type LeaderResponse struct {
      	Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
      	// kv is the key-value pair representing the latest leader update.
      	Kv                   *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"`
      	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
      	XXX_unrecognized     []byte           `json:"-"`
      	XXX_sizecache        int32            `json:"-"`
      }

      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) MarshalToSizedBuffer

      func (m *LeaderResponse) MarshalToSizedBuffer(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

      func (*LeaderResponse) XXX_DiscardUnknown

      func (m *LeaderResponse) XXX_DiscardUnknown()

      func (*LeaderResponse) XXX_Marshal

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

      func (*LeaderResponse) XXX_Merge

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

      func (*LeaderResponse) XXX_Size

      func (m *LeaderResponse) XXX_Size() int

      func (*LeaderResponse) XXX_Unmarshal

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

      type ProclaimRequest

      type ProclaimRequest struct {
      	// leader is the leadership hold on the election.
      	Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader,proto3" 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"`
      	XXX_NoUnkeyedLiteral struct{} `json:"-"`
      	XXX_unrecognized     []byte   `json:"-"`
      	XXX_sizecache        int32    `json:"-"`
      }

      func (*ProclaimRequest) Descriptor

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

      func (*ProclaimRequest) GetLeader

      func (m *ProclaimRequest) GetLeader() *LeaderKey

      func (*ProclaimRequest) GetValue

      func (m *ProclaimRequest) GetValue() []byte

      func (*ProclaimRequest) Marshal

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

      func (*ProclaimRequest) MarshalTo

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

      func (*ProclaimRequest) MarshalToSizedBuffer

      func (m *ProclaimRequest) MarshalToSizedBuffer(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

      func (*ProclaimRequest) XXX_DiscardUnknown

      func (m *ProclaimRequest) XXX_DiscardUnknown()

      func (*ProclaimRequest) XXX_Marshal

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

      func (*ProclaimRequest) XXX_Merge

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

      func (*ProclaimRequest) XXX_Size

      func (m *ProclaimRequest) XXX_Size() int

      func (*ProclaimRequest) XXX_Unmarshal

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

      type ProclaimResponse

      type ProclaimResponse struct {
      	Header               *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
      	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
      	XXX_unrecognized     []byte                       `json:"-"`
      	XXX_sizecache        int32                        `json:"-"`
      }

      func (*ProclaimResponse) Descriptor

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

      func (*ProclaimResponse) GetHeader

      func (*ProclaimResponse) Marshal

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

      func (*ProclaimResponse) MarshalTo

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

      func (*ProclaimResponse) MarshalToSizedBuffer

      func (m *ProclaimResponse) MarshalToSizedBuffer(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

      func (*ProclaimResponse) XXX_DiscardUnknown

      func (m *ProclaimResponse) XXX_DiscardUnknown()

      func (*ProclaimResponse) XXX_Marshal

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

      func (*ProclaimResponse) XXX_Merge

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

      func (*ProclaimResponse) XXX_Size

      func (m *ProclaimResponse) XXX_Size() int

      func (*ProclaimResponse) XXX_Unmarshal

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

      type ResignRequest

      type ResignRequest struct {
      	// leader is the leadership to relinquish by resignation.
      	Leader               *LeaderKey `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"`
      	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
      	XXX_unrecognized     []byte     `json:"-"`
      	XXX_sizecache        int32      `json:"-"`
      }

      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) MarshalToSizedBuffer

      func (m *ResignRequest) MarshalToSizedBuffer(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

      func (*ResignRequest) XXX_DiscardUnknown

      func (m *ResignRequest) XXX_DiscardUnknown()

      func (*ResignRequest) XXX_Marshal

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

      func (*ResignRequest) XXX_Merge

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

      func (*ResignRequest) XXX_Size

      func (m *ResignRequest) XXX_Size() int

      func (*ResignRequest) XXX_Unmarshal

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

      type ResignResponse

      type ResignResponse struct {
      	Header               *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
      	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
      	XXX_unrecognized     []byte                       `json:"-"`
      	XXX_sizecache        int32                        `json:"-"`
      }

      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) MarshalToSizedBuffer

      func (m *ResignResponse) MarshalToSizedBuffer(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

      func (*ResignResponse) XXX_DiscardUnknown

      func (m *ResignResponse) XXX_DiscardUnknown()

      func (*ResignResponse) XXX_Marshal

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

      func (*ResignResponse) XXX_Merge

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

      func (*ResignResponse) XXX_Size

      func (m *ResignResponse) XXX_Size() int

      func (*ResignResponse) XXX_Unmarshal

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

      type UnimplementedElectionServer

      type UnimplementedElectionServer struct {
      }

        UnimplementedElectionServer can be embedded to have forward compatible implementations.

        func (*UnimplementedElectionServer) Campaign

        func (*UnimplementedElectionServer) Leader

        func (*UnimplementedElectionServer) Observe

        func (*UnimplementedElectionServer) Proclaim

        func (*UnimplementedElectionServer) Resign

        Directories

        Path Synopsis
        Package v3electionpb is a reverse proxy.
        Package v3electionpb is a reverse proxy.