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 Fjall adapter for persistent storage.
§Feature Flags
| Feature | Default | Description |
|---|---|---|
fjall | Yes | Enables FjallEngine — pure Rust LSM-tree persistent storage |
migrate | No | Enables [SqliteThingStore] for one-time migration from SQLite |
connectors | No | Enables CSV/JSON file connectors for data import |
§Example (in-memory)
use thingd::{MemoryEngine, ObjectStore, EventLog, MemoryObject, MemoryEvent};
let mut engine = MemoryEngine::new();
let obj = MemoryObject::new("users", "alice", r#"{"name":"Alice"}"#);
engine.put_object(obj).unwrap();
let user = engine.get_object("users", "alice").unwrap();
assert_eq!(user.unwrap().body, r#"{"name":"Alice"}"#);
let event = MemoryEvent::new("audit", "user.created", r#"{"user":"alice"}"#);
engine.append_event(event).unwrap();§Example (persistent — Fjall)
use thingd::{FjallEngine, ObjectStore, MemoryObject};
let mut db = FjallEngine::open("/tmp/thingd-data").unwrap();
db.put_object(MemoryObject::new("users", "alice", r#"{"name":"Alice"}"#)).unwrap();
let user = db.get_object("users", "alice").unwrap();
assert_eq!(user.unwrap().body, r#"{"name":"Alice"}"#);Structs§
- Aggregate
Group Result - A single group result from aggregation.
- Aggregate
Options - Options for a general aggregation query.
- Aggregate
Result - Result of an aggregation query.
- Collection
Schema - Reflected schema for a collection.
- Field
Schema - Inferred field metadata for a collection.
- Fjall
Engine fjall - Fjall-backed storage engine implementing all 6 storage traits.
- 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.
- PutObject
Options - Options for putting an object.
- 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.
- Schema
Options - Options for schema reflection.
- Search
Hit - A single match returned by a search query.
- Search
Options - Options used when performing a search.
- SortBy
- Sort specification for list queries.
- Time
Series Bucket - A single time bucket from time-series aggregation.
- Time
Series Options - Options for a time-series aggregation query.
- Time
Series Result - Result of a time-series aggregation query.
Enums§
- Aggregate
Function - Aggregation function to apply.
- Link
Direction - Direction for neighbor queries.
- Queue
JobStatus - Queue job lifecycle state.
- Sort
Direction - Sort direction for list queries.
- Thingd
Error - Error type returned by thingd core operations.
- Time
Bucket - Time bucket size for time-series aggregation.
Constants§
- DEFAULT_
QUEUE_ LEASE_ MS - Default queue lease duration in milliseconds.
Traits§
- Aggregate
Store - Aggregation operations.
- 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.