pub struct SqliteVersionRepo { /* private fields */ }Expand description
SQLite-backed version repository with ACID guarantees.
Maintains an in-memory cache synchronized with the database
so that the VersionRepo trait (which returns references) works.
Implementations§
Source§impl SqliteVersionRepo
impl SqliteVersionRepo
Sourcepub fn new(vault_path: &Path) -> Result<Self>
pub fn new(vault_path: &Path) -> Result<Self>
Open (or create) a SQLite version database in the vault directory.
If a legacy versions.json file exists, it is auto-migrated
into the database, then renamed to versions.json.migrated.
Sourcepub fn in_memory() -> Result<Self>
pub fn in_memory() -> Result<Self>
Create an in-memory SQLite version repository (for testing).
Sourcepub fn vault_path(&self) -> &Path
pub fn vault_path(&self) -> &Path
Return the vault directory path.
Trait Implementations§
Source§impl VersionRepo for SqliteVersionRepo
Available on crate feature sqlite only.
impl VersionRepo for SqliteVersionRepo
Available on crate feature
sqlite only.Source§fn add_version(
&mut self,
model: &str,
file_path: &str,
format: &str,
size_bytes: u64,
compressed_size_bytes: u64,
checksum: &str,
metadata: Option<HashMap<String, String>>,
parent_version: Option<u32>,
) -> Result<ModelVersion>
fn add_version( &mut self, model: &str, file_path: &str, format: &str, size_bytes: u64, compressed_size_bytes: u64, checksum: &str, metadata: Option<HashMap<String, String>>, parent_version: Option<u32>, ) -> Result<ModelVersion>
Add a new version for a model.
Source§fn get_version(
&self,
model: &str,
version: Option<u32>,
) -> Option<&ModelVersion>
fn get_version( &self, model: &str, version: Option<u32>, ) -> Option<&ModelVersion>
Get a specific version, or the latest if version is None.
Source§fn list_versions(&self, model: &str) -> Vec<&ModelVersion>
fn list_versions(&self, model: &str) -> Vec<&ModelVersion>
List all versions of a model, sorted by version number.
Source§fn get_lineage(&self, model: &str, version: u32) -> Vec<&ModelVersion>
fn get_lineage(&self, model: &str, version: u32) -> Vec<&ModelVersion>
Get the lineage chain for a version.
Source§fn delete_version(&mut self, model: &str, version: u32) -> Result<bool>
fn delete_version(&mut self, model: &str, version: u32) -> Result<bool>
Delete a specific version. Returns true if it existed.
Source§fn cleanup_old_versions(
&mut self,
model: &str,
keep_count: usize,
) -> Result<Vec<u32>>
fn cleanup_old_versions( &mut self, model: &str, keep_count: usize, ) -> Result<Vec<u32>>
Clean up old versions, keeping
keep_count most recent.Source§fn verify_checksum(&self, model: &str, version: u32, data: &[u8]) -> bool
fn verify_checksum(&self, model: &str, version: u32, data: &[u8]) -> bool
Verify data checksum against stored checksum.
Source§fn update_metadata(
&mut self,
model: &str,
version: u32,
key: &str,
value: String,
) -> Result<()>
fn update_metadata( &mut self, model: &str, version: u32, key: &str, value: String, ) -> Result<()>
Update metadata for a version.
Source§fn get_metadata(&self, model: &str, version: u32, key: &str) -> Option<String>
fn get_metadata(&self, model: &str, version: u32, key: &str) -> Option<String>
Get metadata for a version.
Source§fn list_models(&self) -> Vec<String>
fn list_models(&self) -> Vec<String>
List all model names.
Auto Trait Implementations§
impl Freeze for SqliteVersionRepo
impl RefUnwindSafe for SqliteVersionRepo
impl Send for SqliteVersionRepo
impl Sync for SqliteVersionRepo
impl Unpin for SqliteVersionRepo
impl UnsafeUnpin for SqliteVersionRepo
impl UnwindSafe for SqliteVersionRepo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.