mssf_util/mock/
stateless.rs1use std::sync::Arc;
7
8use mssf_core::{runtime::IStatelessServicePartition, types::ServicePartitionInformation};
9
10pub struct StatelessServicePartitionMock {
13 info: ServicePartitionInformation,
14}
15
16impl StatelessServicePartitionMock {
17 pub fn new(info: ServicePartitionInformation) -> Self {
19 Self { info }
20 }
21 pub fn new_arc(info: ServicePartitionInformation) -> Arc<dyn IStatelessServicePartition> {
22 Arc::new(Self::new(info))
23 }
24}
25
26impl IStatelessServicePartition for StatelessServicePartitionMock {
27 fn get_partition_info(&self) -> mssf_core::Result<ServicePartitionInformation> {
28 Ok(self.info.clone())
29 }
30
31 fn report_load(&self, _metrics: &[mssf_core::types::LoadMetric]) -> mssf_core::Result<()> {
32 Ok(())
33 }
34
35 fn report_fault(&self, _fault_type: mssf_core::types::FaultType) -> mssf_core::Result<()> {
36 Ok(())
37 }
38
39 fn report_move_cost(&self, _move_cost: mssf_core::types::MoveCost) -> mssf_core::Result<()> {
40 Ok(())
41 }
42
43 fn report_partition_health(
44 &self,
45 _healthinfo: &mssf_core::types::HealthInformation,
46 ) -> mssf_core::Result<()> {
47 Ok(())
48 }
49
50 fn report_instance_health(
51 &self,
52 _health_info: &mssf_core::types::HealthInformation,
53 ) -> mssf_core::Result<()> {
54 Ok(())
55 }
56}