-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
328c41f
commit b846743
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
syntax = "proto3"; | ||
|
||
package 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 | ||
// aytomatically released. The unit is second. | ||
int64 expire = 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters