Trait Store

Source
pub trait Store {
    type Error: From<Error> + Send + Sync;

Show 16 methods // Required methods fn is_valid_path<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = bool, Error = Self::Error>; fn has_substitutes<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = bool, Error = Self::Error>; fn add_to_store<SN: AsRef<str> + Send + Sync + Debug, SC: AsRef<str> + Send + Sync + Debug, Refs, R>( &mut self, name: SN, cam_str: SC, refs: Refs, repair: bool, source: R, ) -> impl Progress<T = (String, PathInfo), Error = Self::Error> where Refs: IntoIterator + Send + Debug, Refs::IntoIter: ExactSizeIterator + Send, Refs::Item: AsRef<str> + Send + Sync, R: AsyncReadExt + Unpin + Send + Debug; fn build_paths<Paths>( &mut self, paths: Paths, mode: BuildMode, ) -> impl Progress<T = (), Error = Self::Error> where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync; fn ensure_path<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>; fn add_temp_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>; fn add_indirect_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>; fn find_roots( &mut self, ) -> impl Progress<T = HashMap<String, String>, Error = Self::Error>; fn set_options( &mut self, opts: ClientSettings, ) -> impl Progress<T = (), Error = Self::Error>; fn query_pathinfo<S: AsRef<str> + Send + Sync + Debug>( &mut self, path: S, ) -> impl Progress<T = Option<PathInfo>, Error = Self::Error>; fn query_valid_paths<Paths>( &mut self, paths: Paths, use_substituters: bool, ) -> impl Progress<T = Vec<String>, Error = Self::Error> where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync; fn query_substitutable_paths<Paths>( &mut self, paths: Paths, ) -> impl Progress<T = Vec<String>, Error = Self::Error> where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync; fn query_valid_derivers<S: AsRef<str> + Send + Sync + Debug>( &mut self, path: S, ) -> impl Progress<T = Vec<String>, Error = Self::Error>; fn query_missing<Ps>( &mut self, paths: Ps, ) -> impl Progress<T = Missing, Error = Self::Error> where Ps: IntoIterator + Send + Debug, Ps::IntoIter: ExactSizeIterator + Send, Ps::Item: AsRef<str> + Send + Sync; fn query_derivation_output_map<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = HashMap<String, String>, Error = Self::Error>; fn build_paths_with_results<Ps>( &mut self, paths: Ps, mode: BuildMode, ) -> impl Progress<T = HashMap<String, BuildResult>, Error = Self::Error> where Ps: IntoIterator + Send + Debug, Ps::IntoIter: ExactSizeIterator + Send, Ps::Item: AsRef<str> + Send + Sync;
}
Expand description

Generic interface to a Nix store.

See nix::DaemonStore for an implementation that talks to a CppNix (compatible) daemon.

Required Associated Types§

Required Methods§

Source

fn is_valid_path<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = bool, Error = Self::Error>

Returns whether a store path is valid.

Source

fn has_substitutes<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = bool, Error = Self::Error>

Returns whether Self::query_substitutable_paths() would return anything.

Source

fn add_to_store<SN: AsRef<str> + Send + Sync + Debug, SC: AsRef<str> + Send + Sync + Debug, Refs, R>( &mut self, name: SN, cam_str: SC, refs: Refs, repair: bool, source: R, ) -> impl Progress<T = (String, PathInfo), Error = Self::Error>
where Refs: IntoIterator + Send + Debug, Refs::IntoIter: ExactSizeIterator + Send, Refs::Item: AsRef<str> + Send + Sync, R: AsyncReadExt + Unpin + Send + Debug,

Adds a file to the store.

Source

fn build_paths<Paths>( &mut self, paths: Paths, mode: BuildMode, ) -> impl Progress<T = (), Error = Self::Error>
where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync,

Builds the specified paths.

Source

fn ensure_path<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>

Ensure the specified store path exists.

Source

fn add_temp_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>

Creates a temporary GC root, which persists until the client disconnects.

Source

fn add_indirect_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Progress<T = (), Error = Self::Error>

Creates a persistent GC root. This is what’s normally meant by a GC root.

Source

fn find_roots( &mut self, ) -> impl Progress<T = HashMap<String, String>, Error = Self::Error>

Returns the (link, target) of all known GC roots.

Source

fn set_options( &mut self, opts: ClientSettings, ) -> impl Progress<T = (), Error = Self::Error>

Applies client options. This changes the behaviour of future commands.

Source

fn query_pathinfo<S: AsRef<str> + Send + Sync + Debug>( &mut self, path: S, ) -> impl Progress<T = Option<PathInfo>, Error = Self::Error>

Returns a PathInfo struct for the given path.

Source

fn query_valid_paths<Paths>( &mut self, paths: Paths, use_substituters: bool, ) -> impl Progress<T = Vec<String>, Error = Self::Error>
where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync,

Returns which of the passed paths are valid.

Source

fn query_substitutable_paths<Paths>( &mut self, paths: Paths, ) -> impl Progress<T = Vec<String>, Error = Self::Error>
where Paths: IntoIterator + Send + Debug, Paths::IntoIter: ExactSizeIterator + Send, Paths::Item: AsRef<str> + Send + Sync,

Returns paths which can be substituted.

Source

fn query_valid_derivers<S: AsRef<str> + Send + Sync + Debug>( &mut self, path: S, ) -> impl Progress<T = Vec<String>, Error = Self::Error>

Returns a list of valid derivers for a path. This is sort of like PathInfo::deriver, but it doesn’t lie to you.

Source

fn query_missing<Ps>( &mut self, paths: Ps, ) -> impl Progress<T = Missing, Error = Self::Error>

Takes a list of paths and queries which would be built, substituted or unknown, along with an estimate of the cumulative download and NAR sizes.

Source

fn query_derivation_output_map<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Progress<T = HashMap<String, String>, Error = Self::Error>

Returns a map of (output, store path) for the given derivation.

Source

fn build_paths_with_results<Ps>( &mut self, paths: Ps, mode: BuildMode, ) -> impl Progress<T = HashMap<String, BuildResult>, Error = Self::Error>

Like Self::build_paths(), but returns a BuildResult for each entry in paths.

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§