pub struct PurgeCommandHandler { /* private fields */ }Expand description
PurgeCommandHandler orchestrates the removal of all local environment data
This command handler removes all local files associated with an environment:
- Removes the
data/{env-name}/directory (environment state, configs, etc.) - Removes the
build/{env-name}/directory (generated templates, artifacts) - Removes the environment entry from the repository
§State Management
Unlike other commands, purge does not transition environment state:
- Works on environments in any state
- Removes all local data regardless of current state
- Does not persist state after purge (the environment data is removed)
§Idempotency
The purge operation is idempotent. Running it multiple times on the same environment will:
- Succeed if the directories are already removed
- Not fail due to missing resources
- Report appropriate status to the user
§Important Notes
- Does NOT destroy infrastructure: Only removes local files
- Irreversible operation: All local environment data is permanently deleted
- Works in any state: Can purge environments that are Created, Provisioned, Running, etc.
Implementations§
Source§impl PurgeCommandHandler
impl PurgeCommandHandler
Sourcepub fn new(
repository: Arc<dyn EnvironmentRepository + Send + Sync>,
working_dir: PathBuf,
) -> Self
pub fn new( repository: Arc<dyn EnvironmentRepository + Send + Sync>, working_dir: PathBuf, ) -> Self
Create a new PurgeCommandHandler
§Arguments
repository- Repository for accessing environment dataworking_dir- Root directory containingdata/andbuild/subdirectories
Sourcepub fn execute(
&self,
env_name: &EnvironmentName,
) -> Result<(), PurgeCommandHandlerError>
pub fn execute( &self, env_name: &EnvironmentName, ) -> Result<(), PurgeCommandHandlerError>
Execute the complete purge workflow
§Arguments
env_name- The name of the environment to purge
§Errors
Returns an error if:
- Environment not found in repository
- Unable to remove data directory due to permissions or I/O errors
- Unable to remove build directory due to permissions or I/O errors
- Unable to remove environment from repository
If directories are already removed, the operation succeeds (idempotent).
Auto Trait Implementations§
impl Freeze for PurgeCommandHandler
impl !RefUnwindSafe for PurgeCommandHandler
impl Send for PurgeCommandHandler
impl Sync for PurgeCommandHandler
impl Unpin for PurgeCommandHandler
impl UnsafeUnpin for PurgeCommandHandler
impl !UnwindSafe for PurgeCommandHandler
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