Skip to content

Commit

Permalink
define storage space api
Browse files Browse the repository at this point in the history
The storage space api should make it possible to provision and deprovision spaces ('home', 'shares', 'project' etc...) for users. Using this api we should also be able to deprovision spacess

Co-authored-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
David Christofas and butonic committed Feb 4, 2021
1 parent 8a19a7f commit 064a93b
Show file tree
Hide file tree
Showing 4 changed files with 836 additions and 30 deletions.
8 changes: 8 additions & 0 deletions cs3/gateway/v1beta1/gateway_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ service GatewayAPI {
rpc UnsetArbitraryMetadata(cs3.storage.provider.v1beta1.UnsetArbitraryMetadataRequest) returns (cs3.storage.provider.v1beta1.UnsetArbitraryMetadataResponse);
// Creates the home directory for a user.
rpc CreateHome(cs3.storage.provider.v1beta1.CreateHomeRequest) returns (cs3.storage.provider.v1beta1.CreateHomeResponse);
// Creates a storage space.
rpc CreateStorageSpace(cs3.storage.provider.v1beta1.CreateStorageSpaceRequest) returns (cs3.storage.provider.v1beta1.CreateStorageSpaceResponse);
// Lists storage spaces.
rpc ListStorageSpaces(cs3.storage.provider.v1beta1.ListStorageSpacesRequest) returns (cs3.storage.provider.v1beta1.ListStorageSpacesResponse);
// Updates a storage space.
rpc UpdateStorageSpace(cs3.storage.provider.v1beta1.UpdateStorageSpaceRequest) returns (cs3.storage.provider.v1beta1.UpdateStorageSpaceResponse);
// Deletes a storage space.
rpc DeleteStorageSpace(cs3.storage.provider.v1beta1.DeleteStorageSpaceRequest) returns (cs3.storage.provider.v1beta1.DeleteStorageSpaceResponse);
// *****************************************************************/
// ************************ APP PROVIDER ********************/
// *****************************************************************/
Expand Down
111 changes: 111 additions & 0 deletions cs3/storage/provider/v1beta1/provider_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ option java_package = "com.cs3.storage.provider.v1beta1";
option objc_class_prefix = "CSP";
option php_namespace = "Cs3\\Storage\\Provider\\V1Beta1";

import "cs3/identity/user/v1beta1/resources.proto";
import "cs3/rpc/v1beta1/status.proto";
import "cs3/storage/provider/v1beta1/resources.proto";
import "cs3/types/v1beta1/types.proto";
Expand Down Expand Up @@ -144,6 +145,14 @@ service ProviderAPI {
rpc CreateHome(CreateHomeRequest) returns (CreateHomeResponse);
// Gets the home path for the user.
rpc GetHome(GetHomeRequest) returns (GetHomeResponse);
// Creates a storage space.
rpc CreateStorageSpace(CreateStorageSpaceRequest) returns (CreateStorageSpaceResponse);
// Lists storage spaces.
rpc ListStorageSpaces(ListStorageSpacesRequest) returns (ListStorageSpacesResponse);
// Updates a storage space.
rpc UpdateStorageSpace(UpdateStorageSpaceRequest) returns (UpdateStorageSpaceResponse);
// Deletes a storage space.
rpc DeleteStorageSpace(DeleteStorageSpaceRequest) returns (DeleteStorageSpaceResponse);
}

message GetHomeRequest {
Expand Down Expand Up @@ -709,3 +718,105 @@ message CreateHomeResponse {
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 2;
}

message CreateStorageSpaceRequest {
// OPTIONAL.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
cs3.identity.user.v1beta1.User owner = 2;
// OPTIONAL.
// Could be 'home', 'share', 'project', 'space'...
string type = 3;
// OPTIONAL.
// User readable name of the storage space.
string name = 4;
// OPTIONAL.
Quota quota = 5;
}

message CreateStorageSpaceResponse {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 2;
// REQUIRED.
// The created storage space.
StorageSpace storage_space = 3;
}

message ListStorageSpacesRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// Represents a filter to apply to the request.
message Filter {
// The filter to apply.
enum Type {
TYPE_INVALID = 0;
TYPE_NO = 1;
TYPE_ID = 2;
TYPE_OWNER = 3;
TYPE_SPACE_TYPE = 4;
}
// REQUIRED.
Type type = 1;
oneof term {
StorageSpaceId id = 2;
cs3.identity.user.v1beta1.UserId owner = 3;
string space_type = 4;
}
}
// OPTIONAL.
// The list of filters to apply if any.
repeated Filter filters = 2;
}

message ListStorageSpacesResponse {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 2;
// REQUIRED.
repeated StorageSpace storage_spaces = 3;
}

message UpdateStorageSpaceRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
StorageSpace storage_space = 2;
}

message UpdateStorageSpaceResponse {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 2;
// REQUIRED.
// The updated storage space.
StorageSpace storage_space = 3;
}

message DeleteStorageSpaceRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
StorageSpaceId id = 2;
}

message DeleteStorageSpaceResponse {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 2;
}
44 changes: 44 additions & 0 deletions cs3/storage/provider/v1beta1/resources.proto
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,47 @@ message FileDownloadProtocol {
// Tells to the gateway if the client should be exposed directly to the download_endpoint.
bool expose = 4;
}

// Represents a storage space which could be a 'home', 'share' etc...
message StorageSpace {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
StorageSpaceId id = 2;
// OPTIONAL.
cs3.identity.user.v1beta1.User owner = 3;
// OPTIONAL.
// The root resource of the storage space.
ResourceId root = 4;
// OPTIONAL.
string name = 5;
// OPTIONAL.
Quota quota = 6;
// OPTIONAL.
// Could be 'home', 'share', 'project', 'space'...
string space_type = 7;
// OPTIONAL.
// Last modification time (mtime) of the root resource of this storage space.
cs3.types.v1beta1.Timestamp mtime = 8;
}

// The id of a storage space.
message StorageSpaceId {
// REQUIRED.
// The internal storage space id.
string opaque_id = 1;
}

// Represents a quota for a storage space.
message Quota {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// OPTIONAL.
// The bytes quota for the user.
uint64 quota_max_bytes = 2;
// OPTIONAL.
// The files quota for the user.
uint64 quota_max_files = 3;
}
Loading

0 comments on commit 064a93b

Please sign in to comment.