IoTRepository

Trait IoTRepository 

Source
pub trait IoTRepository: Send + Sync {
Show 15 methods // Required methods fn create_reading<'life0, 'life1, 'async_trait>( &'life0 self, reading: &'life1 IoTReading, ) -> Pin<Box<dyn Future<Output = Result<IoTReading, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn create_readings_bulk<'life0, 'life1, 'async_trait>( &'life0 self, readings: &'life1 [IoTReading], ) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_readings_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: Option<DeviceType>, metric_type: Option<MetricType>, start_date: DateTime<Utc>, end_date: DateTime<Utc>, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_consumption_stats<'life0, 'async_trait>( &'life0 self, building_id: Uuid, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<ConsumptionStatsDto, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_daily_aggregates<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<DailyAggregateDto>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_monthly_aggregates<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MonthlyAggregateDto>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn detect_anomalies<'life0, 'async_trait>( &'life0 self, building_id: Uuid, metric_type: MetricType, threshold_percentage: f64, lookback_days: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn create_linky_device<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 LinkyDevice, ) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_linky_device_by_id<'life0, 'async_trait>( &'life0 self, device_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_linky_device_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_linky_device_by_prm<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prm: &'life1 str, provider: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn update_linky_device<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 LinkyDevice, ) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_linky_device<'life0, 'async_trait>( &'life0 self, device_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_devices_needing_sync<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_devices_with_expired_tokens<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Repository port for IoT readings and Linky devices

Required Methods§

Source

fn create_reading<'life0, 'life1, 'async_trait>( &'life0 self, reading: &'life1 IoTReading, ) -> Pin<Box<dyn Future<Output = Result<IoTReading, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new IoT reading

Source

fn create_readings_bulk<'life0, 'life1, 'async_trait>( &'life0 self, readings: &'life1 [IoTReading], ) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create multiple IoT readings (bulk insert)

Source

fn find_readings_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: Option<DeviceType>, metric_type: Option<MetricType>, start_date: DateTime<Utc>, end_date: DateTime<Utc>, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find readings by building and time range

Source

fn get_consumption_stats<'life0, 'async_trait>( &'life0 self, building_id: Uuid, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<ConsumptionStatsDto, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get consumption statistics for a building

Source

fn get_daily_aggregates<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<DailyAggregateDto>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get daily aggregated readings

Source

fn get_monthly_aggregates<'life0, 'async_trait>( &'life0 self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MonthlyAggregateDto>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get monthly aggregated readings

Source

fn detect_anomalies<'life0, 'async_trait>( &'life0 self, building_id: Uuid, metric_type: MetricType, threshold_percentage: f64, lookback_days: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Detect anomalies (readings exceeding average by threshold percentage)

Source

fn create_linky_device<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 LinkyDevice, ) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new Linky device configuration

Source

fn find_linky_device_by_id<'life0, 'async_trait>( &'life0 self, device_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find Linky device by ID

Source

fn find_linky_device_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find Linky device by building ID

Source

fn find_linky_device_by_prm<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prm: &'life1 str, provider: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Find Linky device by PRM and provider

Source

fn update_linky_device<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 LinkyDevice, ) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update Linky device (tokens, sync status, etc.)

Source

fn delete_linky_device<'life0, 'async_trait>( &'life0 self, device_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete Linky device

Source

fn find_devices_needing_sync<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all Linky devices that need sync (sync_enabled=true AND (never synced OR last_sync > 24h))

Source

fn find_devices_with_expired_tokens<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all Linky devices with expired tokens (token_expires_at <= NOW + 5 minutes)

Implementors§