Skip to main content

SqliteCache

Struct SqliteCache 

Source
pub struct SqliteCache { /* private fields */ }
Expand description

Persistent cache in a single SQLite file.

Implementations§

Source§

impl SqliteCache

Source

pub fn import_profile(source: &Path, id: &str) -> Result<CacheProfile>

Select a validated profile without opening the source as a writable cache.

Source

pub fn import_from( source: &Path, destination: &Path, profile: &CacheProfile, mappings: &[CacheImportMapping], ) -> Result<CacheImportReport>

Seed an absent or completely empty v7 cache from verified local files. Schema v6 and v7 sources are supported; derived image codes are ignored. Errors roll back schema and data; verification failures drop individual resources and are reported as counts. PDF/audio preparation compatibility is also checked by the runtime on reuse.

Source§

impl SqliteCache

Source

pub fn default_path() -> Result<PathBuf>

The default location: <platform cache dir>/seyk/cache.sqlite3.

macOS: ~/Library/Caches/seyk/, Linux: $XDG_CACHE_HOME/seyk/ (usually ~/.cache/seyk/).

Source

pub fn open_default() -> Result<Self>

Source

pub fn open(path: impl Into<PathBuf>) -> Result<Self>

Open or create a cache file. Embeddings can leak information about their source text, so owned directories and the cache file are private to the user.

Source

pub fn path(&self) -> &Path

Trait Implementations§

Source§

impl EmbeddingCache for SqliteCache

Source§

fn scrub(&mut self) -> Result<CacheCleanup>

Erase stale FTS postings and historical WAL frames. Busy readers leave work pending.
Source§

fn scrub_if_idle(&mut self, quiet: Duration) -> Result<Option<CacheCleanup>>

Attempt a background scrub after this long without writes. Busy work is retried at the same interval, rather than on every scheduler tick.
Source§

fn scrub_delay(&self, quiet: Duration) -> Duration

Scheduler delay until the next quiet-period/retry deadline. When idle, check at this interval to observe activity from other processes.
Source§

fn register_profile(&mut self, id: &str, profile: &CacheProfile) -> Result<()>

Source§

fn resource_index( &self, profile: &str, ) -> Result<HashMap<ResourceId, CachedResourceState>>

Every cached resource for a profile, keyed by identity. Segments are not loaded.
Source§

fn resource( &self, profile: &str, path: &ResourceId, ) -> Result<Option<CachedResource>>

Source§

fn put_resource( &mut self, profile: &str, path: &ResourceId, resource: &ResourceWrite<'_>, ) -> Result<()>

Replace a resource and its segments.
Source§

fn touch_resource( &mut self, profile: &str, path: &ResourceId, metadata: &ResourceMetadata, version: &ResourceVersion, ) -> Result<()>

Update metadata and version when content is unchanged.
Source§

fn remove_resources( &mut self, profile: &str, paths: &[ResourceId], ) -> Result<()>

Source§

fn known_inputs( &self, profile: &str, hashes: &[String], ) -> Result<HashSet<String>>

Which of hashes already have a vector.
Source§

fn put_embeddings( &mut self, profile: &str, items: &[(String, Vec<f32>)], ) -> Result<()>

Source§

fn supports_image_codes(&self) -> bool

Whether persistent Photo Anchor representations are supported.
Source§

fn sync_image_codes( &mut self, profile: &str, paths: &HashSet<ResourceId>, ) -> Result<()>

Derive missing image codes from retained f32 during an opted-in sync.
Source§

fn image_scan_rows( &self, profile: &str, paths: &HashSet<ResourceId>, ) -> Result<Vec<ScanVector>>

Read representations without writing or loading f32 for coded images.
Source§

fn selected_image_vectors( &self, profile: &str, hashes: &HashSet<String>, ) -> Result<HashMap<String, Vec<f32>>>

Fetch only selected f32 vectors, deduplicated by input hash.
Source§

fn vectors_for( &self, profile: &str, paths: &HashSet<ResourceId>, ) -> Result<Vec<StoredVector>>

All searchable vectors for the given paths.
Segments of paths matching query by keyword, best first, at most limit. Equal scores are ordered by path bytes, then segment ordinal.
Source§

fn lexical_matched_terms( &self, profile: &str, query: &LexicalQuery, keys: &[(ResourceId, usize)], ) -> Result<Vec<Vec<String>>>

Query tokens confirmed by the cached index for the requested segments. Called only for final hits ranked by the keyword leg, after fusion and eligibility checks. Return one term list per key, in the same order. Never recover source text; report only complete matching query groups.
Source§

fn prune_orphans(&mut self, profile: &str) -> Result<u64>

Drop vectors no segment refers to any more.
Source§

fn stats(&self) -> Result<CacheStats>

Source§

fn clear(&mut self) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.