github.com/mailgun/holster/v4@v4.20.0/election/structs.proto (about)

     1  syntax = "proto3";
     2  option go_package = "election";
     3  
     4  // Resets the current state of a node to 'candidate'
     5  message ResetElectionReq {}
     6  message ResetElectionResp {}
     7  
     8  // Asks the node to resign as leader
     9  message ResignReq {}
    10  message ResignResp {
    11    // True if the receiver is leader and stepped down
    12    bool success = 1;
    13  }
    14  
    15  // Sent by the leader of the election to all followers
    16  message HeartBeatReq  {
    17    // The leader this heart beat is from
    18    string from = 1;
    19    // The current term of the leader
    20    uint64 term = 2;
    21  }
    22  
    23  // Response to a heart beat request
    24  message HeartBeatResp {
    25    // The follower who is responding
    26    string from = 1;
    27    // The term the heart beat is for
    28    uint64 term = 2;
    29  }
    30  
    31  message VoteResp {
    32     // The candidate who responded
    33     string candidate = 1;
    34     // The term this vote response is for
    35     uint64 term = 2;
    36     // If the Vote was granted by this node
    37     bool granted = 3;
    38  }
    39  
    40  // A vote request sent to all peers at
    41  // the start of an election.
    42  message VoteReq {
    43     // The candidate who is requesting the targets vote
    44     string candidate = 1;
    45     // The term this vote is for.
    46     uint64 term = 2;
    47  }
    48  
    49  // Set the peers this node will consider during the election.
    50  // This is typically set by calling Node.SetPeers() but the
    51  // implementor could choose to allow a remote entity to set the
    52  // peer list via Node.ReceiveRPC(). This can be blocked by refusing
    53  // to accept election.SetPeersRPC calls.
    54  message SetPeersReq {
    55    repeated string peers = 1;
    56  }
    57  message SetPeersResp { }
    58  
    59  // Get the current state of the node
    60  message GetStateReq {}
    61  message GetStateResp {
    62    string leader = 1;
    63    string state = 2;
    64    repeated string peers = 3;
    65  }