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

§Feature Flags

FeatureDefaultDescription
persistentYesEnables PersistentEngine — durable local storage
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 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§

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.
EncryptionConfigpersistent
Encryption configuration supplied at database-open time.
FieldSchema
Inferred field metadata for a collection.
IndexDefinition
A functional index definition for a top-level JSON field.
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.
MigrationRecord
A durable record of an applied schema migration.
ObjectKey
Stable object key inside a collection.
PersistentEnginepersistent
Persistent storage engine implementing all 6 storage traits.
PersistentOpenOptionspersistent
Options used when opening a persistent database.
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.
RecoveryBudget
Bounded work budget used by background storage recovery.
RetentionOptions
Explicit retention request. No records are deleted when dry_run is true.
RetentionReport
Result of an explicit retention operation.
SchemaOptions
Options for schema reflection.
SearchHit
A single match returned by a search query.
SearchOptions
Options used when performing a search.
SearchRebuildStatuspersistent
Current state of an asynchronous persistent search-index rebuild.
SortBy
Sort specification for list queries.
StaticKeyProviderpersistent
A key provider backed by a caller-supplied 32-byte key.
StorageDiagnostics
Read-only storage counts used by diagnostics and operator tooling.
StorageMaintenanceStatus
Runtime maintenance state for a durable store.
StorageValidationReportpersistent
Result of validating a native RocksDB storage directory without opening it.
StoredSchema
Persisted canonical schema metadata.
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.
VectorSearchHit
A single match returned by a vector search query.
VectorSearchOptions
Options for vector search.

Enums§

AggregateFunction
Aggregation function to apply.
LinkDirection
Direction for neighbor queries.
PersistentSearchModepersistent
Search index behavior for a persistent engine.
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.
KeyProviderpersistent
Supplies the key used to open an encrypted database.
LinkStore
Graph link operations.
ObjectStore
Object storage operations.
QueueStore
Queue storage operations.
SchemaStore
Durable schema and migration metadata operations.
Searcher
Search operations.
ThingStore
Full storage interface expected from thingd engine adapters.
VectorStore
Vector search operations.

Type Aliases§

ThingdResult
Result type returned by thingd core operations.