Create SliceRentalManager and SliceAssignmentManager traits #27

Closed
opened 2026-02-09 22:53:41 +00:00 by mik-tf · 0 comments
Owner

Problem

Slice rental and slice assignment operations bypass ServiceProvider entirely because no traits exist for these domains. Controllers use SliceRentalService::builder() and SliceAssignmentService::builder() directly.

New traits needed

SliceRentalManager (~3 methods)

async fn rent_slice_combination(&self, ...) -> Result<SliceRental, ServiceError>;
async fn rent_with_deployment(&self, ...) -> Result<SliceRental, ServiceError>;
async fn get_user_slice_rentals(&self, user_email: &str) -> Result<Vec<SliceRental>, ServiceError>;

SliceAssignmentManager (~6 methods)

async fn create_assignment(&self, request: AssignmentRequest) -> Result<SliceAssignment, ServiceError>;
async fn get_user_assignments(&self, user_email: &str) -> Result<Vec<SliceAssignment>, ServiceError>;
async fn get_assignment_details(&self, id: &str, user_email: &str) -> Result<SliceAssignment, ServiceError>;
async fn update_assignment(&self, id: &str, user_email: &str, config: ...) -> Result<(), ServiceError>;
async fn delete_assignment(&self, id: &str, user_email: &str) -> Result<(), ServiceError>;
async fn deploy_assignment(&self, id: &str, user_email: &str) -> Result<DeploymentResult, ServiceError>;

Implementation

  1. Define traits in src/services/traits/mod.rs
  2. Add fields to ServiceProvider struct in src/services/provider.rs
  3. Create fixture impls in src/services/impl_fixtures/
  4. Create hero impls in src/services/impl_hero/
  5. Wire into fixtures() and hero() factory methods
## Problem Slice rental and slice assignment operations bypass ServiceProvider entirely because no traits exist for these domains. Controllers use `SliceRentalService::builder()` and `SliceAssignmentService::builder()` directly. ## New traits needed ### SliceRentalManager (~3 methods) ```rust async fn rent_slice_combination(&self, ...) -> Result<SliceRental, ServiceError>; async fn rent_with_deployment(&self, ...) -> Result<SliceRental, ServiceError>; async fn get_user_slice_rentals(&self, user_email: &str) -> Result<Vec<SliceRental>, ServiceError>; ``` ### SliceAssignmentManager (~6 methods) ```rust async fn create_assignment(&self, request: AssignmentRequest) -> Result<SliceAssignment, ServiceError>; async fn get_user_assignments(&self, user_email: &str) -> Result<Vec<SliceAssignment>, ServiceError>; async fn get_assignment_details(&self, id: &str, user_email: &str) -> Result<SliceAssignment, ServiceError>; async fn update_assignment(&self, id: &str, user_email: &str, config: ...) -> Result<(), ServiceError>; async fn delete_assignment(&self, id: &str, user_email: &str) -> Result<(), ServiceError>; async fn deploy_assignment(&self, id: &str, user_email: &str) -> Result<DeploymentResult, ServiceError>; ``` ## Implementation 1. Define traits in `src/services/traits/mod.rs` 2. Add fields to `ServiceProvider` struct in `src/services/provider.rs` 3. Create fixture impls in `src/services/impl_fixtures/` 4. Create hero impls in `src/services/impl_hero/` 5. Wire into `fixtures()` and `hero()` factory methods
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coopcloud_code/projectmycelium_marketplace#27
No description provided.