Skip to main content

ShardedConCorpus

Struct ShardedConCorpus 

Source
pub struct ShardedConCorpus { /* private fields */ }
Expand description

Multi-shard campaign corpus: root/shard_XXXX/ each holds an independent ConCorpus.

Implementations§

Source§

impl ShardedConCorpus

Source

pub fn open(root: impl AsRef<Path>, n_shards: u32) -> Result<Self>

Create or open a sharded root. If manifest missing, writes one with n_shards.

Source

pub fn n_shards(&self) -> u32

Source

pub fn root(&self) -> &Path

Source

pub fn shard_for_traj(traj_id: TrajId, n_shards: u32) -> u32

Source

pub fn shard_mut(&mut self, shard_id: u32) -> Result<&ConCorpus>

Open one shard env (creates dir). Safe for many processes to open different shards.

Source

pub fn open_shard_for_traj( root: impl AsRef<Path>, traj_id: TrajId, ) -> Result<(u32, ConCorpus)>

Open only the shard for traj_id (HPC rank typically owns one shard).

Source

pub fn open_shard(root: impl AsRef<Path>, shard_id: u32) -> Result<ConCorpus>

Open a single shard by id (rank r uses open_shard(root, r % n)).

Source

pub fn append_trajectory_path( &mut self, traj_id: TrajId, file: impl AsRef<Path>, ) -> Result<u32>

Source

pub fn append_trajectory_str( &mut self, traj_id: TrajId, contents: &str, source: impl Into<String>, ) -> Result<u32>

Source

pub fn append_trajectory_frames( &mut self, traj_id: TrajId, frames: &[ConFrame], source: impl Into<String>, ) -> Result<u32>

Source

pub fn select(&mut self, sel: &Select) -> Result<Vec<FrameKey>>

Fan-out select across all shards (read-only; opens missing shards).

Source

pub fn get_frame_text(&mut self, key: FrameKey) -> Result<String>

Source

pub fn reindex_all(&mut self) -> Result<u32>

Source§

impl ShardedConCorpus

Source

pub fn join_to_single_env(&mut self, dst: impl AsRef<Path>) -> Result<u32>

Join: copy all frames from every shard into a new single-env corpus at dst (traj_id preserved; collision if same traj_id appears on two shards is an error). Secondary indexes built via normal append/prepare on each blob. Reversible with Self::split_single_to_sharded using the same n_shards and traj routing.

Source

pub fn split_single_to_sharded( single: &ConCorpus, dst_root: impl AsRef<Path>, n_shards: u32, ) -> Result<u32>

Split: read a single-env corpus and write a new sharded root at dst_root with n_shards (rewrites manifest). Traj_id preserved; routing is traj_id % n_shards.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.