Skip to main content

EffectCtx

Struct EffectCtx 

Source
pub struct EffectCtx<'a> {
    pub runner: &'a dyn CommandRunner,
    pub clock: &'a dyn Clock,
    pub registry: &'a dyn RegistryQuery,
    pub repo_root: &'a Path,
    pub artifacts: &'a ReleaseArtifacts,
}
Expand description

The injected effect context every ReleaseAdapter method operates through.

Bundles the ADR-0001 ports an adapter is allowed to reach plus the repository root used as the working directory for every command. Holding only trait references keeps adapters testable with recording fakes and away from the real network or clock.

One scoped exception: the homebrew adapter writes the generated .rb directly with std::fs (a formula is a committed file; there is no “add a formula” CLI to route through CommandRunner) — the first-formula create (create-new / O_EXCL semantics) and the tap-write bump (truncating an existing regular file the path first verified via symlink_metadata, never following a symlink or creating). Both writes are confined to a private, unpredictable scratch checkout the path just cloned, and they are the sole direct-fs effects in the layer. A general filesystem port on this context is the cleaner long-term home (tracked as issue homebrew-adapter-fs-port); until then the exception is deliberate and local.

Fields§

§runner: &'a dyn CommandRunner

Runs external commands (package-manager / registry CLIs). The single seam an adapter shells out through.

§clock: &'a dyn Clock

Supplies publish timestamps for PublishReceipt as journaled facts.

§registry: &'a dyn RegistryQuery

Read-only registry lookups backing verify’s remote reconcile.

§repo_root: &'a Path

Repository root — the working directory every command runs in.

§artifacts: &'a ReleaseArtifacts

The concrete release artifacts threaded from build-all into publish-all (ADR-0002 §2) — the asset upload set and the source tarball a distribution adapter repackages. EMPTY_ARTIFACTS during the re-runnable dry-run / build phases (the artifacts are not yet known) and for every non-publish caller; the coordinator swaps in the computed value for the publish phase (via EffectCtx::with_artifacts) so a publish body can read it without re-deriving it.

Implementations§

Source§

impl<'a> EffectCtx<'a>

Source

pub fn with_artifacts(&self, artifacts: &'a ReleaseArtifacts) -> EffectCtx<'a>

The same effect context with artifacts swapped in — how the coordinator hands the computed release artifacts to the publish phase without manually re-threading every port (a new port added to EffectCtx is carried here automatically via the ..*self update).

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EffectCtx<'a>

§

impl<'a> !Send for EffectCtx<'a>

§

impl<'a> !Sync for EffectCtx<'a>

§

impl<'a> !UnwindSafe for EffectCtx<'a>

§

impl<'a> Freeze for EffectCtx<'a>

§

impl<'a> Unpin for EffectCtx<'a>

§

impl<'a> UnsafeUnpin for EffectCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.