Skip to main content

GatewayStateStore

Trait GatewayStateStore 

Source
pub trait GatewayStateStore {
    // Required methods
    fn put_file(&mut self, file: GatewayFile, bytes: Vec<u8>) -> Result<()>;
    fn file(&self, file_id: &str) -> Option<GatewayFile>;
    fn file_bytes(&self, file_id: &str) -> Option<Vec<u8>>;
    fn put_batch(&mut self, batch: GatewayBatch) -> Result<()>;
    fn batch(&self, batch_id: &str) -> Option<GatewayBatch>;
    fn put_thread(&mut self, thread: GatewayThread) -> Result<()>;
    fn thread(&self, thread_id: &str) -> Option<GatewayThread>;
    fn put_thread_message(
        &mut self,
        message: GatewayThreadMessage,
    ) -> Result<()>;
    fn thread_messages(&self, thread_id: &str) -> Vec<GatewayThreadMessage>;
    fn put_vector_store(
        &mut self,
        vector_store: GatewayVectorStore,
    ) -> Result<()>;
    fn vector_store(&self, vector_store_id: &str) -> Option<GatewayVectorStore>;
}
Expand description

Store for the gateway’s durable account state: files, batches, threads, thread messages, and vector stores, all keyed by their string ids.

Required Methods§

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§