pub struct ConCorpus { /* private fields */ }Implementations§
Source§impl ConCorpus
impl ConCorpus
pub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn path(&self) -> &Path
Sourcepub fn list_frame_keys(&self) -> Result<Vec<FrameKey>>
pub fn list_frame_keys(&self) -> Result<Vec<FrameKey>>
All frame keys in this env (for compaction / export pipelines).
Sourcepub fn export_frame_blob(&self, key: FrameKey) -> Result<String>
pub fn export_frame_blob(&self, key: FrameKey) -> Result<String>
Copy one frame blob+indexes from this corpus into dst (same FrameKey).
Used by join compaction; prepare keys outside dst exclusive section via append path on text.
pub fn append_trajectory_path( &self, traj_id: TrajId, file: impl AsRef<Path>, ) -> Result<u32>
pub fn append_trajectory_str( &self, traj_id: TrajId, file_contents: &str, source: impl Into<String>, ) -> Result<u32>
Sourcepub fn append_trajectory_frames(
&self,
traj_id: TrajId,
frames: &[ConFrame],
source: impl Into<String>,
) -> Result<u32>
pub fn append_trajectory_frames( &self, traj_id: TrajId, frames: &[ConFrame], source: impl Into<String>, ) -> Result<u32>
Ingest already-parsed frames (chemfiles / builder path). Serialize in prepare, not under write_txn.
Sourcepub fn extend_trajectory_frames(
&self,
traj_id: TrajId,
frames: &[ConFrame],
source_hint: impl Into<String>,
) -> Result<u32>
pub fn extend_trajectory_frames( &self, traj_id: TrajId, frames: &[ConFrame], source_hint: impl Into<String>, ) -> Result<u32>
Append frames to an existing trajectory (or create it). Returns new total frame count.
Concurrent extend of the same traj_id is rejected if n_frames moved (TOCTOU guard).
Sourcepub fn reindex(&self) -> Result<u32>
pub fn reindex(&self) -> Result<u32>
Rebuild all secondary indexes from authoritative frames blobs (schema upgrade path).
pub fn traj_meta(&self, traj_id: TrajId) -> Result<Option<TrajMeta>>
pub fn get_frame_text(&self, key: FrameKey) -> Result<String>
Sourcepub fn get_frame_texts(&self, keys: &[FrameKey]) -> Result<Vec<String>>
pub fn get_frame_texts(&self, keys: &[FrameKey]) -> Result<Vec<String>>
Batch point-gets under one read transaction (extract / multi-reader hot path).
Sourcepub fn touch_trajectory_blobs(
&self,
traj_id: TrajId,
n_frames: u32,
) -> Result<(u64, u64)>
pub fn touch_trajectory_blobs( &self, traj_id: TrajId, n_frames: u32, ) -> Result<(u64, u64)>
Materialize every frame blob for traj_id in one read txn (full extract hot path).
Copies each LMDB value into an owned String and folds bytes so the fair
campaign pays for payload access—not merely mmap slice length.
Returns (sum of lengths, byte checksum) for observability.
pub fn get_frame(&self, key: FrameKey) -> Result<ConFrame>
Sourcepub fn get_cooked_soa_bytes(&self, key: FrameKey) -> Result<Option<Vec<u8>>>
pub fn get_cooked_soa_bytes(&self, key: FrameKey) -> Result<Option<Vec<u8>>>
Raw optional cooked SoA bytes for key (None if never cooked).
Does not read frames (CON text).
Sourcepub fn has_valid_cooked_soa(&self, key: FrameKey) -> Result<bool>
pub fn has_valid_cooked_soa(&self, key: FrameKey) -> Result<bool>
True if a valid RCSO blob is stored (decode succeeds). Missing/corrupt → false. Authority APIs must not use this flag to skip CON text.
Sourcepub fn get_cooked_soa(&self, key: FrameKey) -> Result<Option<CookedSoa>>
pub fn get_cooked_soa(&self, key: FrameKey) -> Result<Option<CookedSoa>>
Decode cooked SoA if present and valid; None if missing or corrupt (CON text unchanged).
Reads only frames_soa—no CON parse.
Sourcepub fn get_positions(&self, key: FrameKey) -> Result<Vec<[f64; 3]>>
pub fn get_positions(&self, key: FrameKey) -> Result<Vec<[f64; 3]>>
Prefer valid cooked SoA (no CON parse on hit); otherwise parse CON text in frames.
RCSO is not fully equivalent to CON (no symbols/metadata/exact bytes)—do not omit frames.
Sourcepub fn get_forces(&self, key: FrameKey) -> Result<Option<Vec<[f64; 3]>>>
pub fn get_forces(&self, key: FrameKey) -> Result<Option<Vec<[f64; 3]>>>
Prefer cooked forces when the RCSO flag block is present (no CON parse on hit);
else parse CON (None if no forces on frame).
Sourcepub fn get_velocities(&self, key: FrameKey) -> Result<Option<Vec<[f64; 3]>>>
pub fn get_velocities(&self, key: FrameKey) -> Result<Option<Vec<[f64; 3]>>>
Prefer cooked velocities when present; else parse CON.
Sourcepub fn cook_frame(&self, key: FrameKey) -> Result<usize>
pub fn cook_frame(&self, key: FrameKey) -> Result<usize>
Cook one frame from authoritative CON text (overwrite existing cooked entry).
Sourcepub fn recook_all(&self) -> Result<u32>
pub fn recook_all(&self) -> Result<u32>
Cook all frames that have CON text; returns number of frames cooked.
Sourcepub fn delete_cooked_soa(&self, key: FrameKey) -> Result<()>
pub fn delete_cooked_soa(&self, key: FrameKey) -> Result<()>
Drop cooked tier for one key (CON text and indexes untouched).
Sourcepub fn append_trajectory_path_cook(
&self,
traj_id: TrajId,
file: impl AsRef<Path>,
cook: bool,
) -> Result<u32>
pub fn append_trajectory_path_cook( &self, traj_id: TrajId, file: impl AsRef<Path>, cook: bool, ) -> Result<u32>
Ingest path with optional cook-on-write (still stores CON text as authority).
pub fn frame_hash(&self, key: FrameKey) -> Result<ContentHash>
pub fn find_by_hash(&self, hash: ContentHash) -> Result<Option<FrameKey>>
pub fn hash_con_text(text: &str) -> Result<ContentHash>
Sourcepub fn frame_formula(&self, key: FrameKey) -> Result<String>
pub fn frame_formula(&self, key: FrameKey) -> Result<String>
Canonical formula for a stored frame (decode once).