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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Retry-wrapped effect operations.
//!
//! This module provides Effect-based wrappers with automatic retry logic:
//! - Read file with retry
//! - Read file bytes with retry
//! - Walk directory with retry
//! - Write file with retry
//!
//! # Design Philosophy
//!
//! These operations wrap the basic I/O effects with retry logic, automatically
//! retrying on transient errors like:
//! - File locked by another process
//! - Resource temporarily unavailable
//! - Network filesystem issues
//!
//! Non-retryable errors (file not found, permission denied for non-temp
//! reasons) fail immediately without retry.
use crateRetryConfig;
use crate;
use PathBuf;
use walk_dir_effect;
use ;
/// Read file with automatic retry for transient failures.
///
/// This wraps `read_file_effect` with retry logic, automatically retrying
/// on transient errors like:
/// - File locked by another process
/// - Resource temporarily unavailable
/// - Network filesystem issues
///
/// Non-retryable errors (file not found, permission denied for non-temp
/// reasons) fail immediately without retry.
///
/// # Arguments
///
/// * `path` - Path to the file to read
/// * `retry_config` - Configuration for retry behavior
///
/// # Example
///
/// ```rust,ignore
/// use debtmap::io::effects::read_file_with_retry_effect;
/// use debtmap::config::RetryConfig;
///
/// let config = RetryConfig::default();
/// let effect = read_file_with_retry_effect("data.json".into(), config);
/// let content = run_effect(effect, DebtmapConfig::default())?;
/// ```
/// Read file bytes with automatic retry for transient failures.
///
/// Similar to `read_file_with_retry_effect` but returns raw bytes.
/// Walk directory with automatic retry for transient failures.
///
/// Retries the directory walk operation on transient filesystem errors.
/// Write file with automatic retry for transient failures.
///
/// Retries write operations on transient errors like disk busy
/// or temporary unavailability.
///
/// # Note
///
/// Be careful with retry on write operations - ensure the operation
/// is idempotent (writing the same content multiple times is safe).