package v3electionpb

import "go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb"

Index

Constants

const (
	Election_Campaign_FullMethodName = "/v3electionpb.Election/Campaign"
	Election_Proclaim_FullMethodName = "/v3electionpb.Election/Proclaim"
	Election_Leader_FullMethodName   = "/v3electionpb.Election/Leader"
	Election_Observe_FullMethodName  = "/v3electionpb.Election/Observe"
	Election_Resign_FullMethodName   = "/v3electionpb.Election/Resign"
)

Variables

var Election_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v3electionpb.Election",
	HandlerType: (*ElectionServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Campaign",
			Handler:    _Election_Campaign_Handler,
		},
		{
			MethodName: "Proclaim",
			Handler:    _Election_Proclaim_Handler,
		},
		{
			MethodName: "Leader",
			Handler:    _Election_Leader_Handler,
		},
		{
			MethodName: "Resign",
			Handler:    _Election_Resign_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Observe",
			Handler:       _Election_Observe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "v3election.proto",
}

Election_ServiceDesc is the grpc.ServiceDesc for Election service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

var File_v3election_proto protoreflect.FileDescriptor

Functions

func RegisterElectionServer

func RegisterElectionServer(s grpc.ServiceRegistrar, 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"`
	// contains filtered or unexported fields
}

func (*CampaignRequest) Descriptor

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

Deprecated: Use CampaignRequest.ProtoReflect.Descriptor instead.

func (*CampaignRequest) GetLease

func (x *CampaignRequest) GetLease() int64

func (*CampaignRequest) GetName

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

func (*CampaignRequest) GetValue

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

func (*CampaignRequest) ProtoMessage

func (*CampaignRequest) ProtoMessage()

func (*CampaignRequest) ProtoReflect

func (x *CampaignRequest) ProtoReflect() protoreflect.Message

func (*CampaignRequest) Reset

func (x *CampaignRequest) Reset()

func (*CampaignRequest) String

func (x *CampaignRequest) String() string

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"`
	// contains filtered or unexported fields
}

func (*CampaignResponse) Descriptor

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

Deprecated: Use CampaignResponse.ProtoReflect.Descriptor instead.

func (*CampaignResponse) GetHeader

func (x *CampaignResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*CampaignResponse) GetLeader

func (x *CampaignResponse) GetLeader() *LeaderKey

func (*CampaignResponse) ProtoMessage

func (*CampaignResponse) ProtoMessage()

func (*CampaignResponse) ProtoReflect

func (x *CampaignResponse) ProtoReflect() protoreflect.Message

func (*CampaignResponse) Reset

func (x *CampaignResponse) Reset()

func (*CampaignResponse) String

func (x *CampaignResponse) String() string

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) (grpc.ServerStreamingClient[LeaderResponse], 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://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

The election service exposes client-side election facilities as a gRPC interface.

func NewElectionClient

func NewElectionClient(cc grpc.ClientConnInterface) 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, grpc.ServerStreamingServer[LeaderResponse]) error
	// Resign releases election leadership so other campaigners may acquire
	// leadership on the election.
	Resign(context.Context, *ResignRequest) (*ResignResponse, error)
	// contains filtered or unexported methods
}

ElectionServer is the server API for Election service. All implementations must embed UnimplementedElectionServer for forward compatibility.

The election service exposes client-side election facilities as a gRPC interface.

type Election_ObserveClient

type Election_ObserveClient = grpc.ServerStreamingClient[LeaderResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Election_ObserveServer

type Election_ObserveServer = grpc.ServerStreamingServer[LeaderResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type LeaderKey

type LeaderKey struct {

	// name is the election identifier that corresponds 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"`
	// contains filtered or unexported fields
}

func (*LeaderKey) Descriptor

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

Deprecated: Use LeaderKey.ProtoReflect.Descriptor instead.

func (*LeaderKey) GetKey

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

func (*LeaderKey) GetLease

func (x *LeaderKey) GetLease() int64

func (*LeaderKey) GetName

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

func (*LeaderKey) GetRev

func (x *LeaderKey) GetRev() int64

func (*LeaderKey) ProtoMessage

func (*LeaderKey) ProtoMessage()

func (*LeaderKey) ProtoReflect

func (x *LeaderKey) ProtoReflect() protoreflect.Message

func (*LeaderKey) Reset

func (x *LeaderKey) Reset()

func (*LeaderKey) String

func (x *LeaderKey) String() string

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"`
	// contains filtered or unexported fields
}

func (*LeaderRequest) Descriptor

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

Deprecated: Use LeaderRequest.ProtoReflect.Descriptor instead.

func (*LeaderRequest) GetName

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

func (*LeaderRequest) ProtoMessage

func (*LeaderRequest) ProtoMessage()

func (*LeaderRequest) ProtoReflect

func (x *LeaderRequest) ProtoReflect() protoreflect.Message

func (*LeaderRequest) Reset

func (x *LeaderRequest) Reset()

func (*LeaderRequest) String

func (x *LeaderRequest) String() string

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"`
	// contains filtered or unexported fields
}

