forked from NationTech/harmony
		
	chore: Fix pr comments, remove many YAGNI things
This commit is contained in:
		
							parent
							
								
									bf16566b4e
								
							
						
					
					
						commit
						7cd541bdd8
					
				| @ -1,6 +1,6 @@ | |||||||
| use serde::{Deserialize, Serialize}; | use serde::{Deserialize, Serialize}; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, Serialize, Deserialize)] | #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||||||
| pub struct Id { | pub struct Id { | ||||||
|     value: String, |     value: String, | ||||||
| } | } | ||||||
|  | |||||||
| @ -13,23 +13,7 @@ pub trait TenantManager: Send + Sync + std::fmt::Debug { | |||||||
|     ///
 |     ///
 | ||||||
|     /// # Arguments
 |     /// # Arguments
 | ||||||
|     /// * `config`: The desired configuration for the new tenant.
 |     /// * `config`: The desired configuration for the new tenant.
 | ||||||
|     ///
 |     async fn provision_tenant(&self, config: &TenantConfig) -> Result<(), ExecutorError>; | ||||||
|     /// # Returns
 |  | ||||||
|     /// A `TenantContext` representing the provisioned tenant.
 |  | ||||||
|     async fn provision_tenant(&self, config: &TenantConfig) |  | ||||||
|     -> Result<TenantContext, ExecutorError>; |  | ||||||
| 
 |  | ||||||
|     /// Retrieves the current details and context of an existing tenant.
 |  | ||||||
|     ///
 |  | ||||||
|     /// # Arguments
 |  | ||||||
|     /// * `tenant_name`: The logical name of the tenant to retrieve.
 |  | ||||||
|     ///
 |  | ||||||
|     /// # Returns
 |  | ||||||
|     /// An `Option<TenantContext>`, which is `None` if the tenant does not exist.
 |  | ||||||
|     async fn get_tenant_details( |  | ||||||
|         &self, |  | ||||||
|         tenant_name: &str, |  | ||||||
|     ) -> Result<Option<TenantContext>, ExecutorError>; |  | ||||||
| 
 | 
 | ||||||
|     /// Updates the resource limits for an existing tenant.
 |     /// Updates the resource limits for an existing tenant.
 | ||||||
|     ///
 |     ///
 | ||||||
| @ -59,7 +43,4 @@ pub trait TenantManager: Send + Sync + std::fmt::Debug { | |||||||
|     /// # Arguments
 |     /// # Arguments
 | ||||||
|     /// * `tenant_name`: The logical name of the tenant to deprovision.
 |     /// * `tenant_name`: The logical name of the tenant to deprovision.
 | ||||||
|     async fn deprovision_tenant(&self, tenant_name: &str) -> Result<(), ExecutorError>; |     async fn deprovision_tenant(&self, tenant_name: &str) -> Result<(), ExecutorError>; | ||||||
| 
 |  | ||||||
|     /// Lists the logical names of all tenants currently managed by this `TenantManager` instance.
 |  | ||||||
|     async fn list_tenant_names(&self) -> Result<Vec<String>, ExecutorError>; |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,14 +4,16 @@ use serde::{Deserialize, Serialize}; | |||||||
| 
 | 
 | ||||||
| use std::collections::HashMap; | use std::collections::HashMap; | ||||||
| 
 | 
 | ||||||
|  | use crate::data::Id; | ||||||
|  | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] // Assuming serde for Scores
 | #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] // Assuming serde for Scores
 | ||||||
| pub struct TenantConfig { | pub struct TenantConfig { | ||||||
|     /// A unique, human-readable name for the tenant (e.g., "client-alpha", "project-phoenix").
 |     /// This will be used as the primary unique identifier for management operations and will never
 | ||||||
|     /// This will be used as the primary identifier for management operations.
 |     /// change for the entire lifetime of the tenant
 | ||||||
|     pub name: String, |     pub id: Id, | ||||||
| 
 | 
 | ||||||
|     /// An optional description for the tenant.
 |     /// A human-readable name for the tenant (e.g., "client-alpha", "project-phoenix").
 | ||||||
|     pub description: Option<String>, |     pub name: String, | ||||||
| 
 | 
 | ||||||
|     /// Desired resource allocations and limits for the tenant.
 |     /// Desired resource allocations and limits for the tenant.
 | ||||||
|     pub resource_limits: ResourceLimits, |     pub resource_limits: ResourceLimits, | ||||||
| @ -22,26 +24,6 @@ pub struct TenantConfig { | |||||||
|     /// Key-value pairs for provider-specific tagging, labeling, or metadata.
 |     /// Key-value pairs for provider-specific tagging, labeling, or metadata.
 | ||||||
|     /// Useful for billing, organization, or filtering within the provider's console.
 |     /// Useful for billing, organization, or filtering within the provider's console.
 | ||||||
|     pub labels_or_tags: HashMap<String, String>, |     pub labels_or_tags: HashMap<String, String>, | ||||||
|     // Note: User/group management for the tenant is deferred to a future ADR.
 |  | ||||||
|     // For now, the TenantManager sets up the space; how it's accessed internally
 |  | ||||||
|     // by the tenant's own users is a separate concern.
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] |  | ||||||
| pub struct TenantContext { |  | ||||||
|     /// The provider-specific internal identifier for the tenant's primary isolation unit
 |  | ||||||
|     /// (e.g., Kubernetes namespace name, OpenStack project ID, AWS Account ID).
 |  | ||||||
|     pub provider_internal_id: String, |  | ||||||
| 
 |  | ||||||
|     /// The logical name of the tenant, matching `TenantConfig.name`.
 |  | ||||||
|     pub name: String, |  | ||||||
| 
 |  | ||||||
|     /// Effective resource limits currently applied to the tenant.
 |  | ||||||
|     /// This might differ slightly from requested if the provider adjusted them.
 |  | ||||||
|     pub effective_resource_limits: ResourceLimits, |  | ||||||
| 
 |  | ||||||
|     /// Effective network policy currently applied.
 |  | ||||||
|     pub effective_network_policy: TenantNetworkPolicy, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] | #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] | ||||||
| @ -57,15 +39,7 @@ pub struct ResourceLimits { | |||||||
|     pub memory_limit_gb: Option<f32>, |     pub memory_limit_gb: Option<f32>, | ||||||
| 
 | 
 | ||||||
|     /// Total persistent storage allocation in Gigabytes across all volumes.
 |     /// Total persistent storage allocation in Gigabytes across all volumes.
 | ||||||
|     pub storage_total_gb: Option<u64>, |     pub storage_total_gb: Option<f32>, | ||||||
|     /// Maximum number of distinct persistent volumes/claims.
 |  | ||||||
|     pub persistent_volume_claim_count: Option<u32>, |  | ||||||
|     // /// Optional: Storage limits per class, if needed for more granular control.
 |  | ||||||
|     // pub storage_gb_per_class: Option<HashMap<String, u64>>,
 |  | ||||||
|     /// Maximum number of load balancers.
 |  | ||||||
|     pub load_balancer_count: Option<u32>, |  | ||||||
|     /// Maximum number of public IP addresses.
 |  | ||||||
|     pub public_ip_count: Option<u32>, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user