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.
- Link
Query Options - Options for querying graph links.
- List
Events Options - Options for listing events.
- List
Objects Options - Options for listing objects in a collection.
- Memory
Engine - In-memory engine used to prove the storage boundary.
- Memory
Event - An append-only event stored in a thingd stream.
- Memory
Object - An object stored in a thingd collection.
- Object
Key - Stable object key inside a collection.
- Queue
Claim Options - Options used when claiming a queue job.
- Queue
Job - A queued unit of work.
- Queue
Nack Options - Options used when rejecting a leased queue job.
- Search
Hit - A single match returned by a search query.
- Search
Options - Options used when performing a search.
Enums§
- Link
Direction - Direction for neighbor queries.
- Queue
JobStatus - Queue job lifecycle state.
- Thingd
Error - Error type returned by thingd core operations.
Constants§
- DEFAULT_
QUEUE_ LEASE_ MS - Default queue lease duration in milliseconds.
Traits§
- Event
Log - Append-only event log operations.
- Link
Store - Graph link operations.
- Object
Store - Object storage operations.
- Queue
Store - Queue storage operations.
- Searcher
- Search operations.
- Thing
Store - Full storage interface expected from thingd engine adapters.
Type Aliases§
- Thingd
Result - Result type returned by thingd core operations.