...

Text file src/go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb/v3election.proto

Documentation: go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb

     1syntax = "proto3";
     2package v3electionpb;
     3
     4import "gogoproto/gogo.proto";
     5import "etcd/api/etcdserverpb/rpc.proto";
     6import "etcd/api/mvccpb/kv.proto";
     7
     8// for grpc-gateway
     9import "google/api/annotations.proto";
    10
    11option (gogoproto.marshaler_all) = true;
    12option (gogoproto.unmarshaler_all) = true;
    13
    14// The election service exposes client-side election facilities as a gRPC interface.
    15service Election {
    16  // Campaign waits to acquire leadership in an election, returning a LeaderKey
    17  // representing the leadership if successful. The LeaderKey can then be used
    18  // to issue new values on the election, transactionally guard API requests on
    19  // leadership still being held, and resign from the election.
    20  rpc Campaign(CampaignRequest) returns (CampaignResponse) {
    21      option (google.api.http) = {
    22        post: "/v3/election/campaign"
    23        body: "*"
    24    };
    25  }
    26  // Proclaim updates the leader's posted value with a new value.
    27  rpc Proclaim(ProclaimRequest) returns (ProclaimResponse) {
    28      option (google.api.http) = {
    29        post: "/v3/election/proclaim"
    30        body: "*"
    31    };
    32  }
    33  // Leader returns the current election proclamation, if any.
    34  rpc Leader(LeaderRequest) returns (LeaderResponse) {
    35      option (google.api.http) = {
    36        post: "/v3/election/leader"
    37        body: "*"
    38    };
    39  }
    40  // Observe streams election proclamations in-order as made by the election's
    41  // elected leaders.
    42  rpc Observe(LeaderRequest) returns (stream LeaderResponse) {
    43      option (google.api.http) = {
    44        post: "/v3/election/observe"
    45        body: "*"
    46    };
    47  }
    48  // Resign releases election leadership so other campaigners may acquire
    49  // leadership on the election.
    50  rpc Resign(ResignRequest) returns (ResignResponse) {
    51      option (google.api.http) = {
    52        post: "/v3/election/resign"
    53        body: "*"
    54    };
    55  }
    56}
    57
    58message CampaignRequest {
    59  // name is the election's identifier for the campaign.
    60  bytes name = 1;
    61  // lease is the ID of the lease attached to leadership of the election. If the
    62  // lease expires or is revoked before resigning leadership, then the
    63  // leadership is transferred to the next campaigner, if any.
    64  int64 lease = 2;
    65  // value is the initial proclaimed value set when the campaigner wins the
    66  // election.
    67  bytes value = 3;
    68}
    69
    70message CampaignResponse {
    71  etcdserverpb.ResponseHeader header = 1;
    72  // leader describes the resources used for holding leadereship of the election.
    73  LeaderKey leader = 2;
    74}
    75
    76message LeaderKey {
    77  // name is the election identifier that correponds to the leadership key.
    78  bytes name = 1;
    79  // key is an opaque key representing the ownership of the election. If the key
    80  // is deleted, then leadership is lost.
    81  bytes key = 2;
    82  // rev is the creation revision of the key. It can be used to test for ownership
    83  // of an election during transactions by testing the key's creation revision
    84  // matches rev.
    85  int64 rev = 3;
    86  // lease is the lease ID of the election leader.
    87  int64 lease = 4;
    88}
    89
    90message LeaderRequest {
    91  // name is the election identifier for the leadership information.
    92  bytes name = 1;
    93}
    94
    95message LeaderResponse {
    96  etcdserverpb.ResponseHeader header = 1;
    97  // kv is the key-value pair representing the latest leader update.
    98  mvccpb.KeyValue kv = 2;
    99}
   100
   101message ResignRequest {
   102  // leader is the leadership to relinquish by resignation.
   103  LeaderKey leader = 1;
   104}
   105
   106message ResignResponse {
   107  etcdserverpb.ResponseHeader header = 1;
   108}
   109
   110message ProclaimRequest {
   111  // leader is the leadership hold on the election.
   112  LeaderKey leader = 1;
   113  // value is an update meant to overwrite the leader's current value.
   114  bytes value = 2;
   115}
   116
   117message ProclaimResponse {
   118  etcdserverpb.ResponseHeader header = 1;
   119}

View as plain text