feat: add an API for removing installed instances

Open Beginner friendly
#265 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
api

Research direction

Start in the launcher module that exposes inspect_instances / inspect_instance and reuse the same instance-root lookup and validation for a new remove_instance. Read Instance::instance_root to confirm what exactly gets deleted, then add a RemoveInstanceOutcome enum with Removed and NotFound. Done means the method returns NotFound for unknown names, removes the root for known ones, and a test covers both cases.

Written by the indexing model from the issue text.

Description

Problem

Launcher exposes inspect_instances / inspect_instance and Instance::instance_root, but there is no API to remove an installed instance. Launcher UIs that implement instance deletion have to inspect the instance, reach into instance_root, and delete the directory themselves. That duplicates filesystem/layout knowledge outside Elemental and makes cleanup behavior inconsistent between launchers.

Expected API

A removal method on Launcher, for example:

pub async fn remove_instance(&self, instance_name: impl Into<String>) -> Result<RemoveInstanceOutcome>

Possible outcome: Removed, NotFound. The method should own path validation and removal of the instance root. If future instance metadata lives outside the instance directory, this API can clean it up too.

Current workaround

Particle currently calls inspect_instance(name), then tokio::fs::remove_dir_all(instance.instance_root), then reloads the instance list. This works but bypasses the launcher abstraction.

Why this belongs upstream

Instance layout and detection are owned by Elemental. Deletion should follow the same layout rules and be reusable by any launcher built on the crate.

Dominant language
Rust
Stars
11
Forks
1
Avg merge
3h 32m
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ElectronicWave/Elemental

All issues in ElectronicWave/Elemental

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.