pub struct PluginLockfile { /* private fields */ }Expand description
A plugin lockfile that tracks installed plugins, their sources, and integrity hashes.
Implementations§
Source§impl PluginLockfile
impl PluginLockfile
Sourcepub fn load(path: &Path) -> PluginResult<Self>
pub fn load(path: &Path) -> PluginResult<Self>
Load a lockfile from disk.
Acquires a shared (read) lock on a .lk sibling file to coordinate
with concurrent writers.
§Errors
Returns an error if the file cannot be read or parsed.
Sourcepub fn load_or_default(path: &Path) -> PluginResult<Self>
pub fn load_or_default(path: &Path) -> PluginResult<Self>
Load a lockfile from disk, returning an empty lockfile if the file doesn’t exist.
Uses an atomic read pattern to avoid TOCTOU races: attempts to read
the file and handles NotFound instead of checking exists() first.
§Errors
Returns an error if the file exists but cannot be read or parsed.
Sourcepub fn update<F>(path: &Path, f: F) -> PluginResult<()>
pub fn update<F>(path: &Path, f: F) -> PluginResult<()>
Atomically load, mutate, and save the lockfile under a single exclusive lock.
Prevents TOCTOU races between concurrent plugin install / plugin remove operations that would otherwise load → drop lock → re-acquire
→ save, allowing another process to interleave and lose entries.
If the lockfile doesn’t exist, the closure receives an empty lockfile.
§Errors
Returns an error if the file cannot be read, parsed, or written, or if the closure returns an error.
Sourcepub fn save(&self, path: &Path) -> PluginResult<()>
pub fn save(&self, path: &Path) -> PluginResult<()>
Save the lockfile to disk atomically.
Writes to a temporary file in the same directory (same filesystem),
then atomically renames it into place. Acquires an exclusive lock
on a .lk sibling file to coordinate with concurrent readers/writers.
Creates parent directories if needed.
§Errors
Returns an error if the file cannot be written.
Sourcepub fn add(&mut self, entry: LockedPlugin)
pub fn add(&mut self, entry: LockedPlugin)
Add or update a locked plugin entry.
If a plugin with the same ID already exists, it is replaced.
Sourcepub fn remove(&mut self, id: &PluginId) -> bool
pub fn remove(&mut self, id: &PluginId) -> bool
Remove a plugin entry by ID.
Returns true if an entry was removed.
Sourcepub fn get(&self, id: &PluginId) -> Option<&LockedPlugin>
pub fn get(&self, id: &PluginId) -> Option<&LockedPlugin>
Look up a locked plugin entry by ID.
Sourcepub fn entries(&self) -> &[LockedPlugin]
pub fn entries(&self) -> &[LockedPlugin]
Get all locked plugin entries.
Sourcepub fn verify_integrity(&self, plugin_dir: &Path) -> Vec<IntegrityViolation>
pub fn verify_integrity(&self, plugin_dir: &Path) -> Vec<IntegrityViolation>
Verify the integrity of installed plugins against the lockfile.
For each entry, checks:
- The plugin directory and manifest exist on disk.
- The manifest version matches the lockfile version.
- The WASM module blake3 hash matches the lockfile hash.
Returns a list of violations (empty if everything is consistent).
Trait Implementations§
Source§impl Clone for PluginLockfile
impl Clone for PluginLockfile
Source§fn clone(&self) -> PluginLockfile
fn clone(&self) -> PluginLockfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PluginLockfile
impl Debug for PluginLockfile
Source§impl Default for PluginLockfile
impl Default for PluginLockfile
Source§impl<'de> Deserialize<'de> for PluginLockfile
impl<'de> Deserialize<'de> for PluginLockfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PluginLockfile
impl RefUnwindSafe for PluginLockfile
impl Send for PluginLockfile
impl Sync for PluginLockfile
impl Unpin for PluginLockfile
impl UnsafeUnpin for PluginLockfile
impl UnwindSafe for PluginLockfile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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>
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>
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 more