feat(registry): add workspace-scoped artifact metadata

This commit is contained in:
2026-08-27 02:18:09 +03:00
parent 497e1b740f
commit 2eb185b14a
29 changed files with 2264 additions and 181 deletions
+11 -1
View File
@@ -13,7 +13,7 @@ use std::{
use rand::random;
use sha2::{Digest, Sha256};
use crate::{ArtifactError, ArtifactRef, MAX_ARTIFACT_BYTES, StoredArtifact};
use crate::{ArtifactError, ArtifactRef, MAX_ARTIFACT_BYTES, RegisteredArtifact, StoredArtifact};
const SHA_DIR: &[u8] = b"sha256";
const TEMP_PREFIX: &str = ".crank-artifact-tmp-v1-";
@@ -106,6 +106,16 @@ impl ArtifactStore {
self.put_reader(&mut io::Cursor::new(bytes))
}
/// Stores bytes and returns a non-forgeable capability suitable for
/// creating authoritative registry metadata.
pub fn put_registered(&self, bytes: &[u8]) -> Result<RegisteredArtifact, ArtifactError> {
let stored = self.put(bytes)?;
Ok(RegisteredArtifact {
artifact_ref: stored.artifact_ref,
size_bytes: stored.size_bytes,
})
}
/// Historical spelling retained for source compatibility; bytes are not
/// restricted to UTF-8 at this filesystem boundary.
pub fn put_utf8(&self, bytes: &[u8]) -> Result<StoredArtifact, ArtifactError> {