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 persistent storage adapter.
§Feature Flags
| Feature | Default | Description |
|---|---|---|
persistent | Yes | Enables PersistentEngine — durable local storage |
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 storage)
use thingd::{PersistentEngine, ObjectStore, MemoryObject};
let mut db = PersistentEngine::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"}"#);Re-exports§
pub use replication::REPLICATION_PROVENANCE_COLLECTION;pub use replication::REPLICATION_QUARANTINE_COLLECTION;pub use replication::REPLICATION_STATE_COLLECTION;pub use replication::REPLICATION_STREAM;pub use replication::REPLICATION_TOMBSTONE_COLLECTION;pub use replication::ReplicationApplyResult;pub use replication::ReplicationChange;pub use replication::ReplicationConfig;pub use replication::ReplicationPage;pub use replication::ReplicationRole;pub use replication::ReplicationService;pub use replication::ReplicationSnapshot;pub use replication::ReplicationStatus;
Modules§
- replication
- Provider-neutral replication primitives shared by HTTP and native callers.
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.
- Encryption
Config persistent - Encryption configuration supplied at database-open time.
- Field
Schema - Inferred field metadata for a collection.
- Index
Definition - A functional index definition for a top-level JSON field.
- 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.
- Migration
Record - A durable record of an applied schema migration.
- Object
Key - Stable object key inside a collection.
- Persistent
Engine persistent - Persistent storage engine implementing all 6 storage traits.
- Persistent
Open Options persistent - Options used when opening a persistent database.
- 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.
- Retention
Options - Explicit retention request. No records are deleted when
dry_runis true. - Retention
Report - Result of an explicit retention operation.
- Schema
Options - Options for schema reflection.
- Search
Hit - A single match returned by a search query.
- Search
Options - Options used when performing a search.
- Search
Rebuild Status persistent - Current state of an asynchronous persistent search-index rebuild.
- SortBy
- Sort specification for list queries.
- Static
KeyProvider persistent - A key provider backed by a caller-supplied 32-byte key.
- Storage
Diagnostics - Read-only storage counts used by diagnostics and operator tooling.
- Storage
Validation Report persistent - Result of validating a native storage directory without opening Fjall.
- Stored
Schema - Persisted canonical schema metadata.
- 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.
- Vector
Search Hit - A single match returned by a vector search query.
- Vector
Search Options - Options for vector search.
Enums§
- Aggregate
Function - Aggregation function to apply.
- Link
Direction - Direction for neighbor queries.
- Persistent
Search Mode persistent - Search index behavior for a persistent engine.
- 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.
- KeyProvider
persistent - Supplies the key used to open an encrypted database.
- Link
Store - Graph link operations.
- Object
Store - Object storage operations.
- Queue
Store - Queue storage operations.
- Schema
Store - Durable schema and migration metadata operations.
- Searcher
- Search operations.
- Thing
Store - Full storage interface expected from thingd engine adapters.
- Vector
Store - Vector search operations.
Type Aliases§
- Thingd
Result - Result type returned by thingd core operations.