feat: rename farmer to resource provider across codebase and update terminology
This commit is contained in:
@@ -42,7 +42,7 @@ pub struct SliceCombination {
|
||||
pub node_location: String,
|
||||
pub node_certification_type: String,
|
||||
pub node_id: String,
|
||||
pub farmer_email: String,
|
||||
pub resource_provider_email: String,
|
||||
}
|
||||
|
||||
/// Track individual slice rentals
|
||||
@@ -70,7 +70,7 @@ pub enum AllocationStatus {
|
||||
pub struct SlicePricing {
|
||||
pub base_price_per_hour: Decimal, // Price for 1 base slice per hour
|
||||
pub currency: String,
|
||||
pub pricing_multiplier: Decimal, // Farmer can adjust pricing (0.5x - 2.0x)
|
||||
pub pricing_multiplier: Decimal, // ResourceProvider can adjust pricing (0.5x - 2.0x)
|
||||
}
|
||||
|
||||
impl Default for SlicePricing {
|
||||
@@ -157,7 +157,7 @@ impl SliceCalculatorService {
|
||||
max_base_slices: u32,
|
||||
allocated_slices: u32,
|
||||
node: &FarmNode,
|
||||
farmer_email: &str
|
||||
resource_provider_email: &str
|
||||
) -> Vec<SliceCombination> {
|
||||
let available_base_slices = max_base_slices.saturating_sub(allocated_slices);
|
||||
let mut combinations = Vec::new();
|
||||
@@ -208,7 +208,7 @@ impl SliceCalculatorService {
|
||||
.to_string())
|
||||
.unwrap_or_else(|| "DIY".to_string()),
|
||||
node_id: node.id.clone(),
|
||||
farmer_email: farmer_email.to_string(),
|
||||
resource_provider_email: resource_provider_email.to_string(),
|
||||
};
|
||||
|
||||
combinations.push(combination);
|
||||
@@ -225,7 +225,7 @@ impl SliceCalculatorService {
|
||||
max_base_slices: u32,
|
||||
allocated_slices: u32,
|
||||
node: &FarmNode,
|
||||
farmer_email: &str,
|
||||
resource_provider_email: &str,
|
||||
uptime_percentage: f64,
|
||||
bandwidth_mbps: u32,
|
||||
base_price_per_hour: Decimal
|
||||
@@ -283,7 +283,7 @@ impl SliceCalculatorService {
|
||||
.to_string())
|
||||
.unwrap_or_else(|| "DIY".to_string()),
|
||||
node_id: node.id.clone(),
|
||||
farmer_email: farmer_email.to_string(),
|
||||
resource_provider_email: resource_provider_email.to_string(),
|
||||
};
|
||||
|
||||
combinations.push(combination);
|
||||
@@ -304,7 +304,7 @@ impl SliceCalculatorService {
|
||||
&self,
|
||||
node: &mut FarmNode,
|
||||
rented_base_slices: u32,
|
||||
farmer_email: &str
|
||||
resource_provider_email: &str
|
||||
) -> Result<(), String> {
|
||||
// Update allocated count
|
||||
node.allocated_base_slices += rented_base_slices as i32;
|
||||
@@ -314,7 +314,7 @@ impl SliceCalculatorService {
|
||||
node.total_base_slices as u32,
|
||||
node.allocated_base_slices as u32,
|
||||
node,
|
||||
farmer_email
|
||||
resource_provider_email
|
||||
);
|
||||
node.available_combinations = combinations.iter()
|
||||
.map(|c| serde_json::to_value(c).unwrap_or_default())
|
||||
@@ -328,7 +328,7 @@ impl SliceCalculatorService {
|
||||
&self,
|
||||
node: &mut FarmNode,
|
||||
released_base_slices: u32,
|
||||
farmer_email: &str
|
||||
resource_provider_email: &str
|
||||
) -> Result<(), String> {
|
||||
// Update allocated count
|
||||
node.allocated_base_slices = node.allocated_base_slices.saturating_sub(released_base_slices as i32);
|
||||
@@ -338,7 +338,7 @@ impl SliceCalculatorService {
|
||||
node.total_base_slices as u32,
|
||||
node.allocated_base_slices as u32,
|
||||
node,
|
||||
farmer_email
|
||||
resource_provider_email
|
||||
).iter()
|
||||
.map(|c| serde_json::to_value(c).unwrap_or_default())
|
||||
.collect();
|
||||
@@ -364,7 +364,7 @@ pub struct SliceRental {
|
||||
pub rental_id: String,
|
||||
pub slice_combination_id: String,
|
||||
pub node_id: String,
|
||||
pub farmer_email: String,
|
||||
pub resource_provider_email: String,
|
||||
pub slice_allocation: SliceAllocation,
|
||||
pub total_cost: Decimal,
|
||||
pub payment_status: PaymentStatus,
|
||||
|
Reference in New Issue
Block a user