Skip to content

Commit

Permalink
Improve Application Providers and Application Registry (cs3org#22)
Browse files Browse the repository at this point in the history
* modify app provider and app registry to use resource info as input
  • Loading branch information
labkode authored Jul 31, 2019
1 parent 5f4d144 commit e6d2d0b
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 55 deletions.
21 changes: 15 additions & 6 deletions cs3/appprovider/v0alpha/appprovider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,21 @@ service AppProviderService {
}

message OpenRequest {
// OPTIONAL.
// Opaque information.
cs3.types.Opaque opaque = 1;
// REQUIRED.
// The id of the resource to be opened.
cs3.storageproviderv0alpha.ResourceId resource_id = 1;
// The resource information.
cs3.storageproviderv0alpha.ResourceInfo resource_info = 2;
// REQUIRED.
// The access token the application provider will use when contacting
// the storage provider storing the resource pointed by resource_id.
// The access token this application provider will use when contacting
// the storage provider to read and write.
// Service implementors MUST make sure that the access token only grants
// access to the resource the open request is made.
// access to the requested resource.
// Service implementors should use a ResourceId rather than a filename to grant access, as
// ResourceIds MUST NOT change when a resource is renamed.
// The access token MUST be short-lived.
// TODO(labkode): investigate token derivation techniques.
string access_token = 3;
}

Expand All @@ -77,6 +84,8 @@ message OpenResponse {
// Opaque information.
cs3.types.Opaque opaque = 2;
// REQUIRED.
// The url to render, usually inside an IFrame in the client.
// The url that user agents will render to clients.
// Usually the rendering happens by using HTML iframes,
// at least, Office 365, Collabora, OnlyOffice do like that.
string iframe_url = 3;
}
22 changes: 10 additions & 12 deletions cs3/appregistry/v0alpha/appregistry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option php_namespace = "CS3\\AppRegistryV0Alpha";

import "cs3/appregistry/v0alpha/resources.proto";
import "cs3/rpc/status.proto";
import "cs3/storageprovider/v0alpha/resources.proto";
import "cs3/types/types.proto";

// App Registry API
Expand All @@ -49,35 +50,32 @@ import "cs3/types/types.proto";
// Any method MAY return UNKNOWN.
// Any method MAY return UNAUTHENTICATED.
service AppRegistryService {
// Returns the app provider that is reponsible for the given
// resource reference.
// MUST return CODE_NOT_FOUND if the reference does not exist.
rpc GetAppProvider(GetAppProviderRequest) returns (GetAppProviderResponse);
// 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);
// Returns a list of the available app providers known by this registry.
rpc ListAppProviders(ListAppProvidersRequest) returns (ListAppProvidersResponse);
}

message GetAppProviderRequest {
message GetAppProvidersRequest {
// OPTIONAL.
// Opaque information.
cs3.types.Opaque opaque = 1;
// REQUIRED.
// The mimetype of the resource.
// For example, application/text or
// image/png.
string mime_type = 3;
// The resource information.
cs3.storageproviderv0alpha.ResourceInfo resource_info = 2;
}

message GetAppProviderResponse {
message GetAppProvidersResponse {
// REQUIRED.
// The response status.
cs3.rpc.Status status = 1;
// OPTIONAL.
// Opaque information.
cs3.types.Opaque opaque = 2;
// REQUIRED.
// The app provider for the given extension and mimetype.
ProviderInfo provider = 3;
// The app providers available for the given resource info.
repeated ProviderInfo providers = 3;
}

message ListAppProvidersRequest {
Expand Down
61 changes: 36 additions & 25 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ <h2>Table of Contents</h2>
<ul>

<li>
<a href="#cs3.appregistryv0alpha.GetAppProviderRequest"><span class="badge">M</span>GetAppProviderRequest</a>
<a href="#cs3.appregistryv0alpha.GetAppProvidersRequest"><span class="badge">M</span>GetAppProvidersRequest</a>
</li>

<li>
<a href="#cs3.appregistryv0alpha.GetAppProviderResponse"><span class="badge">M</span>GetAppProviderResponse</a>
<a href="#cs3.appregistryv0alpha.GetAppProvidersResponse"><span class="badge">M</span>GetAppProvidersResponse</a>
</li>

<li>
Expand Down Expand Up @@ -1653,22 +1653,34 @@ <h3 id="cs3.appproviderv0alpha.OpenRequest">OpenRequest</h3>
<tbody>

<tr>
<td>resource_id</td>
<td><a href="#cs3.storageproviderv0alpha.ResourceId">cs3.storageproviderv0alpha.ResourceId</a></td>
<td>opaque</td>
<td><a href="#cs3.types.Opaque">cs3.types.Opaque</a></td>
<td></td>
<td><p>OPTIONAL.
Opaque information. </p></td>
</tr>

<tr>
<td>resource_info</td>
<td><a href="#cs3.storageproviderv0alpha.ResourceInfo">cs3.storageproviderv0alpha.ResourceInfo</a></td>
<td></td>
<td><p>REQUIRED.
The id of the resource to be opened. </p></td>
The resource information. </p></td>
</tr>

<tr>
<td>access_token</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p>REQUIRED.
The access token the application provider will use when contacting
the storage provider storing the resource pointed by resource_id.
The access token this application provider will use when contacting
the storage provider to read and write.
Service implementors MUST make sure that the access token only grants
access to the resource the open request is made. </p></td>
access to the requested resource.
Service implementors should use a ResourceId rather than a filename to grant access, as
ResourceIds MUST NOT change when a resource is renamed.
The access token MUST be short-lived.
TODO(labkode): investigate token derivation techniques. </p></td>
</tr>

</tbody>
Expand Down Expand Up @@ -1709,7 +1721,9 @@ <h3 id="cs3.appproviderv0alpha.OpenResponse">OpenResponse</h3>
<td><a href="#string">string</a></td>
<td></td>
<td><p>REQUIRED.
The url to render, usually inside an IFrame in the client. </p></td>
The url that user agents will render to clients.
Usually the rendering happens by using HTML iframes,
at least, Office 365, Collabora, OnlyOffice do like that. </p></td>
</tr>

</tbody>
Expand Down Expand Up @@ -1753,7 +1767,7 @@ <h2 id="cs3/appregistry/v0alpha/appregistry.proto">cs3/appregistry/v0alpha/appre
<p></p>


<h3 id="cs3.appregistryv0alpha.GetAppProviderRequest">GetAppProviderRequest</h3>
<h3 id="cs3.appregistryv0alpha.GetAppProvidersRequest">GetAppProvidersRequest</h3>
<p></p>


Expand All @@ -1772,13 +1786,11 @@ <h3 id="cs3.appregistryv0alpha.GetAppProviderRequest">GetAppProviderRequest</h3>
</tr>

<tr>
<td>mime_type</td>
<td><a href="#string">string</a></td>
<td>resource_info</td>
<td><a href="#cs3.storageproviderv0alpha.ResourceInfo">cs3.storageproviderv0alpha.ResourceInfo</a></td>
<td></td>
<td><p>REQUIRED.
The mimetype of the resource.
For example, application/text or
image/png. </p></td>
The resource information. </p></td>
</tr>

</tbody>
Expand All @@ -1788,7 +1800,7 @@ <h3 id="cs3.appregistryv0alpha.GetAppProviderRequest">GetAppProviderRequest</h3>



<h3 id="cs3.appregistryv0alpha.GetAppProviderResponse">GetAppProviderResponse</h3>
<h3 id="cs3.appregistryv0alpha.GetAppProvidersResponse">GetAppProvidersResponse</h3>
<p></p>


Expand All @@ -1815,11 +1827,11 @@ <h3 id="cs3.appregistryv0alpha.GetAppProviderResponse">GetAppProviderResponse</h
</tr>

<tr>
<td>provider</td>
<td>providers</td>
<td><a href="#cs3.appregistryv0alpha.ProviderInfo">ProviderInfo</a></td>
<td></td>
<td>repeated</td>
<td><p>REQUIRED.
The app provider for the given extension and mimetype. </p></td>
The app providers available for the given resource info. </p></td>
</tr>

</tbody>
Expand Down Expand Up @@ -1912,12 +1924,11 @@ <h3 id="cs3.appregistryv0alpha.AppRegistryService">AppRegistryService</h3>
<tbody>

<tr>
<td>GetAppProvider</td>
<td><a href="#cs3.appregistryv0alpha.GetAppProviderRequest">GetAppProviderRequest</a></td>
<td><a href="#cs3.appregistryv0alpha.GetAppProviderResponse">GetAppProviderResponse</a></td>
<td><p>Returns the app provider that is reponsible for the given
resource reference.
MUST return CODE_NOT_FOUND if the reference does not exist.</p></td>
<td>GetAppProviders</td>
<td><a href="#cs3.appregistryv0alpha.GetAppProvidersRequest">GetAppProvidersRequest</a></td>
<td><a href="#cs3.appregistryv0alpha.GetAppProvidersResponse">GetAppProvidersResponse</a></td>
<td><p>Returns the app providers that are capable of handling this resource info.
MUST return CODE_NOT_FOUND if no providers are available.</p></td>
</tr>

<tr>
Expand Down
33 changes: 21 additions & 12 deletions proto.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
"fields": [
{
"id": 1,
"name": "resource_id",
"type": "cs3.storageproviderv0alpha.ResourceId"
"name": "opaque",
"type": "cs3.types.Opaque"
},
{
"id": 2,
"name": "resource_info",
"type": "cs3.storageproviderv0alpha.ResourceInfo"
},
{
"id": 3,
Expand Down Expand Up @@ -103,22 +108,22 @@
"def": {
"messages": [
{
"name": "GetAppProviderRequest",
"name": "GetAppProvidersRequest",
"fields": [
{
"id": 1,
"name": "opaque",
"type": "cs3.types.Opaque"
},
{
"id": 3,
"name": "mime_type",
"type": "string"
"id": 2,
"name": "resource_info",
"type": "cs3.storageproviderv0alpha.ResourceInfo"
}
]
},
{
"name": "GetAppProviderResponse",
"name": "GetAppProvidersResponse",
"fields": [
{
"id": 1,
Expand All @@ -132,8 +137,9 @@
},
{
"id": 3,
"name": "provider",
"type": "ProviderInfo"
"name": "providers",
"type": "ProviderInfo",
"is_repeated": true
}
]
},
Expand Down Expand Up @@ -174,9 +180,9 @@
"name": "AppRegistryService",
"rpcs": [
{
"name": "GetAppProvider",
"in_type": "GetAppProviderRequest",
"out_type": "GetAppProviderResponse"
"name": "GetAppProviders",
"in_type": "GetAppProvidersRequest",
"out_type": "GetAppProvidersResponse"
},
{
"name": "ListAppProviders",
Expand All @@ -190,6 +196,9 @@
{
"path": "cs3/appregistry/v0alpha/resources.proto"
},
{
"path": "cs3/storageprovider/v0alpha/resources.proto"
},
{
"path": "cs3/rpc/status.proto"
},
Expand Down

0 comments on commit e6d2d0b

Please sign in to comment.