Struct tvix_store::proto::PathInfo
source · pub struct PathInfo {
pub node: Option<Node>,
pub references: Vec<Bytes>,
pub narinfo: Option<NarInfo>,
}
Expand description
PathInfo shows information about a Nix Store Path. That’s a single element inside /nix/store.
Fields§
§node: Option<Node>
The path can be a directory, file or symlink.
references: Vec<Bytes>
List of references (output path hashes) This really is the raw bytes, after decoding nixbase32, and not a base32-encoded string.
narinfo: Option<NarInfo>
see below.
Implementations§
source§impl PathInfo
impl PathInfo
sourcepub fn validate(&self) -> Result<StorePath<String>, ValidatePathInfoError>
pub fn validate(&self) -> Result<StorePath<String>, ValidatePathInfoError>
validate performs some checks on the PathInfo struct, Returning either a store_path::StorePath of the root node, or a ValidatePathInfoError.
sourcepub fn to_narinfo<'a>(
&'a self,
store_path: StorePathRef<'a>
) -> Option<NarInfo<'_>>
pub fn to_narinfo<'a>( &'a self, store_path: StorePathRef<'a> ) -> Option<NarInfo<'_>>
With self and its store path name, this reconstructs a [nix_compat::narinfo::NarInfo<’_>]. It can be used to validate Signatures, or get back a (sparse) NarInfo struct to prepare writing it out.
It assumes self to be validated first, and will only return None if the
narinfo
field is unpopulated.
It does very little allocation (a Vec each for signatures
and
references
), the rest points to data owned elsewhere.
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§
source§impl Message for PathInfo
impl Message for PathInfo
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for PathInfo
impl PartialEq 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> 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> 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> 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