Skip to main content

locus_core_rs/application/services/
rekey_scope_service.rs

1use std::sync::Arc;
2
3use anyhow::Result;
4
5use crate::domain::contracts::NodeStore;
6use crate::domain::models::BatchRekeyResult;
7
8pub struct RekeyScopeService {
9    store: Arc<dyn NodeStore>,
10}
11
12impl RekeyScopeService {
13    pub fn new(store: Arc<dyn NodeStore>) -> Self {
14        Self { store }
15    }
16
17    pub async fn rekey_async(
18        &self,
19        node_ids: Vec<String>,
20        target_tenant_id: &str,
21        target_session_id: &str,
22        dry_run: bool,
23        allow_merge: bool,
24    ) -> Result<BatchRekeyResult> {
25        self.store
26            .batch_rekey_scopes_async(
27                node_ids,
28                target_tenant_id,
29                target_session_id,
30                dry_run,
31                allow_merge,
32            )
33            .await
34    }
35}