Skip to main content

TableGatewayStore

Struct TableGatewayStore 

Source
pub struct TableGatewayStore { /* private fields */ }
Expand description

Gateway store that keeps every record kind in its own SIM Table.

Each slot is a SIM table value guarded by a shared Cx; records are wrapped as opaque table values keyed by content id or string id. Implements GatewayStore, GatewayResponseObjectStore, and GatewayStateStore.

Implementations§

Source§

impl TableGatewayStore

Source

pub fn new() -> Result<Self>

Creates a store with a fresh table for every record kind.

Returns an error only if SIM table creation fails, which does not happen for the in-memory tables used here.

Trait Implementations§

Source§

impl Default for TableGatewayStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GatewayResponseObjectStore for TableGatewayStore

Source§

fn put_response_object(&mut self, response: StoredGatewayResponse) -> Result<()>

Stores a response object, replacing any existing entry with the same id.
Source§

fn response_object(&self, response_id: &str) -> Option<StoredGatewayResponse>

Returns the response object with the given id, if present.
Source§

impl GatewayStateStore for TableGatewayStore

Source§

fn put_file(&mut self, file: GatewayFile, bytes: Vec<u8>) -> Result<()>

Stores a file record together with its raw bytes.
Source§

fn file(&self, file_id: &str) -> Option<GatewayFile>

Returns the file record with the given id, if present.
Source§

fn file_bytes(&self, file_id: &str) -> Option<Vec<u8>>

Returns the raw bytes for the given file id, if present.
Source§

fn put_batch(&mut self, batch: GatewayBatch) -> Result<()>

Stores a batch record, replacing any existing entry with the same id.
Source§

fn batch(&self, batch_id: &str) -> Option<GatewayBatch>

Returns the batch with the given id, if present.
Source§

fn put_thread(&mut self, thread: GatewayThread) -> Result<()>

Stores a thread record, replacing any existing entry with the same id.
Source§

fn thread(&self, thread_id: &str) -> Option<GatewayThread>

Returns the thread with the given id, if present.
Source§

fn put_thread_message(&mut self, message: GatewayThreadMessage) -> Result<()>

Appends a message to its thread.
Source§

fn thread_messages(&self, thread_id: &str) -> Vec<GatewayThreadMessage>

Returns the messages for the given thread id, in insertion order.
Source§

fn put_vector_store(&mut self, vector_store: GatewayVectorStore) -> Result<()>

Stores a vector store, replacing any existing entry with the same id.
Source§

fn vector_store(&self, vector_store_id: &str) -> Option<GatewayVectorStore>

Returns the vector store with the given id, if present.
Source§

impl GatewayStore for TableGatewayStore

Source§

fn put_request(&mut self, id: ContentId, request: GatewayRequest) -> Result<()>

Stores a request under its content id.
Source§

fn request(&self, id: &ContentId) -> Option<GatewayRequest>

Returns the request stored under id, if present.
Source§

fn put_run(&mut self, id: ContentId, run: GatewayRun) -> Result<()>

Stores a run under its content id.
Source§

fn run(&self, id: &ContentId) -> Option<GatewayRun>

Returns the run stored under id, if present.
Source§

fn put_event(&mut self, id: ContentId, event: GatewayEvent) -> Result<()>

Stores an event under its content id.
Source§

fn event(&self, id: &ContentId) -> Option<GatewayEvent>

Returns the event stored under id, if present.
Source§

fn put_response( &mut self, id: ContentId, response: GatewayResponse, ) -> Result<()>

Stores a response under its content id.
Source§

fn response(&self, id: &ContentId) -> Option<GatewayResponse>

Returns the response stored under id, if present.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.