func (*LeaderResponse) Descriptor

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

Deprecated: Use LeaderResponse.ProtoReflect.Descriptor instead.

func (*LeaderResponse) GetHeader

func (x *LeaderResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*LeaderResponse) GetKv

func (x *LeaderResponse) GetKv() *mvccpb.KeyValue

func (*LeaderResponse) ProtoMessage

func (*LeaderResponse) ProtoMessage()

func (*LeaderResponse) ProtoReflect

func (x *LeaderResponse) ProtoReflect() protoreflect.Message

func (*LeaderResponse) Reset

func (x *LeaderResponse) Reset()

func (*LeaderResponse) String

func (x *LeaderResponse) String() string

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"`
	// contains filtered or unexported fields
}

func (*ProclaimRequest) Descriptor

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

Deprecated: Use ProclaimRequest.ProtoReflect.Descriptor instead.

func (*ProclaimRequest) GetLeader

func (x *ProclaimRequest) GetLeader() *LeaderKey

func (*ProclaimRequest) GetValue

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

func (*ProclaimRequest) ProtoMessage

func (*ProclaimRequest) ProtoMessage()

func (*ProclaimRequest) ProtoReflect

func (x *ProclaimRequest) ProtoReflect() protoreflect.Message

func (*ProclaimRequest) Reset

func (x *ProclaimRequest) Reset()

func (*ProclaimRequest) String

func (x *ProclaimRequest) String() string

type ProclaimResponse

type ProclaimResponse struct {
	Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// contains filtered or unexported fields
}

func (*ProclaimResponse) Descriptor

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

Deprecated: Use ProclaimResponse.ProtoReflect.Descriptor instead.

func (*ProclaimResponse) GetHeader

func (x *ProclaimResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*ProclaimResponse) ProtoMessage

func (*ProclaimResponse) ProtoMessage()

func (*ProclaimResponse) ProtoReflect

func (x *ProclaimResponse) ProtoReflect() protoreflect.Message

func (*ProclaimResponse) Reset

func (x *ProclaimResponse) Reset()

func (*ProclaimResponse) String

func (x *ProclaimResponse) String() string

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"`
	// contains filtered or unexported fields
}

func (*ResignRequest) Descriptor

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

Deprecated: Use ResignRequest.ProtoReflect.Descriptor instead.

func (*ResignRequest) GetLeader

func (x *ResignRequest) GetLeader() *LeaderKey

func (*ResignRequest) ProtoMessage

func (*ResignRequest) ProtoMessage()

func (*ResignRequest) ProtoReflect

func (x *ResignRequest) ProtoReflect() protoreflect.Message

func (*ResignRequest) Reset

func (x *ResignRequest) Reset()

func (*ResignRequest) String

func (x *ResignRequest) String() string

type ResignResponse

type ResignResponse struct {
	Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// contains filtered or unexported fields
}

func (*ResignResponse) Descriptor

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

Deprecated: Use ResignResponse.ProtoReflect.Descriptor instead.

func (*ResignResponse) GetHeader

func (x *ResignResponse) GetHeader() *etcdserverpb.ResponseHeader

func (*ResignResponse) ProtoMessage

func (*ResignResponse) ProtoMessage()

func (*ResignResponse) ProtoReflect

func (x *ResignResponse) ProtoReflect() protoreflect.Message

func (*ResignResponse) Reset

func (x *ResignResponse) Reset()

func (*ResignResponse) String

func (x *ResignResponse) String() string

type UnimplementedElectionServer

type UnimplementedElectionServer struct{}

UnimplementedElectionServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedElectionServer) Campaign

func (UnimplementedElectionServer) Campaign(context.Context, *CampaignRequest) (*CampaignResponse, error)

func (UnimplementedElectionServer) Leader

func (UnimplementedElectionServer) Leader(context.Context, *LeaderRequest) (*LeaderResponse, error)

func (UnimplementedElectionServer) Observe

func (UnimplementedElectionServer) Observe(*LeaderRequest, grpc.ServerStreamingServer[LeaderResponse]) error

func (UnimplementedElectionServer) Proclaim

func (UnimplementedElectionServer) Proclaim(context.Context, *ProclaimRequest) (*ProclaimResponse, error)

func (UnimplementedElectionServer) Resign

func (UnimplementedElectionServer) Resign(context.Context, *ResignRequest) (*ResignResponse, error)

type UnsafeElectionServer

type UnsafeElectionServer interface {
	// contains filtered or unexported methods
}

UnsafeElectionServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ElectionServer will result in compilation errors.

Source Files

v3election.pb.go v3election_grpc.pb.go

Directories

PathSynopsis
etcdserver/api/v3election/v3electionpb/gwPackage v3electionpb is a reverse proxy.
Version
v3.7.1 (latest)
Published
Jul 23, 2026
Platform
linux/amd64
Imports
12 packages
Last checked
4 hours ago

Tools for package owners.