pub struct ShardedConCorpus { /* private fields */ }Expand description
Multi-shard campaign corpus: root/shard_XXXX/ each holds an independent ConCorpus.
Implementations§
Source§impl ShardedConCorpus
impl ShardedConCorpus
Sourcepub fn open_existing(root: impl AsRef<Path>) -> Result<Self>
pub fn open_existing(root: impl AsRef<Path>) -> Result<Self>
Open a sharded root that already has shards.json. Does not mkdir.
Sourcepub fn open(root: impl AsRef<Path>, n_shards: u32) -> Result<Self>
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.
pub fn n_shards(&self) -> u32
pub fn root(&self) -> &Path
pub fn shard_for_traj(traj_id: TrajId, n_shards: u32) -> u32
Sourcepub fn shard_mut(&mut self, shard_id: u32) -> Result<&ConCorpus>
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.
Sourcepub fn open_shard_for_traj(
root: impl AsRef<Path>,
traj_id: TrajId,
) -> Result<(u32, ConCorpus)>
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).
Sourcepub fn open_shard(root: impl AsRef<Path>, shard_id: u32) -> Result<ConCorpus>
pub fn open_shard(root: impl AsRef<Path>, shard_id: u32) -> Result<ConCorpus>
Open a single shard by id. That rank must be the only writer of
shard_id in the job, or drain to a unique dest and join_drained_roots.
pub fn append_trajectory_path( &mut self, traj_id: TrajId, file: impl AsRef<Path>, ) -> Result<u32>
pub fn append_trajectory_path_units( &mut self, traj_id: TrajId, file: impl AsRef<Path>, units: Option<Value>, ) -> Result<u32>
pub fn append_trajectory_str( &mut self, traj_id: TrajId, contents: &str, source: impl Into<String>, ) -> Result<u32>
pub fn append_trajectory_frames( &mut self, traj_id: TrajId, frames: &[ConFrame], source: impl Into<String>, ) -> Result<u32>
Sourcepub fn select(&mut self, sel: &Select) -> Result<Vec<FrameKey>>
pub fn select(&mut self, sel: &Select) -> Result<Vec<FrameKey>>
Fan-out select across shards that already exist (read-only; does not mint).
pub fn get_frame_text(&mut self, key: FrameKey) -> Result<String>
pub fn reindex_all(&mut self) -> Result<u32>
Source§impl ShardedConCorpus
impl ShardedConCorpus
Sourcepub fn join_to_single_env(&mut self, dst: impl AsRef<Path>) -> Result<u32>
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.