Archipelago's File Persistence Strategy
How are files for Archipelago Digital Objects (ADOs) persisted? (What happens with those fishtanks?)
A few Event Subscribers/Data describing logics happen in a certain order:
User Uploads via a webform Element a new File or via Drush/Batch ingest that attaches (via JSONAPI) a file.
If the webform is involved, Archipelago acts quickly and calls directly (before the Node even exists) the file classifier, that will:
- Add/complement a
as:somefiletypeJSON structure into the main
JSON, with info about the file, checksums, size, Drupal fids, uuid, etc. This is a heavy function part of the
StrawberryfieldFilePersisterService. It does a lot, making use of optimized logic, but may do more in the future to handle too-many/too-big files needs (FYI: solution will be simple, add to a queue and process later).
- The most (yes) important info added here is the desired future storage location of the file.
- Add/complement a
The user finishes the form, saves and and confirms the ADO creation, and finally all the Node events fire.
StrawberryfieldEventPresaveSubscriberAsFileStructureGeneratorruns and checks if 2.1 already was processed. This is needed since the user could have triggered an ingest via drush/JSONAPI/Webhooks etc. If all is well (this is a less expensive check) Archipelago continues.
On presave (next)
StrawberryfieldEventPresaveSubscriberFilePersisterruns, checking all TEMPORARY files described in
as:somefiletypeand actually copying them to the right "desired" location.
And on Save
StrawberryfieldEventInsertFileUsageUpdateralso marking the file as "being" used by a Strawberry driven Node (different Event).
Note: Anytime we remove directly from the raw JSON a full
as:somefiletype structure of a sub-element from an
as:structure we force Archipelago to do all the above again, and Archipelago can regenerate technical metadata. This has been used when updating EXIF binaries or even when something went wrong (while testing, but this stuff is safe no worries). Eventually, there will be a BIG red button that does that if you do not like JSON editing.
Discussions related to Archipelago's file persistence strategy and planned potential strategies can be be found here: Strawberryfield Issues: 107, and here: Strawberryfield Issues: 76. This page will be updated with additional information following future developments.
Thank you for reading! Please contact us on our Archipelago Commons Google Group with any questions or feedback.
Return to the Archipelago Documentation main page.