at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol atproto indexer rust fjall

[types] extend RepoStatus and RepoState for better lifecycle tracking

ptr.pet 64df4188 8db23453

verified
+28 -4
+28 -4
src/types.rs
··· 3 3 use serde_json::Value; 4 4 use smol_str::SmolStr; 5 5 6 - // From src/state.rs 6 + // from src/state.rs 7 7 8 8 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 9 9 pub enum RepoStatus { ··· 11 11 Backfilling, 12 12 Synced, 13 13 Error(SmolStr), 14 + Deactivated, 15 + Takendown, 16 + Suspended, 14 17 } 15 18 16 19 #[derive(Debug, Clone, Serialize, Deserialize)] ··· 18 21 pub did: SmolStr, 19 22 pub status: RepoStatus, 20 23 pub rev: SmolStr, 24 + pub data: SmolStr, 21 25 pub last_seq: Option<i64>, 22 - pub last_updated_at: i64, // Unix timestamp 26 + pub last_updated_at: i64, // unix timestamp 27 + pub handle: Option<SmolStr>, 23 28 } 24 29 25 30 impl RepoState { ··· 28 33 did: did.as_str().into(), 29 34 status: RepoStatus::New, 30 35 rev: "".into(), 36 + data: "".into(), 31 37 last_seq: None, 32 38 last_updated_at: chrono::Utc::now().timestamp(), 39 + handle: None, 33 40 } 34 41 } 35 42 } 36 43 37 - // From src/backfill/error_state.rs 44 + // from src/backfill/error_state.rs 38 45 39 46 #[derive(Debug, Clone, Serialize, Deserialize)] 40 47 pub struct ErrorState { ··· 54 61 } 55 62 } 56 63 57 - // From src/api/event.rs 64 + // from src/api/event.rs 65 + 66 + #[derive(Debug, Serialize, Deserialize, Clone)] 67 + pub struct MarshallableEvt { 68 + pub id: u64, 69 + #[serde(rename = "type")] 70 + pub event_type: SmolStr, 71 + #[serde(skip_serializing_if = "Option::is_none")] 72 + pub record: Option<RecordEvt>, 73 + #[serde(skip_serializing_if = "Option::is_none")] 74 + pub identity: Option<IdentityEvt>, 75 + } 76 + 77 + #[derive(Clone, Debug)] 78 + pub enum BroadcastEvent { 79 + Persisted(u64), 80 + Ephemeral(MarshallableEvt), 81 + } 58 82 59 83 #[derive(Debug, Serialize, Deserialize, Clone)] 60 84 pub struct RecordEvt {