pub trait Publish<R>: Sealed {
type Error;
type Id;
// Required methods
fn publish<C>(
&self,
paths: C,
remotes: HashMap<AtomTag, (Version, Self::Id)>,
) -> Vec<Result<Result<Record<R>, AtomTag>, Self::Error>>
where C: IntoIterator<Item = PathBuf>;
fn publish_atom<P: AsRef<Path>>(
&self,
path: P,
remotes: &HashMap<AtomTag, (Version, Self::Id)>,
) -> Result<Result<Record<R>, AtomTag>, Self::Error>;
}
Expand description
The trait primarily responsible for exposing Atom publishing logic for a given store.
Required Associated Types§
Required Methods§
Sourcefn publish<C>(
&self,
paths: C,
remotes: HashMap<AtomTag, (Version, Self::Id)>,
) -> Vec<Result<Result<Record<R>, AtomTag>, Self::Error>>where
C: IntoIterator<Item = PathBuf>,
fn publish<C>(
&self,
paths: C,
remotes: HashMap<AtomTag, (Version, Self::Id)>,
) -> Vec<Result<Result<Record<R>, AtomTag>, Self::Error>>where
C: IntoIterator<Item = PathBuf>,
Publishes Atoms.
This function processes a collection of paths, each representing an Atom to be published.
Internally the implementation calls Publish::publish_atom
for each path.
§Error Handling
- The function aims to process all provided paths, even if some fail.
- Errors and skipped Atoms are collected as results but do not halt the overall process.
- The function continues until all the Atoms have been processed.
§Return Value
Returns a vector of results types, where the outter result represents whether an Atom has failed, and the inner result determines whether an Atom was safely skipped, e.g. because it already exists.
Sourcefn publish_atom<P: AsRef<Path>>(
&self,
path: P,
remotes: &HashMap<AtomTag, (Version, Self::Id)>,
) -> Result<Result<Record<R>, AtomTag>, Self::Error>
fn publish_atom<P: AsRef<Path>>( &self, path: P, remotes: &HashMap<AtomTag, (Version, Self::Id)>, ) -> Result<Result<Record<R>, AtomTag>, Self::Error>
Publish an Atom.
This function takes a single path and publishes the Atom located there, if possible.
§Return Value
-
An outcome is either the record (
Record<R>
) of the successfully publish Atom or thecrate::AtomId
if it was safely skipped. -
The function will return an error (
Self::Error
) if the Atom could not be published for any reason, e.g. invalid manifests.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.