xmtp_api_d14n/protocol/
extractors.rs

1//! Extractors transform [`ProtocolEnvelope`]'s into logical types usable by xmtp_mls
2
3use super::{EnvelopeCollection, EnvelopeError, Extractor, ProtocolEnvelope};
4use xmtp_common::{RetryableError, retryable};
5
6mod aggregate;
7pub use aggregate::*;
8mod group_messages;
9pub use group_messages::*;
10mod identity_updates;
11pub use identity_updates::*;
12mod group_message_metadata;
13pub use group_message_metadata::*;
14mod key_packages;
15pub use key_packages::*;
16mod payloads;
17pub use payloads::*;
18mod welcomes;
19pub use welcomes::*;
20mod topics;
21pub use topics::*;
22mod data;
23pub use data::*;
24mod cursor;
25pub use cursor::*;
26mod timestamp;
27pub use timestamp::*;
28mod depends_on;
29pub use depends_on::*;
30mod bytes;
31pub use bytes::*;
32mod orphaned_envelope;
33pub use orphaned_envelope::*;
34
35#[cfg(test)]
36pub mod test_utils;
37
38#[derive(thiserror::Error, Debug)]
39pub enum ExtractionError {
40    #[error(transparent)]
41    Payload(#[from] PayloadExtractionError),
42    #[error(transparent)]
43    Topic(#[from] TopicExtractionError),
44    #[error(transparent)]
45    Conversion(#[from] xmtp_proto::ConversionError),
46}
47
48impl RetryableError for ExtractionError {
49    fn is_retryable(&self) -> bool {
50        match self {
51            Self::Payload(p) => retryable!(p),
52            Self::Topic(t) => retryable!(t),
53            Self::Conversion(c) => retryable!(c),
54        }
55    }
56}