pub struct PartitionId(/* private fields */);Expand description
A 16-byte partition id: the physical storage boundary. Canonical
construction is BLAKE3(household/namespace-id)[0:16]. No pack ever
spans partitions; dedup and GC are both scoped to a single partition.
Implementations§
Source§impl PartitionId
impl PartitionId
Sourcepub fn derive(namespace: &str) -> Self
pub fn derive(namespace: &str) -> Self
Derive a canonical partition id from a household/namespace string.
Sourcepub fn for_person(account_id: &str) -> Self
pub fn for_person(account_id: &str) -> Self
Derive the partition id for a person’s own partition (R3,
standalone-first identity):
PartitionId::derive("person:{account_id}"). The person: prefix is
the domain separator from PartitionId::for_household — a person
and a household never land on the same partition even if
account_id and a household id happen to coincide as strings.
Additive: does not change how any existing PartitionId is derived
or stored on disk. No dedup ever crosses a partition boundary (see
the crate-root docs, “R3 partitions”); shared content is copied into
a household partition, never referenced across partitions.
Sourcepub fn for_household(hid: &str) -> Self
pub fn for_household(hid: &str) -> Self
Derive the partition id for a household’s shared partition (R3,
standalone-first identity):
PartitionId::derive("household:{hid}"). See
PartitionId::for_person for the domain-separation rationale and
the no-cross-partition-dedup rule.
Sourcepub fn for_service(service_id: &str) -> Self
pub fn for_service(service_id: &str) -> Self
Derive the partition id for a service’s own partition (spec
the format-reservations spec §R.5): a headless
principal gets its own partition rather than a second wrap of a
person’s key, because its key cannot be derived by wrapping a
person’s — the security review ruled a service principal needs
independent key custody so, e.g., division CI cannot run under a
person’s principal. service: is the domain-separator prefix,
naming this the third and last member of the closed subject.kind
vocabulary alongside PartitionId::for_person and
PartitionId::for_household — see the module docs there for the
domain-separation rationale and the no-cross-partition-dedup rule.
pub fn from_bytes(bytes: [u8; 16]) -> Self
pub fn as_bytes(&self) -> &[u8; 16]
pub fn to_hex(&self) -> String
pub fn from_hex(s: &str) -> Result<Self>
Sourcepub fn shard_prefix(hex_id: &str) -> &str
pub fn shard_prefix(hex_id: &str) -> &str
The two-hex-char shard prefix used for the packs/<prefix>/ fanout
directory of the pack id (not the partition id itself) — kept here
as a shared helper since both packfile and partition-store need the
identical prefixing rule.
Trait Implementations§
Source§impl Clone for PartitionId
impl Clone for PartitionId
impl Copy for PartitionId
Source§impl Debug for PartitionId
impl Debug for PartitionId
impl Eq for PartitionId
Source§impl Hash for PartitionId
impl Hash for PartitionId
Source§impl Ord for PartitionId
impl Ord for PartitionId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PartitionId
impl PartialEq for PartitionId
Source§impl PartialOrd for PartitionId
impl PartialOrd for PartitionId
impl StructuralPartialEq for PartitionId
Auto Trait Implementations§
impl Forget for PartitionId
impl Freeze for PartitionId
impl Move for PartitionId
impl RefUnwindSafe for PartitionId
impl Send for PartitionId
impl Sync for PartitionId
impl Unpin for PartitionId
impl UnsafeUnpin for PartitionId
impl UnwindSafe for PartitionId
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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