Skip to main content

Crate thingd_core

Crate thingd_core 

Source
Expand description

Core primitives for thingd.

This crate owns the durable engine boundary: object storage, append-only events, and queue storage. The default implementation is in-memory, with a feature-gated SQLite adapter available for durable object, event, and queue storage.

§Example

use thingd_core::{MemoryEngine, ObjectStore, EventLog, MemoryObject, MemoryEvent};

let mut engine = MemoryEngine::new();

// Store an object
let obj = MemoryObject::new("users", "alice", r#"{"name":"Alice"}"#);
engine.put_object(obj).unwrap();

// Retrieve it
let user = engine.get_object("users", "alice").unwrap();
assert_eq!(user.unwrap().body, r#"{"name":"Alice"}"#);

// Append an event
let event = MemoryEvent::new("audit", "user.created", r#"{"user":"alice"}"#);
engine.append_event(event).unwrap();

Structs§

Link
A graph link connecting two references.
LinkQueryOptions
Options for querying graph links.
ListEventsOptions
Options for listing events.
ListObjectsOptions
Options for listing objects in a collection.
MemoryEngine
In-memory engine used to prove the storage boundary.
MemoryEvent
An append-only event stored in a thingd stream.
MemoryObject
An object stored in a thingd collection.
ObjectKey
Stable object key inside a collection.
QueueClaimOptions
Options used when claiming a queue job.
QueueJob
A queued unit of work.
QueueNackOptions
Options used when rejecting a leased queue job.
SearchHit
A single match returned by a search query.
SearchOptions
Options used when performing a search.

Enums§

LinkDirection
Direction for neighbor queries.
QueueJobStatus
Queue job lifecycle state.
ThingdError
Error type returned by thingd core operations.

Constants§

DEFAULT_QUEUE_LEASE_MS
Default queue lease duration in milliseconds.

Traits§

EventLog
Append-only event log operations.
LinkStore
Graph link operations.
ObjectStore
Object storage operations.
QueueStore
Queue storage operations.
Searcher
Search operations.
ThingStore
Full storage interface expected from thingd engine adapters.

Type Aliases§

ThingdResult
Result type returned by thingd core operations.