Skip to main content

RemoteAsset

Struct RemoteAsset 

Source
pub struct RemoteAsset {
    pub path: String,
    pub download_url: String,
    pub content_type: Option<String>,
    pub size: Option<u64>,
    pub sha256: Option<String>,
    pub change_token: Option<String>,
}

Fields§

§path: String§download_url: String§content_type: Option<String>§size: Option<u64>§sha256: Option<String>

The digest the coordinate was PUBLISHED with, when the source knew one: Cargo.lock’s checksum, PyPI’s sha256 digest. Lowercase hex, no algorithm prefix.

It exists so the bytes that cross the airgap are the bytes the lockfile pinned. Before this field the agent parsed both digests and threw them away: a compromised registry or CDN serving substituted bytes for one pinned coordinate had them packed into the znippy archive and certified by a receipt whose sha256 was computed over the substitution. The allowlist and https stopped a network-position attacker; nothing stopped the origin itself.

None means the source published no digest — it does NOT mean the bytes are trusted, and a connector that has one must fill it in.

§change_token: Option<String>

An opaque CHANGE TOKEN for this coordinate, as published by THIS source.

Equal ⇒ unchanged at this source. Different ⇒ changed at this source. It is never compared across sources, and it is never a content digest: it may bind the path, the storage layout, or anything else the source finds cheap, so two sources holding byte-identical artifacts will legitimately publish different tokens. Anything that treats it as a hash of the bytes is wrong.

§Why it exists

15 of holger’s 17 repository backends are znippy-*, and a znippy file table carries neither a modification time nor a per-entry SHA-256 — so ArtifactEntry::published_unix_ms and ArtifactEntry::sha256 are both None and every such repository landed in unproven on every mirror tick, re-fetching itself whole every cycle under the default UnprovenPolicy::Refetch. What znippy DOES have, for free, is a merkle fold of the per-chunk BLAKE3 hashes its index already stores — a value that is stable while the bytes are stable and differs when they differ, and which is emphatically not a content digest. That is a change token, and this is the field for it.

§The scope is part of the value

A token carried here is SCOPE-STAMPED: "<scope>|<opaque>", where the scope names the source it came from and the part after the first | is never interpreted. [scope_change_token] builds one, and [split_change_token] takes it apart. A comparison between two tokens with different scopes is refused rather than answered — which is what makes “never compared across sources” a property of the code instead of a rule someone has to remember.

None means this source published no token. It does NOT mean the bytes are unchanged and it does not mean they changed.

Trait Implementations§

Source§

impl Clone for RemoteAsset

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RemoteAsset

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RemoteAsset

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RemoteAsset

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.