pub struct PackageManager { /* private fields */ }Expand description
Installs collection package versions into versioned directories.
Implementations§
Source§impl PackageManager
impl PackageManager
pub fn new(root: impl Into<PathBuf>, db: NodeDatabase) -> Self
pub fn root(&self) -> &Path
Sourcepub fn state(&self) -> Result<CollectionState>
pub fn state(&self) -> Result<CollectionState>
§Errors
Returns an error if state cannot be read or decoded.
Sourcepub fn available_versions(&self) -> Result<BTreeMap<Uuid, Version>>
pub fn available_versions(&self) -> Result<BTreeMap<Uuid, Version>>
Return the currently selected version for each installed collection.
§Errors
Returns an error if an installed version is not valid semver.
Sourcepub fn install(
&self,
manifest: &CollectionManifest,
source: impl AsRef<Path>,
) -> Result<()>
pub fn install( &self, manifest: &CollectionManifest, source: impl AsRef<Path>, ) -> Result<()>
Stage, verify, and atomically make a collection version current.
§Errors
Returns an error when source content does not match the manifest or installation fails.
Sourcepub async fn install_from_ticket(
&self,
manifest_ticket: &BlobTicket,
endpoint: &Endpoint,
blobs: &BlobStore,
) -> Result<CollectionManifest>
pub async fn install_from_ticket( &self, manifest_ticket: &BlobTicket, endpoint: &Endpoint, blobs: &BlobStore, ) -> Result<CollectionManifest>
Fetch a manifest and all of its content blobs, then install it atomically.
§Errors
Returns an error if a ticket, manifest, content blob, or installation step is invalid.
Sourcepub fn switch(
&self,
collection_id: Uuid,
requested_version: impl AsRef<str>,
) -> Result<()>
pub fn switch( &self, collection_id: Uuid, requested_version: impl AsRef<str>, ) -> Result<()>
§Errors
Returns an error if the requested version is not installed or the active link cannot be switched.
Sourcepub fn remove(
&self,
collection_id: Uuid,
requested_version: impl AsRef<str>,
) -> Result<()>
pub fn remove( &self, collection_id: Uuid, requested_version: impl AsRef<str>, ) -> Result<()>
§Errors
Returns an error if an installed version cannot be deleted.
Sourcepub fn verify(&self, manifest: &CollectionManifest) -> Result<()>
pub fn verify(&self, manifest: &CollectionManifest) -> Result<()>
§Errors
Returns an error when an installed version’s content does not match its manifest.
Sourcepub async fn import_from_paths(
&self,
files: &[(PathBuf, PathBuf)],
blobs: &BlobStore,
collection_name: &str,
collection_id: Uuid,
) -> Result<CollectionManifest>
pub async fn import_from_paths( &self, files: &[(PathBuf, PathBuf)], blobs: &BlobStore, collection_name: &str, collection_id: Uuid, ) -> Result<CollectionManifest>
Import existing files into the blob store via reference links.
For each (source_path, logical_path) pair the file is hashed with
BLAKE3, added to the blob store with a reference (hardlink where
possible, avoiding duplication), and recorded in a new
CollectionManifest.
The manifest is unsigned; the caller must sign it before publishing.
§Arguments
files– List of(source_path, logical_path)pairs.blobs– The node’s blob store.collection_name– Human-readable name for the collection manifest.collection_id– UUID for the new collection.
§Errors
Returns an error if a file cannot be read or added to the blob store.
Sourcepub async fn make_seedable(
&self,
files: &[(PathBuf, PathBuf)],
blobs: &BlobStore,
endpoint: &Endpoint,
collection_name: &str,
) -> Result<(CollectionManifest, BlobTicket)>
pub async fn make_seedable( &self, files: &[(PathBuf, PathBuf)], blobs: &BlobStore, endpoint: &Endpoint, collection_name: &str, ) -> Result<(CollectionManifest, BlobTicket)>
Make existing files seedable via syncweb.
For each file:
- Import into the blob store via reference (no copy)
- Pin all blobs to prevent garbage collection
- Return manifest and blob ticket for sharing
§Errors
Returns an error if import, pinning, or ticket creation fails.
Trait Implementations§
Source§impl Clone for PackageManager
impl Clone for PackageManager
Source§fn clone(&self) -> PackageManager
fn clone(&self) -> PackageManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PackageManager
impl RefUnwindSafe for PackageManager
impl Send for PackageManager
impl Sync for PackageManager
impl Unpin for PackageManager
impl UnsafeUnpin for PackageManager
impl UnwindSafe for PackageManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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