pub enum ImportMode {
Fresh,
Refresh,
}Expand description
Whether an explicit import may overwrite a model already in the library.
Named rather than a bare bool because the call sites read very
differently — ImportMode::Refresh says what it does, true does not,
and the wrong value here silently rewrites a row’s tags and capabilities.
Variants§
Fresh
Refuse when the file is already registered, reporting
RepositoryError::AlreadyExists.
The default, and what an “add this file to my library” means: a duplicate is a conflict the caller should hear about, not an overwrite performed on their behalf.
Refresh
Re-derive the model’s detected metadata from the file, updating the stored row in place and keeping its database id.
This is what gglib model add --reimport asks for, and what re-importing
did unconditionally before ModelService::import_from_file began
guarding it. It refreshes tags, capabilities, quantization, context
length, the expert counts and the dialect spec — wider than model retag, which rebuilds only tags and the dialect spec.
It is narrower than “overwrite the row”, and the six columns do not all behave alike:
tags,capabilitiesanddialect_specare assigned. A refresh replaces them with whatever was just derived, including with nothing — these can be cleared.quantization,context_lengthand the expert counts are coalesced. A detector that now reads no value leaves the stored one standing rather than emptying it.name,param_count_bandarchitectureare absent from the upsert entirely, so a name the user chose survives untouched.
Trait Implementations§
Source§impl Clone for ImportMode
impl Clone for ImportMode
Source§fn clone(&self) -> ImportMode
fn clone(&self) -> ImportMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ImportMode
impl Debug for ImportMode
Source§impl Default for ImportMode
impl Default for ImportMode
Source§fn default() -> ImportMode
fn default() -> ImportMode
Source§impl PartialEq for ImportMode
impl PartialEq for ImportMode
Source§fn eq(&self, other: &ImportMode) -> bool
fn eq(&self, other: &ImportMode) -> bool
self and other values to be equal, and is used by ==.