Skip to main content

aura_core/effects/
supertraits.rs

1//! Sealed supertraits for common effect combinations
2//!
3//! This module provides sealed supertraits that group commonly used effect trait
4//! combinations to improve type signature readability and maintainability.
5//!
6//! # Module Classification
7//!
8//! - **Category**: Composite Effect Traits
9//! - **Purpose**: Convenience wrappers combining multiple effect traits
10//!
11//! This module provides sealed supertraits (e.g., `SigningEffects`, `ChoreographyEffects`)
12//! that combine commonly-used effect trait combinations. These are blanket implementations
13//! that simplify type signatures. No handlers needed - these are pure trait composition.
14
15use super::{
16    ConsoleEffects, CryptoEffects, JournalEffects, NetworkEffects, PhysicalTimeEffects,
17    RandomEffects, StorageEffects,
18};
19
20/// Sealed supertrait for FROST threshold signing operations
21///
22/// Combines effects needed for cryptographic threshold signing protocols:
23/// network communication, cryptographic operations, time tracking, and logging.
24pub trait SigningEffects:
25    NetworkEffects + CryptoEffects + PhysicalTimeEffects + ConsoleEffects
26{
27    // Sealed trait - users cannot implement this directly
28}
29
30/// Automatic implementation for types that satisfy the required bounds
31impl<T> SigningEffects for T where
32    T: NetworkEffects + CryptoEffects + PhysicalTimeEffects + ConsoleEffects
33{
34}
35
36/// Sealed supertrait for CRDT synchronization operations
37///
38/// Combines effects needed for CRDT state management and synchronization:
39/// storage access, journal operations, and logging.
40pub trait CrdtEffects: StorageEffects + JournalEffects + ConsoleEffects {
41    // Sealed trait - users cannot implement this directly
42}
43
44/// Automatic implementation for types that satisfy the required bounds
45impl<T> CrdtEffects for T where T: StorageEffects + JournalEffects + ConsoleEffects {}
46
47/// Sealed supertrait for choreography coordination
48///
49/// Combines effects needed for multi-party protocol coordination:
50/// network communication, cryptographic operations, randomness, time tracking,
51/// storage access, journal operations, and logging.
52pub trait ChoreographyEffects:
53    NetworkEffects
54    + CryptoEffects
55    + RandomEffects
56    + PhysicalTimeEffects
57    + StorageEffects
58    + JournalEffects
59    + ConsoleEffects
60{
61    // Sealed trait - users cannot implement this directly
62}
63
64/// Automatic implementation for types that satisfy the required bounds
65impl<T> ChoreographyEffects for T where
66    T: NetworkEffects
67        + CryptoEffects
68        + RandomEffects
69        + PhysicalTimeEffects
70        + StorageEffects
71        + JournalEffects
72        + ConsoleEffects
73{
74}
75
76/// Sealed supertrait for anti-entropy synchronization
77///
78/// Combines effects needed for anti-entropy protocols:
79/// network communication, cryptographic operations, randomness, and logging.
80pub trait AntiEntropyEffects:
81    NetworkEffects + CryptoEffects + RandomEffects + ConsoleEffects
82{
83    // Sealed trait - users cannot implement this directly
84}
85
86/// Automatic implementation for types that satisfy the required bounds
87impl<T> AntiEntropyEffects for T where
88    T: NetworkEffects + CryptoEffects + RandomEffects + ConsoleEffects
89{
90}
91
92/// Sealed supertrait for tree operations
93///
94/// Combines effects needed for tree coordination protocols:
95/// network communication, cryptographic operations, time tracking,
96/// storage access, and logging.
97pub trait TreeEffects:
98    NetworkEffects + CryptoEffects + PhysicalTimeEffects + StorageEffects + ConsoleEffects
99{
100    // Sealed trait - users cannot implement this directly
101}
102
103/// Automatic implementation for types that satisfy the required bounds
104impl<T> TreeEffects for T where
105    T: NetworkEffects + CryptoEffects + PhysicalTimeEffects + StorageEffects + ConsoleEffects
106{
107}
108
109/// Sealed supertrait for minimal effect operations
110///
111/// Combines basic effects needed for simple operations:
112/// cryptographic operations, randomness, and logging.
113pub trait MinimalEffects: CryptoEffects + RandomEffects + ConsoleEffects {
114    // Sealed trait - users cannot implement this directly
115}
116
117/// Automatic implementation for types that satisfy the required bounds
118impl<T> MinimalEffects for T where T: CryptoEffects + RandomEffects + ConsoleEffects {}
119
120/// Sealed supertrait for snapshot coordination
121///
122/// Combines effects needed for snapshot coordination protocols:
123/// network communication, cryptographic operations, time tracking,
124/// storage access, journal operations, and logging.
125pub trait SnapshotEffects:
126    NetworkEffects
127    + CryptoEffects
128    + PhysicalTimeEffects
129    + StorageEffects
130    + JournalEffects
131    + ConsoleEffects
132{
133    // Sealed trait - users cannot implement this directly
134}
135
136/// Automatic implementation for types that satisfy the required bounds
137impl<T> SnapshotEffects for T where
138    T: NetworkEffects
139        + CryptoEffects
140        + PhysicalTimeEffects
141        + StorageEffects
142        + JournalEffects
143        + ConsoleEffects
144{
145}