Skip to content

Bring back cap-async-std as cap-tokio#414

Open
Ericson2314 wants to merge 1 commit into
bytecodealliance:mainfrom
Ericson2314:cap-tokio
Open

Bring back cap-async-std as cap-tokio#414
Ericson2314 wants to merge 1 commit into
bytecodealliance:mainfrom
Ericson2314:cap-tokio

Conversation

@Ericson2314
Copy link
Copy Markdown

Fixes #408

I don't know enough about to tokio to really be the person that does this, but it does compile for me.

This was based on reverting commit ecc886d.

Fixes bytecodealliance#408

I don't know enough about to `tokio` to really be the person that does
this, but it does compile for me.

This was based on reverting commit ecc886d.
Ericson2314 added a commit to nix-community/harmonia that referenced this pull request May 11, 2026
…p-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
Ericson2314 added a commit to nix-community/harmonia that referenced this pull request May 11, 2026
…p-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
Ericson2314 added a commit to nix-community/harmonia that referenced this pull request May 11, 2026
…p-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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace cap-async-std

1 participant