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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! TAP (Trusted Attestation Protocol) service consumer for AT Protocol.
//!
//! This crate provides a client for consuming events from a TAP service,
//! which delivers filtered, verified AT Protocol repository events.
//!
//! # Overview
//!
//! TAP is a single-tenant service that subscribes to an AT Protocol Relay and
//! outputs filtered, verified events. Key features include:
//!
//! - **Verified Events**: MST integrity checks and signature verification
//! - **Automatic Backfill**: Historical events delivered with `live: false`
//! - **Repository Filtering**: Track specific DIDs or collections
//! - **Acknowledgment Protocol**: At-least-once delivery semantics
//!
//! # Quick Start
//!
//! ```ignore
//! use atproto_tap::{connect_to, TapEvent};
//! use tokio_stream::StreamExt;
//!
//! #[tokio::main]
//! async fn main() {
//! let mut stream = connect_to("localhost:2480");
//!
//! while let Some(result) = stream.next().await {
//! match result {
//! Ok(event) => match event.as_ref() {
//! TapEvent::Record { record, .. } => {
//! println!("{} {} {}", record.action, record.collection, record.did);
//! }
//! TapEvent::Identity { identity, .. } => {
//! println!("Identity: {} = {}", identity.did, identity.handle);
//! }
//! },
//! Err(e) => eprintln!("Error: {}", e),
//! }
//! }
//! }
//! ```
//!
//! # Using with `tokio::select!`
//!
//! The stream integrates naturally with Tokio's select macro:
//!
//! ```ignore
//! use atproto_tap::{connect, TapConfig};
//! use tokio_stream::StreamExt;
//! use tokio::signal;
//!
//! #[tokio::main]
//! async fn main() {
//! let config = TapConfig::builder()
//! .hostname("localhost:2480")
//! .admin_password("secret")
//! .build();
//!
//! let mut stream = connect(config);
//!
//! loop {
//! tokio::select! {
//! Some(result) = stream.next() => {
//! // Process event
//! }
//! _ = signal::ctrl_c() => {
//! break;
//! }
//! }
//! }
//! }
//! ```
//!
//! # Management API
//!
//! Use [`TapClient`] to manage tracked repositories:
//!
//! ```ignore
//! use atproto_tap::TapClient;
//!
//! let client = TapClient::new("localhost:2480", Some("password".to_string()));
//!
//! // Add repositories to track
//! client.add_repos(&["did:plc:xyz123"]).await?;
//!
//! // Check service health
//! if client.health().await? {
//! println!("TAP service is healthy");
//! }
//! ```
//!
//! # Memory Efficiency
//!
//! This crate is optimized for high-throughput event processing:
//!
//! - **Arc-wrapped events**: Events are shared via `Arc` for zero-cost sharing
//! - **CompactString**: Small strings use inline storage (no heap allocation)
//! - **`Box<str>`**: Immutable strings without capacity overhead
//! - **RawValue**: Record payloads are lazily parsed on demand
//! - **Pre-allocated buffers**: Ack messages avoid per-message allocations
// Re-export public types
pub use ;
pub use RepoStatus;
pub use ;
pub use ;
pub use TapError;
pub use ;
pub use ;