pub struct ReleaseCommandHandler { /* private fields */ }Expand description
ReleaseCommandHandler orchestrates the software release workflow
The ReleaseCommandHandler orchestrates the software release workflow to
deploy software to a configured environment.
This command handler handles all steps required to release software:
- Load the environment from storage
- Validate the environment is in the correct state
- Render Docker Compose templates to the build directory
- Deploy compose files to the remote host via Ansible
- Transition environment to
Releasedstate
§Architecture
Follows the three-level architecture:
- Command (Level 1): This handler orchestrates the release workflow
- Step (Level 2):
RenderDockerComposeTemplatesStep,DeployComposeFilesStep - Remote Action (Level 3): Ansible playbook executes on remote host
§State Management
The command handler integrates with the type-state pattern for environment lifecycle:
- Accepts environment in
Configuredstate - Transitions to
Environment<Releasing>at start - Returns
Environment<Released>on success - Transitions to
Environment<ReleaseFailed>on error
State is persisted after each transition using the injected repository.
Implementations§
Source§impl ReleaseCommandHandler
impl ReleaseCommandHandler
Sourcepub fn new(
repository: Arc<dyn EnvironmentRepository>,
clock: Arc<dyn Clock>,
) -> Self
pub fn new( repository: Arc<dyn EnvironmentRepository>, clock: Arc<dyn Clock>, ) -> Self
Create a new ReleaseCommandHandler
Sourcepub async fn execute(
&self,
env_name: &EnvironmentName,
listener: Option<&dyn CommandProgressListener>,
) -> Result<Environment<Released>, ReleaseCommandHandlerError>
pub async fn execute( &self, env_name: &EnvironmentName, listener: Option<&dyn CommandProgressListener>, ) -> Result<Environment<Released>, ReleaseCommandHandlerError>
Execute the release workflow
§Arguments
env_name- The name of the environment to release tolistener- Optional progress listener for step-level reporting
§Returns
Returns Ok(Environment<Released>) on success
§Errors
Returns an error if:
- Environment not found
- Environment is not in
Configuredstate - Docker Compose template rendering fails
- File deployment to VM fails
- State persistence fails
Auto Trait Implementations§
impl !RefUnwindSafe for ReleaseCommandHandler
impl !Send for ReleaseCommandHandler
impl !Sync for ReleaseCommandHandler
impl !UnwindSafe for ReleaseCommandHandler
impl Freeze for ReleaseCommandHandler
impl Unpin for ReleaseCommandHandler
impl UnsafeUnpin for ReleaseCommandHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request