Uploading files

🌐 This document is available in both English and Ukrainian. Use the language toggle in the top right corner to switch between versions.

1. General context

file upload.drawio

Files are stored in the Data Factory according to the id reference principle, where the file is directly stored in the Ceph "bucket", and the file key and its checksum are stored in the relational registry database.

2. Interaction with Low-Code level

Reading and returning files to the Low-Code system is done by reading or writing a file to a Ceph "bucket" accessible to Low-Code.

3. Modeling

A special "file" type is provided for saving files in the Data Factory. Such a record allows you to save one file of any format (archive, multi-page document, picture).

<changeSet id="..." author="...">
  <createTable tableName="...">
    <column name="id" type="uuid" defaultValue="uuid_generate_v4()"/>
      <constraints primaryKey="true" nullable="false"/>
    </column>
    ...
    <column name="scan_copy" type="file"/>
    ...
    <column name="..." type="..."/>
  </createTable>
</changeSet>

4. File operations

4.1. Changing the structures that contain files

Changing files directly in the Data Factory is prohibited. Each new version of the file is stored in the database with a new unique key. All added files are stored in a Ceph "bucket" to maintain data history.

Changing the file version is possible only if an "update" or "partialUpdate" request is received with a key different from the existing one.

In case of receiving an empty key of the link to Ceph - the link will be deleted together with the checksum, but the file itself will remain saved.

4.2. Return file

The same principle is used to return a file from Data Factory, the key to the file object in the structure of which the file is a part is returned. If a file with such a key exists in the Low-Code "bucket", then this file is overwritten.