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

PB-615: Spec multipart upload process #425

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
35 changes: 34 additions & 1 deletion spec/static/spec/v1/openapitransactional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tags:

| Media Type | Description | File Extension(s) |
| ---------- | ----------- | ----------------- |
| application/vnd.apache.parquet | Apache Parquet column-oriented data file format | .parquet |
| application/x.ascii-grid+zip | Zipped ESRI ASCII raster format (.asc) | .zip |
| application/x.ascii-xyz+zip | Zipped XYZ (.xyz) | .zip |
| application/x.e00+zip | Zipped e00 | .zip |
Expand Down Expand Up @@ -60,6 +61,8 @@ tags:
| application/x.geojson+zip | Zipped GeoJSON | .zip |
| application/x.interlis; version=2.3 | Interlis 2 | .xtf, .xml |
| application/x.interlis+zip; version=2.3 | Zipped XTF (2.3) | .zip |
| application/x.interlis; version=2.4 | Interlis 2 | .xtf | .xml |
| application/x.interlis+zip; version=2.4 | Zipped XTF (2.4) | .zip |
| application/x.interlis; version=1 | Interlis 1 | .itf |
| application/x.interlis+zip; version=1 | Zipped ITF | .zip |
| image/tiff; application=geotiff; profile=cloud-optimized | Cloud Optimized GeoTIFF (COG) | .tiff, .tif |`
Expand Down Expand Up @@ -92,6 +95,34 @@ tags:
- <span style="color:red">*Files bigger than 10 MB should use compression,
see [Compression](#section/Compression)*</span>

## Steps to upload Assets

To upload an assets file there are generally three steps involved:

<ol>
<li>Create new upload process</li>
<li>Upload parts/files</li>
<li>Complete upload process</li>
</ol>

Any file that is larger than 5 GB must be split into multiple parts. A file part must be at
least 5 MB except for the last one and at most 5 GB, otherwise the complete operation will fail.
Copy link
Member

@hansmannj hansmannj Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "except for the last (or only) one" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to call it out, I would add a separate sentence instead of parenthesis. "If there is only one part, it can be smaller than 5 MB since it is also the last part."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following this sentence there is the following sentence:
"If the file is less that 5 GB, you will only upload a single part, but must still start and complete the process as with multiple parts."
Do you think it needs more than this?

If the file is less that 5 GB, you will only upload a single part, but must still start and complete the process as with multiple parts.

(1) Use the [create new upload](#tag/Asset-Upload-Management/operation/createAssetUpload) request to start a new upload.
It will return a list of urls.

(2) Use the urls to [upload asset file part](#tag/Asset-Upload-Management/operation/uploadAssetFilePart). Do this for each file part.

(3) Once all parts have been uploaded, execute the [complete the upload](#tag/Asset-Upload-Management/operation/completeMultipartUpload) request.
The new asset file be available to users after you have successfully completed the upload.

If any errors happen during the upload process, you can [abort the upload](#tag/Asset-Upload-Management/operation/abortMultipartUpload)
and restart the process.

There can only be 1 upload in progress per asset. If you wish to start a new upload you must first abort any existing upload that is in progress.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit unclear. From my understanding it's OK to upload multiple parts concurrently but you cannot "overwrite" (start a new upload of) an asset for which upload has not completed (or been aborted).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esp. the flow chart could be of interest to some users

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of that doc. Maybe it should be pulled into the API doc itself instead of being a separate document? If it needs to remain separate, I strongly support linking to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapted the concurrent upload part sentence. I was also not aware of this document. I added the detailed description of the upload to the spec, as well as the diagram asset to the static files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest replacing the document with a redirect to the API doc that has the content. Less copypasta to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I removed the existing file as all the content is integrated in the spec. Also moved both diagram files to the static assets.

Use [list uploads](#tag/Asset-Upload-Management/operation/getAssetUploads) to see if any uploads
are in progress.

## Authentication

Expand Down Expand Up @@ -571,7 +602,9 @@ paths:
$ref: "#/components/responses/ServerError"
delete:
summary: Delete an existing feature by Id
description: Use this method to delete an existing feature/item.
description: |
Use this method to delete an existing feature/item. The feature can only be deleted if all
its assets have been deleted first. Also see [Delete an existing asset by id](#tag/Data-Management/operation/deleteAsset).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"See also" sounds less weird than "Also see" I think.

operationId: deleteFeature
tags:
- Data Management
Expand Down
4 changes: 3 additions & 1 deletion spec/transaction/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ paths:
$ref: "../components/responses.yaml#/components/responses/ServerError"
delete:
summary: Delete an existing feature by Id
description: Use this method to delete an existing feature/item.
description: |
Use this method to delete an existing feature/item. The feature can only be deleted if all
its assets have been deleted first. Also see [Delete an existing asset by id](#tag/Data-Management/operation/deleteAsset).
operationId: deleteFeature
tags:
- Data Management
Expand Down
31 changes: 31 additions & 0 deletions spec/transaction/tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tags:

| Media Type | Description | File Extension(s) |
| ---------- | ----------- | ----------------- |
| application/vnd.apache.parquet | Apache Parquet column-oriented data file format | .parquet |
| application/x.ascii-grid+zip | Zipped ESRI ASCII raster format (.asc) | .zip |
| application/x.ascii-xyz+zip | Zipped XYZ (.xyz) | .zip |
| application/x.e00+zip | Zipped e00 | .zip |
Expand Down Expand Up @@ -46,6 +47,8 @@ tags:
| application/x.geojson+zip | Zipped GeoJSON | .zip |
| application/x.interlis; version=2.3 | Interlis 2 | .xtf, .xml |
| application/x.interlis+zip; version=2.3 | Zipped XTF (2.3) | .zip |
| application/x.interlis; version=2.4 | Interlis 2 | .xtf | .xml |
| application/x.interlis+zip; version=2.4 | Zipped XTF (2.4) | .zip |
| application/x.interlis; version=1 | Interlis 1 | .itf |
| application/x.interlis+zip; version=1 | Zipped ITF | .zip |
| image/tiff; application=geotiff; profile=cloud-optimized | Cloud Optimized GeoTIFF (COG) | .tiff, .tif |`
Expand Down Expand Up @@ -79,6 +82,34 @@ tags:
- <span style="color:red">*Files bigger than 10 MB should use compression,
see [Compression](#section/Compression)*</span>

## Steps to upload Assets

To upload an assets file there are generally three steps involved:

<ol>
<li>Create new upload process</li>
<li>Upload parts/files</li>
<li>Complete upload process</li>
</ol>

Any file that is larger than 5 GB must be split into multiple parts. A file part must be at
least 5 MB except for the last one and at most 5 GB, otherwise the complete operation will fail.
If the file is less that 5 GB, you will only upload a single part, but must still start and complete the process as with multiple parts.

(1) Use the [create new upload](#tag/Asset-Upload-Management/operation/createAssetUpload) request to start a new upload.
It will return a list of urls.

(2) Use the urls to [upload asset file part](#tag/Asset-Upload-Management/operation/uploadAssetFilePart). Do this for each file part.

(3) Once all parts have been uploaded, execute the [complete the upload](#tag/Asset-Upload-Management/operation/completeMultipartUpload) request.
The new asset file be available to users after you have successfully completed the upload.

If any errors happen during the upload process, you can [abort the upload](#tag/Asset-Upload-Management/operation/abortMultipartUpload)
and restart the process.

There can only be 1 upload in progress per asset. If you wish to start a new upload you must first abort any existing upload that is in progress.
Use [list uploads](#tag/Asset-Upload-Management/operation/getAssetUploads) to see if any uploads
are in progress.

## Authentication

Expand Down