Expand description
§Elastik — Audi-ted L5 Storage Engine
elastik-core is a protocol-neutral storage engine: canonical paths, opaque
bytes, content-addressed versioning, an HMAC-chained audit log, and a
four-tier access model. SQLite for files.
§Quick start
use elastik_core::{
AccessTier, Engine, Preconditions, Representation, SecretBytes, ValidatedWorldPath,
};
use bytes::Bytes;
let engine = Engine::builder()
.data_root("./data")
.key(SecretBytes::new(b"shared-hmac-secret".to_vec()).expect("hmac key"))
.build()
.expect("engine builds");
let world = ValidatedWorldPath::new("home/hello").expect("canonical path");
// Store bytes at a path.
engine
.replace(
&world,
Representation {
body: Bytes::from_static(b"hi"),
content_type: "text/plain".into(),
headers: Vec::new(),
},
Preconditions::none(),
AccessTier::Write,
)
.await
.expect("write succeeds");
// Retrieve bytes by path.
let read = engine.read(&world, AccessTier::Read).expect("read succeeds");
assert!(read.is_some());§What the library does
- Bytes at paths. Canonical
home/,tmp/,dev/,sys/,etc/,lib/,boot/,usr/,var/namespaces decide durable-vs-transient without per-call configuration. - Versions everything. Every successful write returns an ETag; reads,
replaces, and appends honour
Preconditions::if_match/if_none_match. - Audits everything. HMAC-chained ledger;
Engine::verify_auditreturns a typedAuditVerifyresult and refuses to start when an existing chain is corrupted. - Authenticates everything.
AccessTier(Anon / Read / Write / Approve) plus token-bytes verification viaEngine::verify_token. - Subscribes to changes.
Engine::subscribereturns anEngineSubscriptionwith replay-then-live ordering.
§What the library does not do
No HTTP, no CoAP, no SSE, no server runtime. Those live in the
elastik-core binary and consume this library through the unstable public
Engine API. The library does not read environment variables, does not
bind sockets, and does not depend on axum, hyper, tower,
tokio-stream, futures-util, or base64 in a default-feature build.
§Feature flags
bundled-sqlite(default) — link a bundled SQLite viarusqlite/bundled.coap(default) — enable the CoAP adapter inside the binary.multi-thread(default) — enable Tokio’s multi-thread runtime for the binary.unstable-engine— expose the publicEnginefacade. The API shape is allowed to change between minor versions while this gate stays.unstable-engine-bin(default) — superset that addsaxum,base64,futures-util, Tokionet/signal, andtracing-subscriber; theelastik-corebinary requires this feature.
Minimal library-only build: cargo build --lib --no-default-features --features bundled-sqlite,unstable-engine.
Structs§
- Audit
Broken - Audit-chain break details.
- Audit
Valid - Successful audit-chain verification details.
- Change
Event - Protocol-neutral change event delivered to subscribers.
- Delete
Metadata - Metadata recorded with a DELETE audit intent.
- DfSnapshot
- Aggregate storage/memory snapshot.
- Empty
KeyError - Returned when a secret key constructor receives an empty or all-whitespace byte string.
- Engine
- Public handle for the protocol-neutral Elastik engine.
- Engine
Builder - Builder for an
Engine. - Engine
Subscription - Subscription to protocol-neutral engine change events.
- Invalid
Proc Path - Returned when a string is not one of Engine’s known proc endpoints.
- Invalid
World Path - Returned when a world key cannot be represented as an Engine world.
- Pool
Snapshot - Read-cache + ledger-writer snapshot.
- Preconditions
- Protocol-neutral write preconditions.
- Read
Result - Result of a successful full-representation read.
- Representation
- Stored representation passed to write operations.
- Secret
Bytes - HMAC key material for the audit chain.
- Subscribe
Pattern - Normalized subscription pattern matching the existing
/listen/*grammar. - Validated
Proc Path - Validated
/proc/*introspection endpoint. - Validated
World Path - Canonical world key that passed Engine path validation.
- World
Usage - One world-size row for engine introspection.
- Write
Result - Result of a successful write.
Enums§
- Access
Tier - Access tier granted to a caller after token verification.
- Audit
Verify - Result of
crate::Engine::verify_audit. - Auth
Gate - Engine
Build Error - Errors that can occur while constructing an
Engine. - Engine
Error - Runtime operation errors reported by the Engine facade.
- Etag
Matcher - ETag matcher parsed by adapters before calling the engine.
- Proc
Endpoint - Stable proc endpoint identity carried by
ValidatedProcPath. - Subscription
Recv Error - Error returned by
EngineSubscription::recv. - Write
Kind - Whether a write created a new world or updated an existing one.
Traits§
- Engine
Delete Trace Hooks - Trace hooks for
Engine::delete_traced’s intent/delete/commit protocol. - Engine
Write Trace Hooks - Trace hooks for
Engine::replace_traced/Engine::append_traced.