Expand description
Storage module for persisting document indices.
This module provides:
- Workspace — An async directory-based document collection manager with LRU cache
- Persistence — Save/load document trees and metadata with atomic writes
- Cache — LRU cache for loaded documents
- Lock — File locking for multi-process safety
- Backend — Storage backend abstraction (file, memory, etc.)
§Example
use vectorless::storage::{Workspace, PersistedDocument, DocumentMeta};
use vectorless::document::DocumentTree;
// Create a workspace
let workspace = Workspace::new("./my_workspace").await?;
// Add a document
let meta = DocumentMeta::new("doc-1", "My Document", "md");
let tree = DocumentTree::new("Root", "Content");
let doc = PersistedDocument::new(meta, tree);
workspace.add(&doc).await?;
// Load it back (uses LRU cache)
let loaded = workspace.load_and_cache("doc-1").await?.unwrap();Re-exports§
pub use backend::FileBackend;pub use backend::MemoryBackend;pub use backend::StorageBackend;pub use cache::DocumentCache;pub use codec::Codec;pub use codec::GzipCodec;pub use codec::IdentityCodec;pub use codec::codec_from_config;pub use lock::FileLock;pub use lock::ScopedLock;pub use migration::CURRENT_VERSION;pub use migration::Migration;pub use migration::MigrationContext;pub use migration::Migrator;pub use workspace::DocumentMetaEntry;pub use workspace::Workspace;pub use workspace::WorkspaceOptions;
Modules§
- backend
- Storage backend abstraction.
- cache
- Document cache with LRU eviction policy.
- codec
- Codec abstraction for compression and decompression.
- lock
- File locking for workspace safety.
- migration
- Version migration system for persisted data.
- workspace
- Async workspace management for document collections.
Structs§
- Document
Meta - Metadata for a persisted document.
- Page
Content - Content for a single page.
- Persisted
Document - A persisted document index containing tree and metadata.
- Persistence
Options - Options for save/load operations.
Functions§
- load_
document - Load a document from a JSON file with checksum verification.
- load_
document_ from_ bytes - Deserialize a document from bytes.
- load_
document_ with_ options - Load a document with custom options.
- load_
index - Load the workspace index.
- load_
index_ from_ bytes - Deserialize an index from bytes.
- load_
index_ with_ options - Load the workspace index with custom options.
- save_
document - Save a document to a JSON file with atomic write and checksum.
- save_
document_ to_ bytes - Serialize a document to bytes (JSON with checksum wrapper).
- save_
document_ with_ options - Save a document with custom options.
- save_
index - Save the workspace index (metadata for all documents).
- save_
index_ to_ bytes - Serialize an index to bytes.
- save_
index_ with_ options - Save the workspace index with custom options.