pub struct PurgeCommandController { /* private fields */ }Expand description
Presentation layer controller for purge command workflow
Coordinates user interaction, progress reporting, and input validation
before delegating to the application layer PurgeCommandHandler.
§Responsibilities
- Validate user input (environment name format)
- Show progress updates to the user
- Handle confirmation prompts (unless –force is provided)
- Format success/error messages for display
- Delegate business logic to application layer
§Architecture
This controller sits in the presentation layer and handles all user-facing
concerns. It delegates actual business logic to the application layer’s
PurgeCommandHandler, maintaining clear separation of concerns.
Implementations§
Source§impl PurgeCommandController
impl PurgeCommandController
Sourcepub fn new(
handler: PurgeCommandHandler,
user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>,
) -> Self
pub fn new( handler: PurgeCommandHandler, user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>, ) -> Self
Create a new purge command controller
Creates a PurgeCommandController with the application handler.
This follows the single container architecture pattern.
Sourcepub async fn execute(
&mut self,
environment_name: &str,
force: bool,
output_format: OutputFormat,
) -> Result<(), PurgeSubcommandError>
pub async fn execute( &mut self, environment_name: &str, force: bool, output_format: OutputFormat, ) -> Result<(), PurgeSubcommandError>
Execute the complete purge workflow
Orchestrates all steps of the purge command:
- Validate environment name
- Confirm operation (unless –force is provided)
- Purge local data
- Complete with success message
§Arguments
environment_name- The name of the environment to purgeforce- Skip confirmation prompt if trueoutput_format- Output format (text or JSON)
§Errors
Returns an error if:
- Environment name is invalid (format validation fails)
- Environment cannot be loaded from repository
- User cancels operation at confirmation prompt
- Purge operation fails
- Progress reporting encounters a poisoned mutex
§Returns
Returns Ok(()) on success, or a PurgeSubcommandError if any step fails.
Auto Trait Implementations§
impl !RefUnwindSafe for PurgeCommandController
impl !UnwindSafe for PurgeCommandController
impl Freeze for PurgeCommandController
impl Send for PurgeCommandController
impl Sync for PurgeCommandController
impl Unpin for PurgeCommandController
impl UnsafeUnpin for PurgeCommandController
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