Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Lock API metadata and add missing argument to Unlock #162

Merged
merged 8 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cs3/storage/provider/v1beta1/provider_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,9 @@ message UnlockRequest {
// REQUIRED.
// The reference the lock is associated to.
Reference ref = 2;
// REQUIRED.
// The lock metadata.
Lock lock = 3;
}

message UnlockResponse {
Expand Down
42 changes: 20 additions & 22 deletions cs3/storage/provider/v1beta1/resources.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ message ResourceInfo {
// OPTIONAL.
// Arbitrary metadata attached to a resource.
ArbitraryMetadata arbitrary_metadata = 14;
// OPTIONAL.
// Exclusive or write lock on this resource that will limit modification of the resource to holders of the lock. Can be used by WOPI or other apps requiring exclusive locks.
Lock lock = 15;
// OPTIONAL.
// Advisory locks on this resource. Can be used for shared locks or other forms of collaborative locks.
repeated Lock advisory_locks = 16;
}

// CanonicalMetadata contains extra metadata
Expand Down Expand Up @@ -135,29 +141,21 @@ enum LockType {
// of this metadata according to their constraints, a reference
// implementation is given here. The lock SHOULD be stored
// as an extended attribute on the referenced filesystem entry.
// It MUST NOT be accessible via the Stat/SetArbitraryMetadata APIs,
// and it SHOULD contain a base64-encoded JSON with the following format:
// {
// "type" : "<LOCK_TYPE>",
// "h" : "<holder>",
// "md" : "<metadata>",
// "mtime" : "<Unix timestamp>"
// }
// It MUST NOT be accessible via the Stat/SetArbitraryMetadata APIs.
glpatcern marked this conversation as resolved.
Show resolved Hide resolved
butonic marked this conversation as resolved.
Show resolved Hide resolved
message Lock {
// The type of lock.
LockType type = 1;
// The entity holding the lock.
oneof holder {
// A userid if the lock is held by a user.
cs3.identity.user.v1beta1.UserId user = 2;
// An application name if the lock is held by an app.
string app_name = 3;
}
// Some arbitrary metadata associated with the lock.
string metadata = 4;
// The last modification time of the lock.
// The value is Unix Epoch timestamp in seconds.
cs3.types.v1beta1.Timestamp mtime = 5;
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED. The id of the lock, eg. the X-WOPI-Lock id or the WebDAV opaquelocktoken.
butonic marked this conversation as resolved.
Show resolved Hide resolved
string lock_id = 2;
// REQUIRED. The type of lock.
butonic marked this conversation as resolved.
Show resolved Hide resolved
LockType type = 3;
// OPTIONAL. The userid of a user holding the lock.
butonic marked this conversation as resolved.
Show resolved Hide resolved
cs3.identity.user.v1beta1.UserId user = 4;
// OPTIONAL An application name if the lock is held by an app.
butonic marked this conversation as resolved.
Show resolved Hide resolved
string app_name = 5;
// OPTIONAL. The time when the lock will expire.
butonic marked this conversation as resolved.
Show resolved Hide resolved
cs3.types.v1beta1.Timestamp expiration = 6;
}

// The available types of resources.
Expand Down