Skip to main content

Module files

Module files 

Source
Expand description

File attachments of revisions, with version history.

A revision holds named files; uploading a file with the same name again (case-insensitive) adds a new version instead of a second file. Every version stays downloadable, and any old version can be restored – as a new version, so the history is never rewritten. The bytes live in the content-addressed vault, so identical content is stored once.

Structs§

CompareCandidate
A model the 3D preview can be compared with: another version of the same file, or a version of the file of the same name in another revision of the item (graphical revision comparison).
FileText
A page of the text that was extracted from a file version for the full-text search (see textindex).
Stored
Outcome of storing one upload.
Upload
A received upload that is already stored in the vault.

Constants§

MAX_TEXT_PAGE_CHARS
Most characters one read_text call returns.

Functions§

all_hashes
All distinct blob hashes referenced by the database (for vault check).
apply_bases
Attaches the parsed bases to the uploads of the same name.
apply_folders
Attaches the parsed folders to the uploads.
attach
Adds files / new versions to a revision that is checked out by the actor.
check_in
Check-in: stores the uploaded files as new versions and releases the check-out in one transaction – either both happen or neither.
classify_unclassified
Classifies the files that have no format yet (files from before the format registry, or after format was reset to NULL). Returns how many were classified.
clean_content_type
Normalises a client supplied content type; unknown values become application/octet-stream.
compare_candidates
The models a file version can be compared with, newest revision and version first (at most 50; versions with the same content as shown are left out). The file’s item is readable, so are its other revisions.
delete
Removes a file (with all its versions) from an in-work revision. The blobs stay in the vault because other revisions may still reference them.
ensure_can_attach
Fails early (before receiving an upload) if files cannot be attached.
get
A file the actor may read; hidden files answer like missing ones.
get_version
A file version (with the file name) the actor may read.
list
The files of a revision the actor may read.
list_many
The files of several revisions in one query, ordered by revision, folder and name.
list_many_by_revision
list_many grouped by revision (each group in folder and name order).
parse_bases
Parses the bases field of an upload: a JSON object that maps file names to the version each upload is based on, either the version number (0 = a new file) or the SHA-256 of the content the client checked out: {"hub.step": 3, "frame.iam": "9f86d0…"}. Keys are matched like file names on the server (case-insensitive).
parse_folders
Parses the folder fields of an upload: folder (one folder for every file of the request) and folders (a JSON object {"file name": "folder"} for each file, e.g. from the desktop folder import; it wins over folder). Returns the default folder and the folders by lower-case stored name.
precheck_base
Checks a planned upload against the current file before its bytes are sent (chunked uploads announce their base first), so a conflict is reported before gigabytes are transferred. The binding check runs again when the version is stored.
read_text
Reads a page (offset, at most limit characters, capped at MAX_TEXT_PAGE_CHARS) of the extracted text of a file of a revision (version: default the current one). Hidden project groups answer like a missing revision; nothing is read from the vault, only the text the upload stored for the search.
rescan_references
Reads the references of the current file versions of the given formats again and replaces the stored ones – after a reader improved (e.g. SOLIDWORKS 2015+ files, whose compressed sections were not read before). Formats that are not scanned for references are skipped. Each version is replaced in its own transaction, so an interrupted run can simply be repeated. Returns how many versions were scanned.
restore_version
Rollback: makes the content of an older version the newest version.
scan_unscanned_references
Scans the current versions that were stored before reference tracking existed (or before their format was known) for referenced CAD files. Returns how many versions were scanned.
set_folder
Changes the folder of a file (its place in the desktop working folder) while its revision is checked out by the actor.
set_retention
Chooses what happens to the old versions of a file: all keeps every version, latest lets the housekeeping remove the versions a newer one replaced (see services::retention::purge_superseded_versions).
stored_name
The name a file gets on the server – the key for bases and versions.
versions
All versions of a file the actor may read, newest first.
versions_of_revision
All versions of all files of a revision, newest first.