github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/kvserverpb/liveness.proto (about)

     1  // Copyright 2016 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  syntax = "proto3";
    12  package cockroach.kv.kvserver.storagepb;
    13  option go_package = "kvserverpb";
    14  
    15  import "util/hlc/legacy_timestamp.proto";
    16  import "gogoproto/gogo.proto";
    17  
    18  // Liveness holds information about a node's latest heartbeat and epoch.
    19  //
    20  // NOTE: Care must be taken when changing the encoding of this proto
    21  // because it is used as part of conditional put operations. 
    22  message Liveness {
    23    option (gogoproto.populate) = true;
    24  
    25    int32 node_id = 1 [(gogoproto.customname) = "NodeID",
    26        (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"];
    27    // Epoch is a monotonically-increasing value for node liveness. It
    28    // may be incremented if the liveness record expires (current time
    29    // is later than the expiration timestamp).
    30    int64 epoch = 2;
    31    // The timestamp at which this liveness record expires. The logical part of
    32    // this timestamp is zero.
    33    //
    34    // Note that the clock max offset is not accounted for in any way when this
    35    // expiration is set. If a checker wants to be extra-optimistic about another
    36    // node being alive, it can adjust for the max offset. liveness.IsLive()
    37    // doesn't do that, however. The expectation is that the expiration duration
    38    // is large in comparison to the max offset, and that nodes heartbeat their
    39    // liveness records well in advance of this expiration, so the optimism or
    40    // pessimism of a checker does not matter very much.
    41    util.hlc.LegacyTimestamp expiration = 3 [(gogoproto.nullable) = false];
    42    bool draining = 4;
    43    bool decommissioning = 5;
    44  }
    45  
    46  // NodeLivenessStatus describes the status of a node from the perspective of the
    47  // liveness system.
    48  //
    49  // See comment on LivenessStatus() for a description of the states.
    50  enum NodeLivenessStatus {
    51    UNKNOWN = 0;
    52    // DEAD indicates the node is considered dead.
    53    DEAD = 1;
    54    // UNAVAILABLE indicates that the node is unavailable - it has not updated its
    55    // liveness record recently enough to be considered live, but has not been
    56    // unavailable long enough to be considered dead.
    57    UNAVAILABLE = 2;
    58    // LIVE indicates a live node.
    59    LIVE = 3;
    60    // DECOMMISSIONING indicates a node that is in the decommissioning process.
    61    DECOMMISSIONING = 4;
    62    // DECOMMISSIONED indicates a node that has finished the decommissioning
    63    // process.
    64    DECOMMISSIONED = 5;
    65  }