syntax = “proto3”; package v3lockpb;
import “annotations.proto”; import “rpc.proto”; import “gogo.proto”;
option (gogoproto.marshaler_all) = true; option (gogoproto.unmarshaler_all) = true;
service Lock {
// Lock acquires a distributed shared lock on a given named lock. rpc Lock(LockRequest) returns (LockResponse) { option (google.api.http) = { post: "/v3alpha/lock/lock" body: "*" }; } // Unlock takes a key returned by Lock and releases the hold on lock. rpc Unlock(UnlockRequest) returns (UnlockResponse) { option (google.api.http) = { post: "/v3alpha/lock/unlock" body: "*" }; }
}
message LockRequest {
// name is the identifier for the distributed shared lock to be acquired. bytes name = 1; // lease is the ID of the lease that will be attached to ownership of the // lock. If the lease expires or is revoked and currently holds the lock, // the lock is automatically released. Calls to Lock with the same lease will // be treated as a single acquisition; locking twice with the same lease is a // no-op. int64 lease = 2;
}
message LockResponse {
etcdserverpb.ResponseHeader header = 1; // key is a key that will exist on etcd for the duration that the Lock caller // owns the lock. Users should not modify this key or the lock may exhibit // undefined behavior. bytes key = 2;
}
message UnlockRequest {
// key is the lock ownership key granted by Lock. bytes key = 1;
}
message UnlockResponse {
etcdserverpb.ResponseHeader header = 1;
}