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
//! Recovery policy types and hooks for codec error handling.
//!
//! This module provides infrastructure for customising how codec errors are
//! handled, including recovery policies, error context for structured logging,
//! and hooks for application-specific error handling.
//!
//! # Recovery Policies
//!
//! When a codec error occurs, the framework applies a recovery policy:
//!
//! - [`RecoveryPolicy::Drop`]: Discard the malformed frame and continue processing. Suitable for
//! recoverable errors like oversized frames.
//! - [`RecoveryPolicy::Quarantine`]: Pause the connection temporarily before retrying. Useful for
//! rate-limiting misbehaving clients.
//! - [`RecoveryPolicy::Disconnect`]: Terminate the connection immediately. Required for
//! unrecoverable errors like I/O failures.
//!
//! # Custom Recovery Hooks
//!
//! Applications can customise error handling by implementing
//! [`RecoveryPolicyHook`]:
//!
//! ```
//! use std::time::Duration;
//!
//! use wireframe::codec::{CodecError, CodecErrorContext, RecoveryPolicy, RecoveryPolicyHook};
//!
//! struct StrictRecovery;
//!
//! impl RecoveryPolicyHook for StrictRecovery {
//! fn recovery_policy(&self, _error: &CodecError, _ctx: &CodecErrorContext) -> RecoveryPolicy {
//! // Disconnect on any error
//! RecoveryPolicy::Disconnect
//! }
//! }
//! ```
pub use RecoveryConfig;
pub use CodecErrorContext;
pub use ;
pub use RecoveryPolicy;