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::new(Bytes::from_static(b"hi"), "text/plain", 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 protocol adapters and no server runtime. Those live in the elastik-bin
package’s elastik-core binary and consume this library through the
unstable public Engine API. In a minimal library-only build, the library
does not read environment variables, does not bind sockets, and does not
depend on protocol-adapter transport crates.
§Feature flags
bundled-sqlite(default) — link a bundled SQLite viarusqlite/bundled.unstable-engine— expose the publicEnginefacade. The API shape is allowed to change between minor versions while this gate stays.
Binary adapter features such as coap, mqtt, and multi-thread live in
bin/Cargo.toml, not in this library package.
Minimal library-only build from the repository root:
cargo build --manifest-path core/Cargo.toml --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 - Change
Verb - Kind of storage mutation that produced a change event.
- 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.
Constants§
- DEFAULT_
LISTEN_ REPLAY_ MAX - DEFAULT_
MAX_ LISTEN_ CONNECTIONS - DEFAULT_
MAX_ MEMORY_ BYTES - DEFAULT_
MAX_ WORLD_ BYTES - DEFAULT_
READ_ CACHE_ MAX_ ENTRIES - NAMESPACE_
PREFIXES - Canonical Engine world namespaces.
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.
Functions§
- is_
valid_ token - Returns true when raw token bytes can represent a configured or candidate Engine token.
- validate_
world_ name - Returns the specific rejection reason so adapters can surface precise diagnostics instead of a blanket invalid-path error.