Skip to main content

BlueprintStore

Trait BlueprintStore 

Source
pub trait BlueprintStore: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn read_head<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 BlueprintId,
    ) -> Pin<Box<dyn Future<Output = Result<Traced<Blueprint>, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_new<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        id: &'life1 BlueprintId,
        new_bp: &'life2 Blueprint,
        parents: &'life3 [BlueprintVersion],
        metadata: CommitMetadata,
    ) -> Pin<Box<dyn Future<Output = Result<BlueprintVersion, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn read_version<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 BlueprintId,
        version: BlueprintVersion,
    ) -> Pin<Box<dyn Future<Output = Result<Traced<Blueprint>, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn history<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 BlueprintId,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<BlueprintVersion>, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_ids<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<BlueprintId>, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn read_commit_rationale<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _id: &'life1 BlueprintId,
        _version: BlueprintVersion,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn archive_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _id: &'life1 BlueprintId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn unarchive_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _id: &'life1 BlueprintId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn is_archived<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _id: &'life1 BlueprintId,
    ) -> Pin<Box<dyn Future<Output = Result<bool, BlueprintStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

The Blueprint-VCS abstract interface. Backed by Git2, InMemory, Remote, and so on.

§Design principles

  • Do not leak Git concepts (commit / tree / refs) into the interface.
  • Abstract versions as BlueprintVersion = ContentHash (blake3).
  • Keep the surface async, matching the engine’s existing traits.

Required Methods§

Source

fn name(&self) -> &str

Backend identifier, for logging / diagnostics (e.g. "git2", "in-memory").

Source

fn read_head<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 BlueprintId, ) -> Pin<Box<dyn Future<Output = Result<Traced<Blueprint>, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the current head — the latest commit for this BlueprintId.

Source

fn write_new<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 BlueprintId, new_bp: &'life2 Blueprint, parents: &'life3 [BlueprintVersion], metadata: CommitMetadata, ) -> Pin<Box<dyn Future<Output = Result<BlueprintVersion, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Append a new Blueprint. Computes the ContentHash and returns the resulting BlueprintVersion.

Source

fn read_version<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 BlueprintId, version: BlueprintVersion, ) -> Pin<Box<dyn Future<Output = Result<Traced<Blueprint>, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up a past version — used for audit or debug.

Source

fn history<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 BlueprintId, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<BlueprintVersion>, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List history newest-to-oldest, up to limit; head included.

Source

fn list_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<BlueprintId>, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List every BlueprintId (relevant when the Layout::Multi axis is in use).

Provided Methods§

Source

fn read_commit_rationale<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 BlueprintId, _version: BlueprintVersion, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the rationale attached to a commit (its CommitMetadata.rationale, a one-line changelog). Backends that cannot recover it return Ok(None); the trait’s default implementation returns None.

Source

fn archive_id<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 BlueprintId, ) -> Pin<Box<dyn Future<Output = Result<(), BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Archive a BlueprintId — logical soft-delete via an archive marker commit. After archive, read_head returns BlueprintStoreError::Archived, list_ids filters the id out by default, and downstream resolvers (e.g. swarm_run(id)) hard-reject with the same error.

Restoring is symmetric — unarchive_id appends an unarchive marker commit and re-exposes the id. History is preserved end-to- end; nothing is physically removed.

Default implementation returns BlueprintStoreError::Unsupported; only backends that support archive semantics (Git2) override.

Source

fn unarchive_id<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 BlueprintId, ) -> Pin<Box<dyn Future<Output = Result<(), BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reverse of archive_id — append an unarchive marker commit to the main head and re-expose the id.

Source

fn is_archived<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 BlueprintId, ) -> Pin<Box<dyn Future<Output = Result<bool, BlueprintStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return true if the id is currently archived. Default returns Ok(false) for backends that never archive.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§