pub struct LatestSnapshot { /* private fields */ }Expand description
A reader pinned to one immutable latest generation.
Opening resolves the atomic pointer once and verifies the generation
manifest and every listed artifact. Subsequent reads never re-resolve
current, so a concurrent writer cannot mix generations for this reader.
Implementations§
Source§impl LatestSnapshot
impl LatestSnapshot
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self, ArtifactPathError>
pub fn open(root: impl AsRef<Path>) -> Result<Self, ArtifactPathError>
Resolve and verify the committed generation without writing or locking.
Sourcepub fn recover_stable_aliases(
root: impl AsRef<Path>,
) -> Result<Self, ArtifactPathError>
pub fn recover_stable_aliases( root: impl AsRef<Path>, ) -> Result<Self, ArtifactPathError>
Repair legacy root-level aliases from the committed generation.
This is idempotent and is also run automatically before every writer creates a new generation. The returned reader remains pinned to the generation used for recovery.
Sourcepub fn generation(&self) -> &str
pub fn generation(&self) -> &str
Return the pinned generation identity.
Sourcepub fn root(&self) -> &ApprovedRoot
pub fn root(&self) -> &ApprovedRoot
Return the approved artifact root containing this snapshot.
Sourcepub fn manifest(&self) -> &LatestManifest
pub fn manifest(&self) -> &LatestManifest
Return the verified versioned manifest.
Sourcepub fn open_artifact(&self, id: &ArtifactId) -> Result<File, ArtifactPathError>
pub fn open_artifact(&self, id: &ArtifactId) -> Result<File, ArtifactPathError>
Open one alias listed by this pinned generation.
Callers that need integrity verification should prefer
LatestSnapshot::read_artifact, which verifies the exact bytes read
against the pinned manifest.
Sourcepub fn read_artifact(
&self,
id: &ArtifactId,
) -> Result<Vec<u8>, ArtifactPathError>
pub fn read_artifact( &self, id: &ArtifactId, ) -> Result<Vec<u8>, ArtifactPathError>
Read one alias from this pinned generation.