d32c9d5e98
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
59 lines
1.7 KiB
Protocol Buffer
59 lines
1.7 KiB
Protocol Buffer
// Copyright 2023 Greptime Team
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
syntax = "proto3";
|
|
|
|
package greptime.v1.meta;
|
|
|
|
option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/meta";
|
|
|
|
import "greptime/v1/meta/common.proto";
|
|
|
|
service Lock {
|
|
// Lock acquires a distributed shared lock on a given named lock. On success,
|
|
// it will return a unique key that exists so long as the lock is held by the
|
|
// caller.
|
|
rpc Lock(LockRequest) returns (LockResponse);
|
|
|
|
// Unlock takes a key returned by Lock and releases the hold on lock.
|
|
rpc Unlock(UnlockRequest) returns (UnlockResponse);
|
|
}
|
|
|
|
message LockRequest {
|
|
RequestHeader header = 1;
|
|
|
|
// Name is the identifier for the distributed shared lock to be acquired.
|
|
bytes name = 2;
|
|
|
|
// If the expiration time is exceeded and currently holds the lock, the lock
|
|
// is automatically released.
|
|
int64 expire_secs = 3;
|
|
}
|
|
|
|
message LockResponse {
|
|
ResponseHeader header = 1;
|
|
|
|
// Key will exist as long as lock is held by the caller.
|
|
bytes key = 2;
|
|
}
|
|
|
|
message UnlockRequest {
|
|
RequestHeader header = 1;
|
|
|
|
// key is the lock ownership key granted by Lock.
|
|
bytes key = 2;
|
|
}
|
|
|
|
message UnlockResponse { ResponseHeader header = 1; }
|