diff --git a/uplc/src/db.rs b/uplc/src/db.rs index c7abbc8..ed437f5 100644 --- a/uplc/src/db.rs +++ b/uplc/src/db.rs @@ -18,10 +18,10 @@ impl DB { cid TEXT NOT NULL, seq INT8 NOT NULL, prev TEXT, - op_type TEXT NOT NULL, service TEXT, created_at TIMESTAMPTZ NOT NULL, nullified BOOLEAN NOT NULL DEFAULT false, + tombstone BOOLEAN NOT NULL DEFAULT false, PRIMARY KEY (did, cid) )"#, [], @@ -40,10 +40,10 @@ impl DB { op.cid, op.seq, op.prev, - op.op_type, op.service, op.created_at, op.nullified, + op.tombstone, ])?; } @@ -73,8 +73,8 @@ pub struct OperationLogEntry { pub cid: String, pub seq: i64, pub prev: Option, - pub op_type: String, pub service: Option, pub created_at: String, pub nullified: bool, + pub tombstone: bool, } diff --git a/uplc/src/plc.rs b/uplc/src/plc.rs index 4df22b8..75a1060 100644 --- a/uplc/src/plc.rs +++ b/uplc/src/plc.rs @@ -46,14 +46,14 @@ pub struct ExportedOp { impl From for OperationLogEntry { fn from(value: ExportedOp) -> Self { - let (op_type, service, prev) = match value.operation { - Operations::CreateOpV1(op) => ("create".to_string(), Some(op.service), None), + let (tombstone, service, prev) = match value.operation { + Operations::CreateOpV1(op) => (false, Some(op.service), None), Operations::Operation(op) => ( - "plc_operation".to_string(), + false, op.services.get("atproto_pds").map(|s| s.endpoint.clone()), op.prev, ), - Operations::Tombstone(t) => ("plc_tombstone".to_string(), None, Some(t.prev)), + Operations::Tombstone(t) => (true, None, Some(t.prev)), }; OperationLogEntry { @@ -61,8 +61,8 @@ impl From for OperationLogEntry { cid: value.cid, seq: value.seq, prev, - op_type, service, + tombstone, created_at: value.created_at, nullified: value.nullified, } @@ -80,7 +80,6 @@ pub async fn run_plc_sync(db: DB) -> Result<()> { loop { println!("seen {} this session with seq {}", total, after); - let url = format!("https://plc.directory/export?count=1000&after={}", after); let response = client.get(&url).send().await?;