Skip to main content

MemberSource

Enum MemberSource 

Source
pub enum MemberSource {
    Zip(Vec<u8>),
    Tree {
        root: PathBuf,
        mapping: BTreeMap<String, PathBuf>,
    },
}
Expand description

The member-content source abstraction (13-02 Task 3): the proven v1.0 member engine (crate::client::resources, zip-bytes-only) speaks EITHER a gateway export zip OR a checked-out directory tree, with ONE implementation behind both — 13-03’s checkout and 13-06’s status compare build on this without touching proven code.

  • MemberSource::Zip delegates VERBATIM to the existing resources.rs functions — descriptor-normalized enumeration/ read/hash semantics stay single-source (no engine function is copied here).
  • MemberSource::Tree reads a checked-out tree through the RECORDED mapping with the SAME member-hash semantics: a member’s hash is identical from either source for identical bytes (equivalence pinned by test). A resource.json member hashes its normalized descriptor exactly as the zip side does — the same helpers (resources::normalize_descriptor, [resources::fnv1a], [resources::FOLDER_DESCRIPTOR]), never a fork.

Tree strictness (pinned here): the tree is MANIFEST-SCOPED. A mapped member missing from disk, or a local file not in the mapping, is an error from the source — 13-06’s status handles unknown files at the action layer, where a human-facing verdict belongs.

Variants§

§

Zip(Vec<u8>)

A gateway project-export zip’s raw bytes.

§

Tree

A checked-out directory tree rooted at root, addressed through the recorded checkout mapping (gateway member → local path — build_mapping’s output, stored in the manifest by 13-03).

Fields

§root: PathBuf

The checkout root the recorded local paths ride under.

§mapping: BTreeMap<String, PathBuf>

The recorded gateway-member → local-path pairs.

Implementations§

Source§

impl MemberSource

Source

pub fn members(&self) -> Result<Vec<String>, CoreError>

Every resource member’s user path. Zip: the export walk in member order (the proven resources::resource_members semantics — project.json, directory entries, and non-resources-shaped members skipped). Tree: the recorded mapping’s keys, sorted.

Source

pub fn read(&self, user_path: &str) -> Result<Vec<u8>, CoreError>

One member’s bytes, verbatim. Zip: the proven resources::read_member (missing → not_found). Tree: fs::read at the mapped local path — a member outside the recorded mapping or a missing file is invalid_input naming the member (the tree is manifest-scoped, so “unmapped” is a caller/manifest contract break, not a 404-shaped lookup miss).

Source

pub fn member_hashes(&self) -> Result<BTreeMap<String, u64>, CoreError>

User path → FNV-1a digest for every member — the SAME descriptor rule both sides: a basename resource.json hashes its resources::normalize_descriptor output (the lastModification volatility guard), everything else hashes raw bytes. Zip: the proven resources::member_hashes. Tree: reads the mapped files after a strictness walk — a mapped member missing from disk, or an on-disk file absent from the mapping, is invalid_input (manifest-scoped tree).

Auto Trait Implementations§

Blanket Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more