pub struct MetadataBundle {
pub version: u32,
pub repo_secret: RepoSecret,
pub shard_map: ShardMap,
}Expand description
Metadata bundle containing shard mappings.
Fields§
§version: u32Format version
repo_secret: RepoSecretSecret for shard assignment (random per-repo)
shard_map: ShardMapShard map (hash ranges -> shard CIDs)
Implementations§
Source§impl MetadataBundle
impl MetadataBundle
pub const VERSION: u32 = 1
pub const DEFAULT_RANGE_COUNT: u64 = 64
Sourcepub fn new(repo_secret: RepoSecret, shard_map: ShardMap) -> Self
pub fn new(repo_secret: RepoSecret, shard_map: ShardMap) -> Self
Creates a new metadata bundle with the given repo secret and shard map.
Sourcepub fn with_default_map(repo_secret: RepoSecret) -> Self
pub fn with_default_map(repo_secret: RepoSecret) -> Self
Convenience constructor for a new map with the default range count.
Sourcepub fn range_for_path(&self, path: &str) -> Option<&ShardRange>
pub fn range_for_path(&self, path: &str) -> Option<&ShardRange>
Returns the shard range for a given file path.
Sourcepub fn range_for_dir(&self, dir_path: &str) -> Option<&ShardRange>
pub fn range_for_dir(&self, dir_path: &str) -> Option<&ShardRange>
Returns the shard range for a given directory path.
Trait Implementations§
Source§impl Clone for MetadataBundle
impl Clone for MetadataBundle
Source§fn clone(&self) -> MetadataBundle
fn clone(&self) -> MetadataBundle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetadataBundle
impl Debug for MetadataBundle
Source§impl<'de> Deserialize<'de> for MetadataBundle
impl<'de> Deserialize<'de> for MetadataBundle
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MetadataBundle
impl RefUnwindSafe for MetadataBundle
impl Send for MetadataBundle
impl Sync for MetadataBundle
impl Unpin for MetadataBundle
impl UnsafeUnpin for MetadataBundle
impl UnwindSafe for MetadataBundle
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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