pub enum IndexStore {
Memory(Vec<PacketIndex>),
Disk {
writer: BufWriter<File>,
path: PathBuf,
count: u64,
},
}Expand description
Storage backend for the first-pass packet index.
Variants§
Memory(Vec<PacketIndex>)
In-memory vector — fast path for captures that fit comfortably in RAM.
Disk
On-disk sidecar file — for TB-scale inputs where the index itself may be large (≈ 20 MB per 1 M packets).
Implementations§
Source§impl IndexStore
impl IndexStore
Sourcepub fn disk(sidecar_path: &Path) -> Result<Self, SortError>
pub fn disk(sidecar_path: &Path) -> Result<Self, SortError>
Create an on-disk store backed by a file at sidecar_path.
§Errors
Returns SortError::Io if the sidecar file cannot be created.
Sourcepub fn sidecar_path(&self) -> Option<&Path>
pub fn sidecar_path(&self) -> Option<&Path>
Return the path of the on-disk sidecar file, if any.
Sourcepub fn into_sorted(self) -> Result<Vec<PacketIndex>, SortError>
pub fn into_sorted(self) -> Result<Vec<PacketIndex>, SortError>
Flush any buffered writes, sort all entries by timestamp_ns, and
return the result as an owned Vec<PacketIndex>.
The on-disk sidecar file is not deleted here; the caller is responsible for cleanup.
§Errors
Returns SortError::Io on flush or read failure.
Auto Trait Implementations§
impl Freeze for IndexStore
impl RefUnwindSafe for IndexStore
impl Send for IndexStore
impl Sync for IndexStore
impl Unpin for IndexStore
impl UnsafeUnpin for IndexStore
impl UnwindSafe for IndexStore
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> 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