Skip to content

Commit

Permalink
Extend app registry with methods to add providers and mimetype filters (
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 authored Jul 26, 2021
1 parent 6da44cb commit 05f37d3
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 117 deletions.
6 changes: 0 additions & 6 deletions cs3/app/provider/v1beta1/provider_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ message OpenInAppRequest {
// The access token MUST be short-lived.
// TODO(labkode): investigate token derivation techniques.
string access_token = 4;
// OPTIONAL.
// A reference to the application to be used to open the resource, should the
// default inferred from the resource's mimetype be overridden by user's choice.
// If the targeted resource is a directory, this parameter is required and
// in its absence the implementation MUST return INVALID_ARGUMENT.
string app = 5;
}

message OpenInAppResponse {
Expand Down
82 changes: 65 additions & 17 deletions cs3/app/registry/v1beta1/registry_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ service RegistryAPI {
// Returns the app providers that are capable of handling this resource info.
// MUST return CODE_NOT_FOUND if no providers are available.
rpc GetAppProviders(GetAppProvidersRequest) returns (GetAppProvidersResponse);
// Registers a new app provider to the registry.
rpc AddAppProvider(AddAppProviderRequest) returns (AddAppProviderResponse);
// Returns a list of the available app providers known by this registry.
rpc ListAppProviders(ListAppProvidersRequest) returns (ListAppProvidersResponse);
// Returns the default app provider which serves a specified mime type.
rpc GetDefaultAppProviderForMimeType(GetDefaultAppProviderForMimeTypeRequest) returns (GetDefaultAppProviderForMimeTypeResponse);
// Sets the default app provider for a specified mime type.
rpc SetDefaultAppProviderForMimeType(SetDefaultAppProviderForMimeTypeRequest) returns (SetDefaultAppProviderForMimeTypeResponse);
}

message GetAppProvidersRequest {
Expand All @@ -78,28 +84,28 @@ message GetAppProvidersResponse {
repeated ProviderInfo providers = 3;
}

message ListAppProvidersRequest {
message AddAppProviderRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// Represents a filter to apply to the request.
message Filter {
// The filter to apply.
enum Type {
TYPE_INVALID = 0;
TYPE_MIME_TYPE = 1;
}
// REQUIRED.
Type type = 2;
oneof term {
// if present, the response MUST list all known app providers for the given mimetype.
string mime_type = 3;
}
}
// The app provider to be registered.
ProviderInfo provider = 2;
}

message AddAppProviderResponse {
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 1;
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 2;
}

message ListAppProvidersRequest {
// OPTIONAL.
// The list of filters to apply if any.
repeated Filter filters = 2;
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
}

message ListAppProvidersResponse {
Expand All @@ -113,3 +119,45 @@ message ListAppProvidersResponse {
// The list of app providers this registry knows about.
repeated ProviderInfo providers = 3;
}

message GetDefaultAppProviderForMimeTypeRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The mimetype for which the default app has to be returned.
string mime_type = 2;
}

message GetDefaultAppProviderForMimeTypeResponse {
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 1;
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 2;
// REQUIRED.
// The default app provider for the specified mime type.
ProviderInfo provider = 3;
}

message SetDefaultAppProviderForMimeTypeRequest {
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 1;
// REQUIRED.
// The mimetype for which the default app has to be returned.
string mime_type = 2;
// REQUIRED.
// The app provider to be marked as default for the specified mime type.
ProviderInfo provider = 3;
}

message SetDefaultAppProviderForMimeTypeResponse {
// REQUIRED.
// The response status.
cs3.rpc.v1beta1.Status status = 1;
// OPTIONAL.
// Opaque information.
cs3.types.v1beta1.Opaque opaque = 2;
}
5 changes: 4 additions & 1 deletion cs3/app/registry/v1beta1/resources.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ message ProviderInfo {
// For example, tcp://localhost:1099.
string address = 3;
// OPTIONAL.
// A human-readable name of the app provider.
string name = 4;
// OPTIONAL.
// Information to describe the functionalities
// offered by the app provider. Meant to be read
// by humans.
string description = 4;
string description = 5;
}
12 changes: 10 additions & 2 deletions cs3/gateway/v1beta1/gateway_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,14 @@ service GatewayAPI {
// Returns the app providers that are capable of handling this resource info.
// MUST return CODE_NOT_FOUND if no providers are available.
rpc GetAppProviders(cs3.app.registry.v1beta1.GetAppProvidersRequest) returns (cs3.app.registry.v1beta1.GetAppProvidersResponse);
// Registers a new app provider to the registry.
rpc AddAppProvider(cs3.app.registry.v1beta1.AddAppProviderRequest) returns (cs3.app.registry.v1beta1.AddAppProviderResponse);
// Returns a list of the available app providers known by this registry.
rpc ListAppProviders(cs3.app.registry.v1beta1.ListAppProvidersRequest) returns (cs3.app.registry.v1beta1.ListAppProvidersResponse);
// Returns the default app provider which serves a specified mime type.
rpc GetDefaultAppProviderForMimeType(cs3.app.registry.v1beta1.GetDefaultAppProviderForMimeTypeRequest) returns (cs3.app.registry.v1beta1.GetDefaultAppProviderForMimeTypeResponse);
// Sets the default app provider for a specified mime type.
rpc SetDefaultAppProviderForMimeType(cs3.app.registry.v1beta1.SetDefaultAppProviderForMimeTypeRequest) returns (cs3.app.registry.v1beta1.SetDefaultAppProviderForMimeTypeResponse);
// *****************************************************************/
// ************************ USER PROVIDER **************************/
// *****************************************************************/
Expand Down Expand Up @@ -544,8 +550,10 @@ message OpenInAppRequest {
}
ViewMode view_mode = 3;
// OPTIONAL.
// The application to be used to open the resource. Defaults to the primary application
// registered for the mime type of the given resource.
// A reference to the application to be used to open the resource, should the
// default inferred from the resource's mimetype be overridden by user's choice.
// If the targeted resource is a directory, this parameter is required and
// in its absence the implementation MUST return INVALID_ARGUMENT.
string app = 4;
}

Expand Down
Loading

0 comments on commit 05f37d3

Please sign in to comment.