forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1pub mod consumer;
2pub mod server;
3pub mod storage;
4
5use links::CollectedLink;
6use serde::{Deserialize, Serialize};
7use std::convert::From;
8
9#[derive(Debug, PartialEq)]
10pub enum ActionableEvent {
11 CreateLinks {
12 record_id: RecordId,
13 links: Vec<CollectedLink>,
14 },
15 UpdateLinks {
16 record_id: RecordId,
17 new_links: Vec<CollectedLink>,
18 },
19 DeleteRecord(RecordId),
20 ActivateAccount(Did),
21 DeactivateAccount(Did),
22 DeleteAccount(Did),
23}
24
25#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)]
26pub struct Did(pub String);
27
28impl<T: Into<String>> From<T> for Did {
29 fn from(s: T) -> Self {
30 Self(s.into())
31 }
32}
33
34#[derive(Debug, PartialEq, Serialize, Deserialize)]
35pub struct RecordId {
36 pub did: Did,
37 pub collection: String,
38 pub rkey: String,
39}
40
41impl RecordId {
42 pub fn did(&self) -> Did {
43 self.did.clone()
44 }
45 pub fn collection(&self) -> String {
46 self.collection.clone()
47 }
48 pub fn rkey(&self) -> String {
49 self.rkey.clone()
50 }
51}
52
53/// maybe the worst type in this repo, and there are some bad types
54#[derive(Debug, Serialize, PartialEq)]
55pub struct CountsByCount {
56 pub records: u64,
57 pub distinct_dids: u64,
58}