tangled
alpha
login
or
join now
octet-stream.net
/
tapped
9
fork
atom
Rust wrapper for the ATProto tap utility
9
fork
atom
overview
issues
pulls
pipelines
Use record types from the generated files
Thomas Karpiniec
1 month ago
10c4ea2d
a9300c1b
+7
-7
1 changed file
expand all
collapse all
unified
split
standard-site-sync
src
main.rs
+7
-7
standard-site-sync/src/main.rs
···
48
let config = TapConfig::builder()
49
.database_url("sqlite://./tap-example.db")
50
.bind(":2480")
51
-
.signal_collection("site.standard.document")
52
.collection_filters(vec![
53
-
"site.standard.publication".to_string(),
54
-
"site.standard.document".to_string(),
55
])
56
.disable_acks(false)
57
.inherit_stdio(true)
···
139
140
match event.action {
141
RecordAction::Create | RecordAction::Update => match event.collection.as_str() {
142
-
"site.standard.publication" => {
143
if let Some(json) = event.record_as_str() {
144
match serde_json::from_str::<Publication<'_>>(json) {
145
Ok(publication) => {
···
171
}
172
}
173
}
174
-
"site.standard.document" => {
175
if let Some(json) = event.record_as_str() {
176
match serde_json::from_str::<Document<'_>>(json) {
177
Ok(document) => {
···
202
_ => {}
203
},
204
RecordAction::Delete => match event.collection.as_str() {
205
-
"site.standard.publication" => {
206
cache.publications.remove(&at_uri);
207
}
208
-
"site.standard.document" => {
209
cache.documents.remove(&at_uri);
210
}
211
_ => {}
···
48
let config = TapConfig::builder()
49
.database_url("sqlite://./tap-example.db")
50
.bind(":2480")
51
+
.signal_collection(Document::nsid())
52
.collection_filters(vec![
53
+
Publication::nsid().to_string(),
54
+
Document::nsid().to_string(),
55
])
56
.disable_acks(false)
57
.inherit_stdio(true)
···
139
140
match event.action {
141
RecordAction::Create | RecordAction::Update => match event.collection.as_str() {
142
+
c if c == Publication::nsid() => {
143
if let Some(json) = event.record_as_str() {
144
match serde_json::from_str::<Publication<'_>>(json) {
145
Ok(publication) => {
···
171
}
172
}
173
}
174
+
c if c == Document::nsid() => {
175
if let Some(json) = event.record_as_str() {
176
match serde_json::from_str::<Document<'_>>(json) {
177
Ok(document) => {
···
202
_ => {}
203
},
204
RecordAction::Delete => match event.collection.as_str() {
205
+
c if c == Publication::nsid() => {
206
cache.publications.remove(&at_uri);
207
}
208
+
c if c == Document::nsid() => {
209
cache.documents.remove(&at_uri);
210
}
211
_ => {}