Shorten workspace directory names to app, bot and core

This commit is contained in:
2026-12-03 04:26:31 +08:00
parent 3ae1097e1b
commit ef251ae339
28 changed files with 4 additions and 4 deletions
+34
View File
@@ -0,0 +1,34 @@
//! Persistence boundary. A read view must represent a single committed revision.
use crate::{Document, DocumentId};
use std::{borrow::Cow, collections::BTreeMap};
pub type Postings = BTreeMap<DocumentId, [usize; 2]>;
#[derive(Clone, Debug)]
pub struct IndexedDocument {
pub document: Document,
pub title: String,
pub body: String,
pub lengths: [usize; 2],
pub frequencies: BTreeMap<String, [usize; 2]>,
}
pub trait IndexReader {
type Error;
/// Document count and total token counts in the short and body fields.
fn statistics(&self) -> Result<(usize, [usize; 2]), Self::Error>;
fn postings(&self, term: &str) -> Result<Option<Cow<'_, Postings>>, Self::Error>;
/// IDs come from this snapshot's posting lists and must resolve.
fn document(&self, id: DocumentId) -> Result<Cow<'_, IndexedDocument>, Self::Error>;
}
pub trait IndexStore {
type Error;
type Reader<'a>: IndexReader<Error = Self::Error>
where
Self: 'a;
fn snapshot(&self) -> Result<Self::Reader<'_>, Self::Error>;
/// Atomically replace the old document, its postings and field statistics.
fn replace(&mut self, entry: IndexedDocument) -> Result<(), Self::Error>;
fn delete(&mut self, id: DocumentId) -> Result<bool, Self::Error>;
}