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
| Field | Who can read | Why |
|---|---|---|
file_id | All network nodes | Indexing and routing |
owner_fingerprint | All | Attribution |
encrypted_name | Only nodes with network key | Private metadata |
size_bytes | All | Storage planning |
k, n, q | All | Codec operation |
ph, pe | All | Health monitoring |
chunks | All | Fragment routing |
Fields§
§file_id: StringUUID v4 identifying this file in the network.
owner_fingerprint: StringSHA-256(pubkey)[0..8] hex of the uploading user.
network_id: StringNetwork 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: u64Original file size in bytes.
chunk_size: usizeChunk size in bytes used during upload (e.g. 1 MiB = 1_048_576).
num_chunks: usizeTotal number of chunks.
k: usizeRecovery threshold: minimum fragments needed to reconstruct any chunk.
Computed at upload time via
crate::coding::params::compute_coding_params.
n: usizeTotal fragments generated per chunk (= k + redundancy).
q: f64Effective redundancy overhead fraction: (n − k) / k.
ph: f64Target recovery probability declared at upload time (e.g. 0.999).
pe: f64Rolling 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: u64Unix timestamp (seconds) when the file was uploaded.
Implementations§
Source§impl FileManifest
impl FileManifest
Sourcepub fn decrypt_name(&self, key: &NetworkMetaKey) -> BpResult<String>
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.
Sourcepub fn set_name(&mut self, filename: &str, key: &NetworkMetaKey)
pub fn set_name(&mut self, filename: &str, key: &NetworkMetaKey)
Set the filename by encrypting it with the given network key.
Sourcepub fn conservation_ratio(&self) -> f64
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.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Whether every chunk has at least k fragment locations recorded.
Sourcepub fn to_json_bytes(&self) -> BpResult<Vec<u8>>
pub fn to_json_bytes(&self) -> BpResult<Vec<u8>>
Serialise to a compact JSON byte blob (for gossip / DHT storage).
Sourcepub fn from_json_bytes(bytes: &[u8]) -> BpResult<Self>
pub fn from_json_bytes(bytes: &[u8]) -> BpResult<Self>
Deserialise from a JSON byte blob.
Trait Implementations§
Source§impl Clone for FileManifest
impl Clone for FileManifest
Source§fn clone(&self) -> FileManifest
fn clone(&self) -> FileManifest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileManifest
impl Debug for FileManifest
Source§impl<'de> Deserialize<'de> for FileManifest
impl<'de> Deserialize<'de> for FileManifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FileManifest
impl RefUnwindSafe for FileManifest
impl Send for FileManifest
impl Sync for FileManifest
impl Unpin for FileManifest
impl UnwindSafe for FileManifest
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more