pub struct MemoryGatewayStore { /* private fields */ }Expand description
In-memory gateway store backed by BTreeMaps.
Implements GatewayStore, GatewayResponseObjectStore, and
GatewayStateStore. Intended for tests and single-process use; nothing is
persisted beyond the process.
Implementations§
Source§impl MemoryGatewayStore
impl MemoryGatewayStore
Sourcepub fn put_request_content(
&mut self,
request: GatewayRequest,
) -> Result<ContentId>
pub fn put_request_content( &mut self, request: GatewayRequest, ) -> Result<ContentId>
Stores a request under its derived content id and returns that id.
Sourcepub fn put_run_content(&mut self, run: GatewayRun) -> Result<ContentId>
pub fn put_run_content(&mut self, run: GatewayRun) -> Result<ContentId>
Stores a run under its derived content id and returns that id.
Sourcepub fn put_event_content(&mut self, event: GatewayEvent) -> Result<ContentId>
pub fn put_event_content(&mut self, event: GatewayEvent) -> Result<ContentId>
Stores an event under its derived content id and returns that id.
Sourcepub fn put_response_content(
&mut self,
response: GatewayResponse,
) -> Result<ContentId>
pub fn put_response_content( &mut self, response: GatewayResponse, ) -> Result<ContentId>
Stores a response under its derived content id and returns that id.
Sourcepub fn counts(&self) -> GatewayStoreCounts
pub fn counts(&self) -> GatewayStoreCounts
Returns a snapshot of the current record counts.
Sourcepub fn requests(&self) -> Vec<(ContentId, GatewayRequest)>
pub fn requests(&self) -> Vec<(ContentId, GatewayRequest)>
Returns all stored requests paired with their content ids.
Sourcepub fn runs(&self) -> Vec<(ContentId, GatewayRun)>
pub fn runs(&self) -> Vec<(ContentId, GatewayRun)>
Returns all stored runs paired with their content ids.
Sourcepub fn run_by_id(&self, run_id: &str) -> Option<(ContentId, GatewayRun)>
pub fn run_by_id(&self, run_id: &str) -> Option<(ContentId, GatewayRun)>
Returns the run (with its content id) whose run id matches run_id.
Sourcepub fn events(&self) -> Vec<(ContentId, GatewayEvent)>
pub fn events(&self) -> Vec<(ContentId, GatewayEvent)>
Returns all stored events paired with their content ids.
Trait Implementations§
Source§impl Clone for MemoryGatewayStore
impl Clone for MemoryGatewayStore
Source§fn clone(&self) -> MemoryGatewayStore
fn clone(&self) -> MemoryGatewayStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryGatewayStore
impl Debug for MemoryGatewayStore
Source§impl Default for MemoryGatewayStore
impl Default for MemoryGatewayStore
Source§fn default() -> MemoryGatewayStore
fn default() -> MemoryGatewayStore
Returns the “default value” for a type. Read more
Source§impl GatewayResponseObjectStore for MemoryGatewayStore
impl GatewayResponseObjectStore for MemoryGatewayStore
Source§fn put_response_object(&mut self, response: StoredGatewayResponse) -> Result<()>
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>
fn response_object(&self, response_id: &str) -> Option<StoredGatewayResponse>
Returns the response object with the given id, if present.
Source§impl GatewayStateStore for MemoryGatewayStore
impl GatewayStateStore for MemoryGatewayStore
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn batch(&self, batch_id: &str) -> Option<GatewayBatch>
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<()>
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>
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<()>
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>
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<()>
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>
fn vector_store(&self, vector_store_id: &str) -> Option<GatewayVectorStore>
Returns the vector store with the given id, if present.
Source§impl GatewayStore for MemoryGatewayStore
impl GatewayStore for MemoryGatewayStore
Source§fn put_request(&mut self, id: ContentId, request: GatewayRequest) -> Result<()>
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>
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<()>
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>
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<()>
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>
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<()>
fn put_response( &mut self, id: ContentId, response: GatewayResponse, ) -> Result<()>
Stores a response under its content id.
Auto Trait Implementations§
impl Freeze for MemoryGatewayStore
impl RefUnwindSafe for MemoryGatewayStore
impl Send for MemoryGatewayStore
impl Sync for MemoryGatewayStore
impl Unpin for MemoryGatewayStore
impl UnsafeUnpin for MemoryGatewayStore
impl UnwindSafe for MemoryGatewayStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more