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§
Sourcefn put_file(&mut self, file: GatewayFile, bytes: Vec<u8>) -> Result<()>
fn put_file(&mut self, file: GatewayFile, bytes: Vec<u8>) -> Result<()>
Stores a file record together with its raw bytes.
Sourcefn file(&self, file_id: &str) -> Option<GatewayFile>
fn file(&self, file_id: &str) -> Option<GatewayFile>
Returns the file record with the given id, if present.
Sourcefn file_bytes(&self, file_id: &str) -> Option<Vec<u8>>
fn file_bytes(&self, file_id: &str) -> Option<Vec<u8>>
Returns the raw bytes for the given file id, if present.
Sourcefn put_batch(&mut self, batch: GatewayBatch) -> Result<()>
fn put_batch(&mut self, batch: GatewayBatch) -> Result<()>
Stores a batch record, replacing any existing entry with the same id.
Sourcefn batch(&self, batch_id: &str) -> Option<GatewayBatch>
fn batch(&self, batch_id: &str) -> Option<GatewayBatch>
Returns the batch with the given id, if present.
Sourcefn put_thread(&mut self, thread: GatewayThread) -> Result<()>
fn put_thread(&mut self, thread: GatewayThread) -> Result<()>
Stores a thread record, replacing any existing entry with the same id.
Sourcefn thread(&self, thread_id: &str) -> Option<GatewayThread>
fn thread(&self, thread_id: &str) -> Option<GatewayThread>
Returns the thread with the given id, if present.
Sourcefn put_thread_message(&mut self, message: GatewayThreadMessage) -> Result<()>
fn put_thread_message(&mut self, message: GatewayThreadMessage) -> Result<()>
Appends a message to its thread.
Sourcefn thread_messages(&self, thread_id: &str) -> Vec<GatewayThreadMessage>
fn thread_messages(&self, thread_id: &str) -> Vec<GatewayThreadMessage>
Returns the messages for the given thread id, in insertion order.
Sourcefn put_vector_store(&mut self, vector_store: GatewayVectorStore) -> Result<()>
fn put_vector_store(&mut self, vector_store: GatewayVectorStore) -> Result<()>
Stores a vector store, replacing any existing entry with the same id.
Sourcefn vector_store(&self, vector_store_id: &str) -> Option<GatewayVectorStore>
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".