Artifact Upload

File uploading is necessary for report submission and slides sharing. These files are called “artifact”. Only students of a project can upload these artifacts.

The process involves three storages:

  • projects database table

  • files database table

  • IPFS

Uploading artifacts starts with user submitting a file via browser. A file controller receives it and add to the file system, IPFS. After adding the file, a CID is generated by IPFS and returned to the controller. Consequently, metadata about the file, including the CID, is added as a row in the table files. The database management system, RethinkDB, generates a primary key for this row, which is then added to project artifact revisions.

@startuml
hide footbox
autoactivate on
skinparam sequenceParticipant underline
actor ":User" as usr
boundary ":Artifact Upload Form" as form
control ":File Controller" as ctl
entity ":Project" as db_prj
entity ":File" as db_file
collections ":IPFS" as ipfs

usr -> form : // submit a file()
form -> ctl : // send form()
ctl -> db_prj : // check permission()
ctl <-- db_prj
ctl -> ipfs : // add to file system()
ctl <-- ipfs : // return CID
ctl -> db_file : // save file metadata()
ctl <-- db_file : // return database key()
ctl -> db_prj : // add artifact()
ctl <-- db_prj
form <-- ctl
usr <-- form
@enduml

Figure 28 General message sequence for artifact uploading.

In case of uploading files for other purposes, such as including a picture in a comment, is similar to the flow described above. However, the primary key is not stored in the project, and the link to the stored file is returned instead.