...

Text file src/go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb/v3lock.proto

Documentation: go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb

     1syntax = "proto3";
     2package v3lockpb;
     3
     4import "gogoproto/gogo.proto";
     5import "etcd/api/etcdserverpb/rpc.proto";
     6
     7// for grpc-gateway
     8import "google/api/annotations.proto";
     9
    10option (gogoproto.marshaler_all) = true;
    11option (gogoproto.unmarshaler_all) = true;
    12
    13// The lock service exposes client-side locking facilities as a gRPC interface.
    14service Lock {
    15  // Lock acquires a distributed shared lock on a given named lock.
    16  // On success, it will return a unique key that exists so long as the
    17  // lock is held by the caller. This key can be used in conjunction with
    18  // transactions to safely ensure updates to etcd only occur while holding
    19  // lock ownership. The lock is held until Unlock is called on the key or the
    20  // lease associate with the owner expires.
    21  rpc Lock(LockRequest) returns (LockResponse) {
    22      option (google.api.http) = {
    23        post: "/v3/lock/lock"
    24        body: "*"
    25    };
    26  }
    27
    28  // Unlock takes a key returned by Lock and releases the hold on lock. The
    29  // next Lock caller waiting for the lock will then be woken up and given
    30  // ownership of the lock.
    31  rpc Unlock(UnlockRequest) returns (UnlockResponse) {
    32      option (google.api.http) = {
    33        post: "/v3/lock/unlock"
    34        body: "*"
    35    };
    36  }
    37}
    38
    39message LockRequest {
    40  // name is the identifier for the distributed shared lock to be acquired.
    41  bytes name = 1;
    42  // lease is the ID of the lease that will be attached to ownership of the
    43  // lock. If the lease expires or is revoked and currently holds the lock,
    44  // the lock is automatically released. Calls to Lock with the same lease will
    45  // be treated as a single acquisition; locking twice with the same lease is a
    46  // no-op.
    47  int64 lease = 2;
    48}
    49
    50message LockResponse {
    51  etcdserverpb.ResponseHeader header = 1;
    52  // key is a key that will exist on etcd for the duration that the Lock caller
    53  // owns the lock. Users should not modify this key or the lock may exhibit
    54  // undefined behavior.
    55  bytes key = 2;
    56}
    57
    58message UnlockRequest {
    59  // key is the lock ownership key granted by Lock.
    60  bytes key = 1;
    61}
    62
    63message UnlockResponse {
    64  etcdserverpb.ResponseHeader header = 1;
    65}

View as plain text