Trait Publish

Source
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§

Source

type Error

The error type returned by the publisher.

Source

type Id

The type representing the machine-readable identity for a specific version of an atom.

Required Methods§

Source

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.

Source

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 the crate::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.

Implementors§

Source§

impl<'a> Publish<Root> for GitContext<'a>

Source§

type Error = Error

Source§

type Id = ObjectId