pub struct SegmentPath { /* private fields */ }Expand description
Identifies a segment within the storage layer.
Encapsulates namespace, shard ID, and segment file name for portable path construction across different storage backends (local filesystem, S3, etc.).
§Tenant Isolation
Every segment path is scoped to a NamespaceId, providing defense-in-depth
tenant isolation at the storage layer. Even if Cedar authorization policies
are misconfigured, the directory/object-key prefix prevents cross-tenant
data access.
Implementations§
Source§impl SegmentPath
impl SegmentPath
Sourcepub fn new(
namespace: NamespaceId,
shard_id: ShardId,
segment_name: impl Into<String>,
) -> Result<Self>
pub fn new( namespace: NamespaceId, shard_id: ShardId, segment_name: impl Into<String>, ) -> Result<Self>
Create a new segment path scoped to a namespace.
Returns InvalidPath if segment_name contains path separators
(/, \), parent-directory components (..), or is empty —
preventing path-traversal attacks.
Sourcepub fn namespace(&self) -> &NamespaceId
pub fn namespace(&self) -> &NamespaceId
Returns the namespace (tenant) ID.
Sourcepub fn segment_name(&self) -> &str
pub fn segment_name(&self) -> &str
Returns the segment filename.
Sourcepub fn to_fs_path(&self, data_dir: &Path) -> PathBuf
pub fn to_fs_path(&self, data_dir: &Path) -> PathBuf
Resolve to a filesystem path relative to a data directory.
Layout: {data_dir}/ns_{namespace}/shard_{shard_id}/{segment_name}
Trait Implementations§
Source§impl Clone for SegmentPath
impl Clone for SegmentPath
Source§fn clone(&self) -> SegmentPath
fn clone(&self) -> SegmentPath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SegmentPath
impl Debug for SegmentPath
Source§impl Display for SegmentPath
impl Display for SegmentPath
impl Eq for SegmentPath
Source§impl Hash for SegmentPath
impl Hash for SegmentPath
Source§impl PartialEq for SegmentPath
impl PartialEq for SegmentPath
impl StructuralPartialEq for SegmentPath
Auto Trait Implementations§
impl Freeze for SegmentPath
impl RefUnwindSafe for SegmentPath
impl Send for SegmentPath
impl Sync for SegmentPath
impl Unpin for SegmentPath
impl UnsafeUnpin for SegmentPath
impl UnwindSafe for SegmentPath
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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