1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Batch operation tools for coordinated multi-file operations
use std::sync::Arc;
use turbovault_batch::{BatchExecutor, BatchOperation, BatchResult};
use turbovault_core::prelude::*;
use turbovault_vault::VaultManager;
/// Batch operation tools
#[derive(Clone)]
pub struct BatchTools {
pub manager: Arc<VaultManager>,
}
impl BatchTools {
/// Create new batch tools
pub fn new(manager: Arc<VaultManager>) -> Self {
Self { manager }
}
/// Execute batch operations sequentially, stopping at the first failure.
///
/// Each individual file mutation is atomic, but the batch as a whole is
/// not transactional: operations completed before a failure remain
/// applied and are reported in [`BatchResult::changes`].
pub async fn batch_execute(&self, operations: Vec<BatchOperation>) -> Result<BatchResult> {
let executor = BatchExecutor::from_manager(self.manager.clone());
executor.execute(operations).await
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_batch_tools_creation() {
// Tests in integration tests file
}
}