-
Notifications
You must be signed in to change notification settings - Fork 18
Download package file
See #430.
V2.0 of the SONATA Service Platform allows the SDK to download only the meta-data related to a package. We want to be able to download the exact package file that has been uploaded.
From sonata-nfv/son-catalogue-repos#157:
Package files (son-packages) are currently identified by the a uuid (same way as descriptors are). This uuid is now included in the package descriptor meta-data when it is stored in the catalogue. It takes a new field called "son_package_uuid". Thus, every stored package descriptor now is linked to its stored package file.
Regarding son-packages metadata, it includes the filename, but not necessarily using the trio name+vendor+version. Is the sender (in this case the GK) who defines the filename of the file when filling the HTTP headers of the submission, as shown below:
headers[HTTP_CONTENT_DISPOSITION] = "attachment; filename="
So, if the file is 'named tc.sonata.1.0.son', then its metadata filename will be called that way. The Catalogues stores the filename internally in a field called "grid_fs_name" (due to the gridFS lib). Here is an example of the metadata for sonata-demo.son file (used in integration tests)
[{"created_at":"2017-02-16T13:04:46.048+00:00","grid_fs_id":"58a5a36eaf8bef220b000000","grid_fs_name":"sonata-demo.son","md5":"9c8a66d5caa756bbb5d2ed4c56e27214","updated_at":"2017-02-16T13:04:46.048+00:00","uuid":"6dc04296-ea9b-4113-bf4b-8e9d2d42c9b3"}]
The son-packages API does not support yet queries based on filename (it does for "grid_fs_name"). This will be addressed soon. ... Exactly, right now the API support queries based on current fields, such grid_fs_id for the file uuid or grid_fs_name for the filename.
However, to get the file itself, now it is only available through /son-packages/:id/? using grid_fs_id (named son_package_uuid in the package descriptor). If we need to retrieve a file by name then some changes are required.
The 'md5' is generated by the Catalogue, using GridFS lib.
Package files can be big. Uploading/downloading synchronously might hit the Service Platform performance. How can we do it asynchronously instead?