@lix-js/storage-filesystem 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +40 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,6 +3,18 @@
3
3
  Filesystem-backed storage for Lix. The Rust crate and JavaScript package expose
4
4
  the same adapter with independently versioned releases.
5
5
 
6
+ ## Exclusive repository lock
7
+
8
+ `FilesystemStorage` takes an exclusive lock on the repository's RocksDB database
9
+ at `.lix/.internal/rocksdb/LOCK`. Only one process can own a repository path at a
10
+ time. A second process attempting to open the same repository is refused with a
11
+ `LixError` whose `code` is `LIX_STORAGE_IN_USE`. Match this code rather than
12
+ the error message. Other storage failures retain their own error category. This applies to
13
+ both the Rust crate and the JavaScript package.
14
+
15
+ Applications with multiple processes must route repository access through the
16
+ process that owns the storage, for example via IPC or a local API.
17
+
6
18
  ## JavaScript
7
19
 
8
20
  ```ts
@@ -33,3 +45,31 @@ storage.start_sync(&lix).await?;
33
45
  The storage owns synchronization until `storage.stop_sync().await?` or until
34
46
  the final storage/repository instance is dropped. Explicitly stopping is useful
35
47
  for tests and before immediately reopening the same path.
48
+
49
+ ## Mirror write guarantees
50
+
51
+ File content updates are staged in the destination directory and atomically
52
+ replace that file. A reader opening the destination sees either the complete old
53
+ contents or the complete new contents, never an intermediate write. Replacement
54
+ failure leaves the previous file in place. This guarantee is per file, not per
55
+ transaction or directory, and relies on the filesystem's atomic rename support.
56
+ Existing open readers may continue reading the old file.
57
+
58
+ The mirror does not fsync file contents or directory entries. A successful mirror
59
+ write is not a power-loss durability guarantee; the repository's durability
60
+ policy applies to the database. Startup synchronization reads disk changes first,
61
+ so after an interrupted synchronization an older complete mirror can be imported
62
+ as a new repository change. Atomic replacement does not resolve that recovery
63
+ ambiguity or provide a durable mirror checkpoint.
64
+
65
+ Names matching `.lix-mirror-<16 ASCII letters or digits>.tmp` are reserved for
66
+ staging and excluded from synchronization, including explicit imports. Normal
67
+ failures clean them up immediately; directory scans remove abandoned regular
68
+ staging files left by process termination on a best-effort basis. Selective
69
+ synchronization does not scan unrelated directories for cleanup.
70
+
71
+ Replacement preserves existing file permission bits and uses ordinary creation
72
+ permissions for new files. It replaces the file identity: hard links and existing
73
+ open handles retain the old file, and ownership, ACLs, and extended attributes are
74
+ not copied. Filesystems or Windows handles that prevent replacement cause an
75
+ error; there is no fallback to truncating the destination.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lix-js/storage-filesystem",
3
3
  "type": "module",
4
- "version": "0.16.1",
4
+ "version": "0.17.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc -p tsconfig.test.json --noEmit"
26
26
  },
27
27
  "peerDependencies": {
28
- "@lix-js/sdk": "0.16.1"
28
+ "@lix-js/sdk": "0.17.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^24.10.2",