Skip to main content

FjallEngine

Struct FjallEngine 

Source
pub struct FjallEngine { /* private fields */ }
Available on crate feature fjall only.
Expand description

Fjall-backed storage engine implementing all 6 storage traits.

Data directory layout:

  • objects: {collection}\0{id} → serialized MemoryObject
  • events: {stream}\0{seq:8BE} → serialized MemoryEvent
  • queue_jobs: {queue}\0{id} → serialized QueueJob
  • links_by_id: {link_id} → serialized Link
  • links_from: {from_ref}\0{type}\0{link_id}()
  • links_to: {to_ref}\0{type}\0{link_id}()

Implementations§

Source§

impl FjallEngine

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, Error>

Open or create a Fjall database at the given path. Creates all required keyspaces (partitions) on first open.

Trait Implementations§

Source§

impl AggregateStore for FjallEngine

Source§

fn aggregate( &self, collection: &str, options: &AggregateOptions, ) -> ThingdResult<AggregateResult>

Run a general aggregation query over objects in a collection. Read more
Source§

fn timeseries( &self, collection: &str, options: &TimeSeriesOptions, ) -> ThingdResult<TimeSeriesResult>

Run a time-bucketed aggregation query. Read more
Source§

impl EventLog for FjallEngine

Source§

fn is_protected_stream(&self, stream: &str) -> bool

Returns true if the stream is protected from deletion and external mutation. Protected streams (e.g. "__thingd:mcp:audit") reject delete_last_event and delete_stream calls.
Source§

fn append_event(&mut self, event: MemoryEvent) -> ThingdResult<MemoryEvent>

Append an event to a stream. Read more
Source§

fn append_events_batch( &mut self, events: Vec<MemoryEvent>, ) -> ThingdResult<Vec<MemoryEvent>>

Append multiple events to a stream in a single transaction. Read more
Source§

fn list_events( &self, stream: Option<&str>, options: ListEventsOptions, ) -> ThingdResult<Vec<MemoryEvent>>

List events, optionally filtered by stream, with pagination. Read more
Source§

fn delete_last_event( &mut self, stream: &str, ) -> ThingdResult<Option<MemoryEvent>>

Delete the most recent event from a stream. Read more
Source§

fn delete_stream(&mut self, stream: &str) -> ThingdResult<u64>

Delete all events in a stream. Read more
Source§

fn count_events(&self) -> ThingdResult<u64>

Count total events across all streams. Read more
Source§

fn list_streams(&self) -> ThingdResult<Vec<String>>

List all unique stream names. Read more
Source§

impl LinkStore for FjallEngine

Create a new graph link. Read more
Delete a graph link by id. Read more
Get a graph link by id. Read more
Source§

fn get_neighbors( &self, reference: &str, direction: LinkDirection, options: LinkQueryOptions, ) -> ThingdResult<Vec<Link>>

Get neighbors of a reference (outgoing, incoming, or both). Read more
Count total links. Read more
Source§

impl ObjectStore for FjallEngine

Source§

fn put_object(&mut self, object: MemoryObject) -> ThingdResult<MemoryObject>

Insert or replace an object. Read more
Source§

fn put_object_with_options( &mut self, object: MemoryObject, options: PutObjectOptions, ) -> ThingdResult<MemoryObject>

Insert or replace an object with explicit options. Read more
Source§

fn get_object( &self, collection: &str, id: &str, ) -> ThingdResult<Option<MemoryObject>>

Read an object by collection and id. Read more
Source§

fn get_objects_batch( &self, collection: &str, ids: &[String], ) -> ThingdResult<Vec<Option<MemoryObject>>>

Read multiple objects by collection and id in a single query. Read more
Source§

fn list_objects( &self, collections: Option<&[String]>, options: &ListObjectsOptions, ) -> ThingdResult<Vec<MemoryObject>>

List objects in one or more collections, with optional filtering, limit, and offset. Read more
Source§

fn delete_object(&mut self, collection: &str, id: &str) -> ThingdResult<bool>

Delete an object by collection and id. Read more
Source§

fn delete_objects_batch( &mut self, keys: &[(String, String)], ) -> ThingdResult<u64>

Delete multiple objects in a single transaction. Read more
Source§

fn count_objects(&self) -> ThingdResult<u64>

Count total objects across all collections. Read more
Source§

fn count_objects_in_collection(&self, collection: &str) -> ThingdResult<u64>

Count objects in a specific collection. Read more
Source§

fn list_collections(&self) -> ThingdResult<Vec<String>>

List all unique collection names. Read more
Source§

fn create_index(&mut self, _collection: &str, _field: &str) -> ThingdResult<()>

Create a functional index on a JSON body field for a collection. Read more
Source§

fn list_indexes(&self) -> ThingdResult<Vec<(String, String)>>

List all custom functional indexes. Read more
Source§

fn schema( &self, collection: Option<&str>, options: &SchemaOptions, ) -> ThingdResult<Vec<CollectionSchema>>

Reflect the schema of all or one collection by sampling stored objects. Read more
Source§

fn put_objects_batch( &mut self, objects: Vec<MemoryObject>, ) -> ThingdResult<Vec<MemoryObject>>

Insert or replace multiple objects in a single transaction. Read more
Source§

impl QueueStore for FjallEngine

Source§

fn push_job(&mut self, job: QueueJob) -> ThingdResult<QueueJob>

Push a job onto a queue. Read more
Source§

fn push_jobs_batch( &mut self, jobs: Vec<QueueJob>, ) -> ThingdResult<Vec<QueueJob>>

Push multiple jobs onto a queue in a single transaction. Read more
Source§

fn claim_job_with_options( &mut self, queue: &str, options: QueueClaimOptions, ) -> ThingdResult<Option<QueueJob>>

Claim the next ready job from a queue with explicit options. Read more
Source§

fn ack_job(&mut self, queue: &str, id: &str) -> ThingdResult<Option<QueueJob>>

Acknowledge a leased job as completed. Read more
Source§

fn nack_job_with_options( &mut self, queue: &str, id: &str, options: QueueNackOptions, ) -> ThingdResult<Option<QueueJob>>

Reject a leased job for retry or dead-letter routing with explicit options. Read more
Source§

fn list_jobs(&self, queue: &str) -> ThingdResult<Vec<QueueJob>>

List all jobs in a queue. Read more
Source§

fn list_dead_jobs(&self, queue: &str) -> ThingdResult<Vec<QueueJob>>

List dead-letter jobs in a queue. Read more
Source§

fn list_queues(&self) -> ThingdResult<Vec<String>>

List all unique queue names. Read more
Source§

fn count_active_jobs(&self) -> ThingdResult<u64>

Count total active jobs across all queues. Read more
Source§

fn count_dead_jobs(&self) -> ThingdResult<u64>

Count total dead-letter jobs across all queues. Read more
Source§

fn claim_job(&mut self, queue: &str) -> ThingdResult<Option<QueueJob>>

Claim the next ready job from a queue. Read more
Source§

fn claim_and_ack( &mut self, queue: &str, options: QueueClaimOptions, ) -> ThingdResult<Option<QueueJob>>

Claim and immediately ack a job in a single transaction. Read more
Source§

fn nack_job(&mut self, queue: &str, id: &str) -> ThingdResult<Option<QueueJob>>

Reject a leased job for retry or dead-letter routing. Read more
Source§

impl Searcher for FjallEngine

Source§

fn search( &self, query: &str, options: SearchOptions, ) -> ThingdResult<Vec<SearchHit>>

Search memory objects and event logs by query text. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Fruit for T
where T: Send + Downcast,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ThingStore for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.