diff --git a/Cargo.toml b/Cargo.toml index 9726c24..6fa45a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,20 @@ exclude = [] [lib] name = "alkblobs" +[features] +default = ["sqlite"] +sqlite = ["dep:rusqlite"] +postgres = ["dep:tokio-postgres", "dep:deadpool-postgres"] +mem = [] +pg-lo = ["dep:tokio-postgres", "dep:deadpool-postgres"] +ops = ["dep:alkcall"] + [dependencies] tokio = { version = "1", default-features = false, features = ["rt", "sync", "io-util", "macros"] } thiserror = "2" -parking_lot = "0.12" \ No newline at end of file +parking_lot = "0.12" + +alkcall = { version = "0.8.1", optional = true } +deadpool-postgres = { version = "0.14", optional = true } +rusqlite = { version = "0.40", features = ["bundled"], optional = true } +tokio-postgres = { version = "0.7", optional = true } \ No newline at end of file diff --git a/src/backend.rs b/src/backend.rs new file mode 100644 index 0000000..0b8ef5e --- /dev/null +++ b/src/backend.rs @@ -0,0 +1,3 @@ +//! The Backend trait contract (ADR-003): opaque byte keys and byte-valued +//! entries, complete `list()`, and the read-cursor / staged-put I/O seams +//! (ADR-010) with the crate-internal engine-state companion seam. diff --git a/src/dispatch.rs b/src/dispatch.rs new file mode 100644 index 0000000..5048e46 --- /dev/null +++ b/src/dispatch.rs @@ -0,0 +1,2 @@ +//! Size-threshold dispatch between the kv and large tiers (ADR-003): +//! routing as a pure function of content length. diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..510727a --- /dev/null +++ b/src/error.rs @@ -0,0 +1,3 @@ +//! The error family (ADR-012 §6.5): one enum with members at two +//! altitudes — the trait's effective members plus the facade's +//! GC-refusal and key-validation variants. diff --git a/src/facade.rs b/src/facade.rs new file mode 100644 index 0000000..8b21ffa --- /dev/null +++ b/src/facade.rs @@ -0,0 +1,2 @@ +//! The store facade value types: `EntryMeta`, `Pin`/`Batch`, +//! `SweepReport`, `GcAbortCause`, and `PinState`. diff --git a/src/gc.rs b/src/gc.rs new file mode 100644 index 0000000..8875e51 --- /dev/null +++ b/src/gc.rs @@ -0,0 +1,2 @@ +//! GC and namespace mechanism (ADR-005/012): registered liveness, +//! pin-before-publish, delete windows, and sweep outcomes as data. diff --git a/src/hashing.rs b/src/hashing.rs new file mode 100644 index 0000000..7b2ecc3 --- /dev/null +++ b/src/hashing.rs @@ -0,0 +1,3 @@ +//! Hashing & keys (ADR-002): `Digest`/`Key` types, the canonical +//! git-blob-sha-256 derivation, tolerated `git-blob-sha-1`, and the +//! algorithm-tagged byte encoding. diff --git a/src/lib.rs b/src/lib.rs index 2200a7e..10734ec 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,22 @@ -pub fn placeholder() {} +pub mod backend; +pub mod dispatch; +pub mod error; +pub mod facade; +pub mod gc; +pub mod hashing; +pub mod local; + +#[cfg(feature = "mem")] +pub mod mem; + +#[cfg(feature = "pg-lo")] +pub mod pg_lo; + +#[cfg(feature = "ops")] +pub mod ops; + +#[cfg(feature = "postgres")] +pub mod postgres; + +#[cfg(feature = "sqlite")] +pub mod sqlite; diff --git a/src/local.rs b/src/local.rs new file mode 100644 index 0000000..c886ba6 --- /dev/null +++ b/src/local.rs @@ -0,0 +1,3 @@ +//! The `local` large-tier engine (ADR-003/008): flat +//! `{hex-prefix}/{hex-prefix}/{hash}` sharding, stage-then-commit-rename +//! staged puts, and pread-based read cursors. diff --git a/src/mem.rs b/src/mem.rs new file mode 100644 index 0000000..da9ce03 --- /dev/null +++ b/src/mem.rs @@ -0,0 +1,2 @@ +//! The `mem` kv-tier engine (ADR-011 §2): a `BTreeMap`-shaped ephemeral +//! implementation — the contract-reference engine. diff --git a/src/ops.rs b/src/ops.rs new file mode 100644 index 0000000..88ad200 --- /dev/null +++ b/src/ops.rs @@ -0,0 +1,2 @@ +//! The ops surface (ADR-001): alkcall-backed network operations behind +//! the `ops` feature gate. diff --git a/src/pg_lo.rs b/src/pg_lo.rs new file mode 100644 index 0000000..9c4785c --- /dev/null +++ b/src/pg_lo.rs @@ -0,0 +1,2 @@ +//! The `pg-lo` large-tier engine (ADR-009): postgres Large Objects +//! storage with descriptorless `lo_get` read windows over companion rows. diff --git a/src/postgres.rs b/src/postgres.rs new file mode 100644 index 0000000..b2b35f1 --- /dev/null +++ b/src/postgres.rs @@ -0,0 +1,2 @@ +//! The `postgres` kv-tier engine (ADR-007): content-addressed rows over +//! a pooled postgres connection, fleet-valid. diff --git a/src/sqlite.rs b/src/sqlite.rs new file mode 100644 index 0000000..7642cde --- /dev/null +++ b/src/sqlite.rs @@ -0,0 +1,2 @@ +//! The `sqlite` kv-tier engine (ADR-003): WAL + `synchronous=NORMAL` +//! durability, prepared statements, bounded reads. diff --git a/tasks/scaffold-crate-features.md b/tasks/scaffold-crate-features.md index 53f1b55..5f075a1 100644 --- a/tasks/scaffold-crate-features.md +++ b/tasks/scaffold-crate-features.md @@ -1,7 +1,7 @@ --- id: scaffold-crate-features name: Crate scaffold — ADR-013 §4 feature graph and module skeleton -status: pending +status: completed depends_on: [] scope: narrow risk: low @@ -65,8 +65,43 @@ outside tests, no comments in code (doc comments on public API fine). ## Notes -> To be filled by implementation agent +- Feature graph declared exactly per ADR-013 §4's table: + `default = ["sqlite"]`; `sqlite = ["dep:rusqlite"]`; + `postgres = ["dep:tokio-postgres", "dep:deadpool-postgres"]`; + `pg-lo` pulls the same shared pg driver cluster by `dep:` reference + only (no feature implications — the `postgres` feature name appears + nowhere in its declaration); `mem = []`; `ops = ["dep:alkcall"]`. + `local` ungated, no feature, no dependency. +- Driver versions verified at implementation time (crates.io + the + alkstore engine manifests as the family baseline): `rusqlite = "0.40"` + (`bundled`; resolves 0.40.2, matching alkstore-sqlite's baseline), + `tokio-postgres = "0.7"` (0.7.18), `deadpool-postgres = "0.14"` + (0.14.2), `alkcall = "0.8.1"` (the exact pin the task specified — + present on the public registry). +- Module skeleton: `lib.rs` re-export shape with one module per file — + ungated stubs `hashing`, `error`, `backend`, `facade`, `dispatch`, + `gc`, `local`; gated stubs `mem`, `pg_lo`, `postgres`, `sqlite`, + `ops` behind `#[cfg(feature)]`. All stubs are doc-comment-only; + `pub fn placeholder()` removed. Stub content stays empty so the + wave-1 implementation tasks (core-hashing-keys, core-error-model, + core-trait-and-types) own their module bodies. +- `Cargo.lock` is untracked in this repo (workspace-wide exclude, + consistent with all prior commits) — left untracked. +- No CI wiring added (manual CI per docs/plans/implementation.md). ## Summary -> To be filled on completion \ No newline at end of file +Crate scaffold complete per ADR-013 §4: the full decided feature +graph (`sqlite` default-on with rusqlite bundled; `postgres`, `mem`, +`pg-lo` default-off; `ops` with alkcall 0.8.1; `local` ungated) is +declared in the manifest with inert optional driver dependencies, and +the module skeleton (lib.rs re-export shape + 12 doc-comment-only +module stubs, engine modules behind `#[cfg(feature)]`) replaces the +placeholder body. All acceptance criteria verified: `cargo test` green +with defaults (rusqlite only non-base dep in the default tree), +`cargo check --all-features` resolves the whole graph including +alkcall, `cargo check --no-default-features --features pg-lo` resolves +with rusqlite provably absent (`cargo tree -i rusqlite` matches +nothing) proving pg-lo implies no other engine feature, and +`cargo clippy --all-targets -- -D warnings` + `cargo fmt --check` +are clean. \ No newline at end of file