Trait nix_daemon::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 Future<Output = Result<impl Progress<T = bool, Error = Self::Error>, Self::Error>> + Send; fn has_substitutes<P: AsRef<str> + Send + Sync + Debug>( &mut self, path: P, ) -> impl Future<Output = Result<impl Progress<T = bool, Error = Self::Error>, Self::Error>> + Send; 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 Future<Output = Result<impl Progress<T = (String, PathInfo), Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send; fn add_temp_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send; fn add_indirect_root<Path: AsRef<str> + Send + Sync + Debug>( &mut self, path: Path, ) -> impl Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send; fn find_roots( &mut self, ) -> impl Future<Output = Result<impl Progress<T = HashMap<String, String>, Error = Self::Error>, Self::Error>> + Send; fn set_options( &mut self, opts: ClientSettings, ) -> impl Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send; fn query_pathinfo<S: AsRef<str> + Send + Sync + Debug>( &mut self, path: S, ) -> impl Future<Output = Result<impl Progress<T = Option<PathInfo>, Error = Self::Error>, Self::Error>> + Send; fn query_valid_paths<Paths>( &mut self, paths: Paths, use_substituters: bool, ) -> impl Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send; fn query_missing<Ps>( &mut self, paths: Ps, ) -> impl Future<Output = Result<impl Progress<T = Missing, Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = HashMap<String, String>, Error = Self::Error>, Self::Error>> + Send; fn build_paths_with_results<Ps>( &mut self, paths: Ps, mode: BuildMode, ) -> impl Future<Output = Result<impl Progress<T = HashMap<String, BuildResult>, Error = Self::Error>, Self::Error>> + Send 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 Future<Output = Result<impl Progress<T = bool, Error = Self::Error>, Self::Error>> + Send

Returns whether a store path is valid.

source

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

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 Future<Output = Result<impl Progress<T = (String, PathInfo), Error = Self::Error>, Self::Error>> + Send
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 Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send
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 Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send

Ensure the specified store path exists.

source

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

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 Future<Output = Result<impl Progress<T = (), Error = Self::Error>, Self::Error>> + Send

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

source

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

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

source

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

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 Future<Output = Result<impl Progress<T = Option<PathInfo>, Error = Self::Error>, Self::Error>> + Send

Returns a PathInfo struct for the given path.

source

fn query_valid_paths<Paths>( &mut self, paths: Paths, use_substituters: bool, ) -> impl Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send
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 Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send
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 Future<Output = Result<impl Progress<T = Vec<String>, Error = Self::Error>, Self::Error>> + Send

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 Future<Output = Result<impl Progress<T = Missing, Error = Self::Error>, Self::Error>> + Send

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 Future<Output = Result<impl Progress<T = HashMap<String, String>, Error = Self::Error>, Self::Error>> + Send

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 Future<Output = Result<impl Progress<T = HashMap<String, BuildResult>, Error = Self::Error>, Self::Error>> + Send

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

Object Safety§

This trait is not object safe.

Implementors§