pub struct InMemoryDocumentStore { /* private fields */ }Expand description
内存文档存储
Q5: 用 tokio::sync::RwLock(与 InMemoryVectorStore 一致),方法内直接 .await,
不会阻塞 executor;且没有同步 _blocking 方法在 async 上下文中被调用,不存在
blocking_read/write 会 panic 的约束。
Implementations§
Source§impl InMemoryDocumentStore
impl InMemoryDocumentStore
Sourcepub fn new() -> InMemoryDocumentStore
pub fn new() -> InMemoryDocumentStore
创建新的内存文档存储
Trait Implementations§
Source§impl Default for InMemoryDocumentStore
impl Default for InMemoryDocumentStore
Source§fn default() -> InMemoryDocumentStore
fn default() -> InMemoryDocumentStore
Returns the “default value” for a type. Read more
Source§impl DocumentStore for InMemoryDocumentStore
impl DocumentStore for InMemoryDocumentStore
Source§fn add_document<'life0, 'async_trait>(
&'life0 self,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<String, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryDocumentStore: 'async_trait,
fn add_document<'life0, 'async_trait>(
&'life0 self,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<String, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryDocumentStore: 'async_trait,
添加文档
Source§fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryDocumentStore: 'async_trait,
fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryDocumentStore: 'async_trait,
批量添加文档
Source§fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryDocumentStore: 'async_trait,
fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryDocumentStore: 'async_trait,
获取文档
Source§fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryDocumentStore: 'async_trait,
fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryDocumentStore: 'async_trait,
删除文档
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryDocumentStore
impl !UnwindSafe for InMemoryDocumentStore
impl Freeze for InMemoryDocumentStore
impl Send for InMemoryDocumentStore
impl Sync for InMemoryDocumentStore
impl Unpin for InMemoryDocumentStore
impl UnsafeUnpin for InMemoryDocumentStore
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