FileManifest

Struct FileManifest 

Source
pub struct FileManifest {
Show 14 fields pub file_id: String, pub owner_fingerprint: String, pub network_id: String, pub encrypted_name: Vec<u8>, pub size_bytes: u64, pub chunk_size: usize, pub num_chunks: usize, pub k: usize, pub n: usize, pub q: f64, pub ph: f64, pub pe: f64, pub chunks: Vec<ChunkManifest>, pub created_at: u64,
}
Expand description

Complete metadata descriptor for a file stored in a BillPouch network.

§Field visibility

FieldWho can readWhy
file_idAll network nodesIndexing and routing
owner_fingerprintAllAttribution
encrypted_nameOnly nodes with network keyPrivate metadata
size_bytesAllStorage planning
k, n, qAllCodec operation
ph, peAllHealth monitoring
chunksAllFragment routing

Fields§

§file_id: String

UUID v4 identifying this file in the network.

§owner_fingerprint: String

SHA-256(pubkey)[0..8] hex of the uploading user.

§network_id: String

Network this file belongs to.

§encrypted_name: Vec<u8>

Filename encrypted with the network metadata key.

Use NetworkMetaKey::encrypt / NetworkMetaKey::decrypt with the key from NetworkMetaKey::for_network to read or write.

§size_bytes: u64

Original file size in bytes.

§chunk_size: usize

Chunk size in bytes used during upload (e.g. 1 MiB = 1_048_576).

§num_chunks: usize

Total number of chunks.

§k: usize

Recovery threshold: minimum fragments needed to reconstruct any chunk.

Computed at upload time via crate::coding::params::compute_coding_params.

§n: usize

Total fragments generated per chunk (= k + redundancy).

§q: f64

Effective redundancy overhead fraction: (n − k) / k.

§ph: f64

Target recovery probability declared at upload time (e.g. 0.999).

§pe: f64

Rolling effective recovery probability, updated by the daemon as QoS measurements evolve. Starts equal to ph at upload.

§chunks: Vec<ChunkManifest>

Per-chunk location manifests (one entry per chunk).

§created_at: u64

Unix timestamp (seconds) when the file was uploaded.

Implementations§

Source§

impl FileManifest

Source

pub fn decrypt_name(&self, key: &NetworkMetaKey) -> BpResult<String>

Decrypt and return the original filename.

§Errors

Returns Err if the key is wrong or the blob is corrupted.

Source

pub fn set_name(&mut self, filename: &str, key: &NetworkMetaKey)

Set the filename by encrypting it with the given network key.

Source

pub fn conservation_ratio(&self) -> f64

Conservation ratio: fraction of the network’s fragment locations that still hold known-live fragments.

A value of 1.0 means all n × num_chunks fragments are in place. Below k / n the file cannot be recovered.

Source

pub fn is_recoverable(&self) -> bool

Whether every chunk has at least k fragment locations recorded.

Source

pub fn to_json_bytes(&self) -> BpResult<Vec<u8>>

Serialise to a compact JSON byte blob (for gossip / DHT storage).

Source

pub fn from_json_bytes(bytes: &[u8]) -> BpResult<Self>

Deserialise from a JSON byte blob.

Trait Implementations§

Source§

impl Clone for FileManifest

Source§

fn clone(&self) -> FileManifest

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FileManifest

Source§

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

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

impl<'de> Deserialize<'de> for FileManifest

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 FileManifest

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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