Struct tvix_store::path_info::PathInfo
source · pub struct PathInfo {
pub store_path: StorePath<String>,
pub node: Node,
pub references: Vec<StorePath<String>>,
pub nar_size: u64,
pub nar_sha256: [u8; 32],
pub signatures: Vec<Signature<String>>,
pub deriver: Option<StorePath<String>>,
pub ca: Option<CAHash>,
}
Expand description
Holds metadata about a store path, but not its contents.
This is somewhat equivalent to the information Nix holds in its SQLite database, or publishes as .narinfo files, except we also embed the tvix_castore::Node describing the contents in the castore model.
Fields§
§store_path: StorePath<String>
The store path this is about.
node: Node
The contents in the tvix-castore model.
references: Vec<StorePath<String>>
A list of references.
nar_size: u64
The size of the NAR representation of the contents, in bytes.
nar_sha256: [u8; 32]
The sha256 digest of the NAR representation of the contents.
signatures: Vec<Signature<String>>
The signatures, usually shown in a .narinfo file.
deriver: Option<StorePath<String>>
The StorePath of the .drv file producing this output.
The .drv suffix is omitted in its name
field.
ca: Option<CAHash>
The CA field in the .narinfo. Its textual representations seen in the wild are one of the following:
fixed:r:sha256:1gcky5hlf5vqfzpyhihydmm54grhc94mcs8w7xr8613qsqb1v2j6
fixed-output derivations using “recursive”outputHashMode
.fixed:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8 fixed-output derivations using "flat"
outputHashMode`text:sha256:19xqkh72crbcba7flwxyi3n293vav6d7qkzkh2v4zfyi4iia8vj8
Text hashing, used for uploaded .drv files and outputs produced by builtins.toFile.
Semantically, they can be split into the following components:
- “content address prefix”. Currently, “fixed” and “text” are supported.
- “hash mode”. Currently, “flat” and “recursive” are supported.
- “hash type”. The underlying hash function used. Currently, sha1, md5, sha256, sha512.
- “digest”. The digest itself.
There are some restrictions on the possible combinations.
For example, text
and fixed:recursive
always imply sha256.
Implementations§
source§impl PathInfo
impl PathInfo
sourcepub fn to_narinfo(&self) -> NarInfo<'_>
pub fn to_narinfo(&self) -> NarInfo<'_>
Reconstructs a [nix_compat::narinfo::NarInfo<’_>].
It does very little allocation (a Vec each for signatures
and
references
), the rest points to data owned elsewhere.
It can be used to validate Signatures, or render a .narinfo file (after some more fields are populated)
Keep in mind this is not able to reconstruct all data present in the NarInfo<’_>, as some of it is not stored at all:
- the
system
,file_hash
andfile_size
fields are set toNone
. - the URL is set to an empty string.
- Compression is set to “none”
If you want to render it out to a string and be able to parse it back in, at least URL must be set again.
Trait Implementations§
impl Eq for PathInfo
impl StructuralPartialEq for PathInfo
Auto Trait Implementations§
impl !Freeze for PathInfo
impl RefUnwindSafe for PathInfo
impl Send for PathInfo
impl Sync for PathInfo
impl Unpin for PathInfo
impl UnwindSafe for PathInfo
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request