fix(server): keep each team library version in its own file (#206)

This commit is contained in:
MarekSpodBiedry
2026-10-14 16:19:01 +02:00
parent 833f0d2c27
commit a8a689d682
4 changed files with 74 additions and 9 deletions
+4 -2
View File
@@ -726,8 +726,10 @@ resuming with its offline edits, and leaving the session going back to snapshot
- **What is kept.** The published library a library file holds (manifest and snapshot with
per-asset versions) travels as a small `.figcraft` archive holding only it. The server reads it
in full with the limits a library file is read with, requires the file's library id once one is
kept and a newer version, then writes it beside the file (`library.bin`, atomically) and records
id, name and version in the file's description. Publishing from the app first fetches the
kept and a newer version, then writes it beside the file in a file of its own
(`library-<version>.bin`, atomically) and only then records id, name and version in the file's
description, so a failed write or a crash in between leaves the previous version served whole;
the previous version's file is deleted after. Publishing from the app first fetches the
server's version and publishes the next one from it, so per-asset versions continue whoever
published last; a race is refused and the next publish follows.
- **Using it.** A file enables the library with the link in place of a library file's path
+2 -1
View File
@@ -320,7 +320,8 @@ behaves as before (blocked addresses, report rates and the limits on
a link with a join code its stretched hash and the wrapped token
<data>/files/<id>/snapshot.bin its state at the last compaction (with a checksum)
<data>/files/<id>/log.bin what changed since, one checksummed record per change
<data>/files/<id>/library.bin its team library, when one was published (a .figcraft archive)
<data>/files/<id>/library-<version>.bin its team library, when one was published (a .figcraft
archive; library.bin when it was published by an older server)
<data>/files/<id>/usage.json which files use that library's components, as their apps report it
<data>/plugins/index.json the plugin directory: every version kept (manifest fields, size, SHA-256)
<data>/plugins/<sha256>.bin a plugin bundle, named by the SHA-256 of its bytes