Skip to main content

Crate thingd

Crate thingd 

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 Fjall adapter for persistent storage.

§Feature Flags

FeatureDefaultDescription
fjallYesEnables FjallEngine — pure Rust LSM-tree persistent storage
migrateNoEnables [SqliteThingStore] for one-time migration from SQLite
connectorsNoEnables 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§

AggregateGroupResult
A single group result from aggregation.
AggregateOptions
Options for a general aggregation query.
AggregateResult
Result of an aggregation query.
CollectionSchema
Reflected schema for a collection.
FieldSchema
Inferred field metadata for a collection.
FjallEnginefjall
Fjall-backed storage engine implementing all 6 storage traits.
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.
PutObjectOptions
Options for putting an object.
QueueClaimOptions
Options used when claiming a queue job.
QueueJob
A queued unit of work.
QueueNackOptions
Options used when rejecting a leased queue job.
SchemaOptions
Options for schema reflection.
SearchHit
A single match returned by a search query.
SearchOptions
Options used when performing a search.
SortBy
Sort specification for list queries.
TimeSeriesBucket
A single time bucket from time-series aggregation.
TimeSeriesOptions
Options for a time-series aggregation query.
TimeSeriesResult
Result of a time-series aggregation query.

Enums§

AggregateFunction
Aggregation function to apply.
LinkDirection
Direction for neighbor queries.
QueueJobStatus
Queue job lifecycle state.
SortDirection
Sort direction for list queries.
ThingdError
Error type returned by thingd core operations.
TimeBucket
Time bucket size for time-series aggregation.

Constants§

DEFAULT_QUEUE_LEASE_MS
Default queue lease duration in milliseconds.

Traits§

AggregateStore
Aggregation operations.
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.