tapped
A Rust wrapper library for the tap ATProto sync utility.
tapped provides an idiomatic async Rust interface for spawning and communicating with a tap subprocess, making it easy to build applications that sync data from the ATProto network.
Features
- Spawn and manage
tapsubprocesses with graceful shutdown - Strongly-typed configuration for all tap envvars
- Strongly-typed async Rust functions covering all of tap's HTTP API endpoints
- WebSocket-based event channel with automatic acknowledgment
Installation
Add to your Cargo.toml:
[]
= "0.1"
You'll also need the tap binary. Build it from the indigo repository:
&&
tapped has been most recently tested against:
tap version v0.0.0-20260114211028-207c9d49d0de-rev-207c9d4
Quick Start
use ;
async
Usage Patterns
Connect to Existing Instance
If you have a tap instance already running:
use TapClient;
let client = new?;
client.health.await?;
Spawn with Custom Binary Path
use ;
let config = builder
.database_url
.build;
let mut process = spawn.await?;
let client = process.client;
// Use the client...
process.shutdown.await?;
Using TapHandle (Recommended)
TapHandle combines process management and client access:
use ;
let config = builder
.database_url
.full_network
.build;
let handle = spawn_default.await?;
// TapHandle derefs to TapClient, so you can call client methods directly
handle.health.await?;
let count = handle.repo_count.await?;
println!;
Configuration Options
use ;
use Duration;
let config = builder
// Database
.database_url
.max_db_conns
// Network
.bind
.relay_url
.plc_url
// Filtering
.signal_collection
.collection_filter
.collection_filter
.full_network
// Performance
.firehose_parallelism
.resync_parallelism
.outbox_parallelism
.outbox_capacity
// Timeouts
.repo_fetch_timeout
.startup_timeout
.shutdown_timeout
// Logging
.log_level
.build;
Working with Events
Events are automatically acknowledged when dropped:
use ;
let mut channel = client.channel.await?;
while let Ok = channel.recv.await
Managing Repositories
// Add repos to track
client.add_repos.await?;
// Remove repos
client.remove_repos.await?;
// Get info about a specific repo
let info = client.repo_info.await?;
println!;
// Resolve a DID to its document
let doc = client.resolve_did.await?;
println!;
Checking Stats
let repos = client.repo_count.await?;
let records = client.record_count.await?;
let outbox = client.outbox_buffer.await?;
let resync = client.resync_buffer.await?;
let cursors = client.cursors.await?;
println!;
println!;
println!;
Error Handling
All operations return tapped::Result<T>, which uses the tapped::Error enum:
use Error;
match client.health.await
Example: Syncing Standard Site Records
See examples/standard_site_sync.rs for a complete example that syncs site.standard.publication and site.standard.document records to local files.
License
MIT