You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
harmonia-file-* crates: async file tree traits, NAR via traits, cap-tokio
Introduces three new crates implementing a generic async file tree
abstraction mirroring nix's `SourceAccessor` / `FileSystemObjectSink`
architecture (NixOS/nix#15392):
**`harmonia-file-core`**: Generic types (`FileTree`, `FileSystemObject`),
async traits (`FileSystemSource`, `FileSystemSink`, `DirectorySink`,
`RegularFileSink`), in-memory implementation, listing functions, and
serde matching `nix nar ls --json`.
**`harmonia-file-fd`**: Filesystem `FileSystemSource` (`DirSource`) and
`FileSystemSink` (`DirSlotSink`) via `cap-tokio`. Uses `openat`/`fstatat`,
mmap for large files. Lazy child thunks — directory handles opened on demand.
**`harmonia-file-nar`** (renamed from `harmonia-nar`): NAR dump/restore
now goes through `FileSystemSource`/`FileSystemSink` traits via
`dump_source` and `restore_to_sink`. The old `walkdir`-based `NarDumper`
and direct-IO `NarRestorer` are replaced. `parse_nar_listing` produces
`FileTree<NarFileInfo>` from NAR streams.
Other changes:
- `harmonia-cache/narlist.rs` uses `DirSource` + `list_deep` (async,
no `spawn_blocking`)
- All harmonia workspace deps use `{ workspace = true }`
- Dependency diagram groups `file-*` crates, shows isolated nodes
- Architecture docs updated
- Uses `cap-tokio` (bytecodealliance/cap-std#414) for async
capability-based filesystem access
|[harmonia-protocol-derive](../../harmonia-protocol-derive/README.md)| Derive macros for protocol types |
@@ -86,14 +87,17 @@ graph BT
86
87
end
87
88
subgraph File
88
89
file-core
90
+
file-fd
89
91
file-nar
90
92
end
91
93
bench
92
94
client
93
95
ssh-store
96
+
file-fd --> file-core
97
+
utils-hash --> utils-base-encoding
94
98
file-nar --> file-core
99
+
file-nar --> file-fd
95
100
file-nar --> utils-io
96
-
utils-hash --> utils-base-encoding
97
101
store-core --> utils-base-encoding
98
102
store-core --> utils-hash
99
103
store-aterm --> store-core
@@ -115,6 +119,7 @@ graph BT
115
119
store-nar-info --> store-path-info
116
120
store-nar-info --> utils-hash
117
121
cache --> file-core
122
+
cache --> file-fd
118
123
cache --> file-nar
119
124
cache --> store-core
120
125
cache --> store-db
@@ -145,14 +150,16 @@ graph BT
145
150
end
146
151
subgraph File
147
152
file-core
153
+
file-fd
148
154
file-nar
149
155
end
150
156
bench
151
157
client
152
158
ssh-store
153
-
file-nar --> file-core
154
-
file-nar --> utils-io
159
+
file-fd --> file-core
155
160
utils-hash --> utils-base-encoding
161
+
file-nar --> file-fd
162
+
file-nar --> utils-io
156
163
store-core --> utils-hash
157
164
store-aterm --> store-core
158
165
store-build-result --> store-core
@@ -190,8 +197,9 @@ intra-workspace dependencies.
190
197
-`harmonia-store-aterm` and `harmonia-store-path-info` would typically be part of `harmonia-store-core`.
191
198
However, since these data types / formats both have issues, they are instead placed in separate libraries to make sure they don't "infect" the rest of `harmonia-store-core`.
-`harmonia-file-core`: pure file tree types, `FileSystemSource`/`FileSystemSink` traits, serde matching nix's JSON format.
202
+
-`harmonia-file-fd`: real filesystem source via `cap-std` (openat, no symlink following).
195
203
-`harmonia-file-nar`: NAR pack/unpack against generic `AsyncRead`/`AsyncWrite`. Streaming; never requires the full input in memory. Knows nothing about derivations or signatures.
0 commit comments