Select the types of activity you want to include in your feed.
tidy up some indexer logic
- remove sqlx cache bc i aint usin it rn (will add it back l8r for docker build) - document how im going to do backfill/etc - add meta table with a rev column. this is to store repo rev for diffing/etc
···11-{
22- "db_name": "PostgreSQL",
33- "query": "CREATE TABLE IF NOT EXISTS records (\n collection TEXT,\n rkey TEXT,\n record JSON NOT NULL,\n PRIMARY KEY (collection, rkey)\n );",
44- "describe": {
55- "columns": [],
66- "parameters": {
77- "Left": []
88- },
99- "nullable": []
1010- },
1111- "hash": "94ea3e0cdd96672b408e4a445c2c38cb2911efff5432ae454210d23b70ee0ae2"
1212-}
-2
sqlx.sh
···11-docker compose up db -d
22-DATABASE_URL=postgres://user:password@localhost:5432/user cargo sqlx prepare
+15-1
src/db.rs
···5858 panic!();
5959 };
60606161- return conn;
6161+ if let Err(err) = query!(
6262+ "CREATE TABLE IF NOT EXISTS meta (
6363+ did TEXT,
6464+ rev TEXT,
6565+ PRIMARY KEY (did)
6666+ );"
6767+ )
6868+ .execute(&conn)
6969+ .await
7070+ {
7171+ println!("Creating table `meta`: \n{err}");
7272+ panic!();
7373+ };
7474+7575+ conn
6276}
+14
src/main.rs
···22mod db;
33mod resolver;
4455+/// backfill works as follows (https://docs.bsky.app/docs/advanced-guides/backfill)
66+///
77+/// 1. resolve did -> pds
88+/// 2. stream com.atproto.sync.subscribeRepos to a buffer
99+/// 3. get a car file from com.atproto.sync.getRepo (diff if a rev is stored in database)
1010+/// 4. apply car file diff to database (incl rev)
1111+/// 5. start playing events from buffer
1212+/// a. drop all events from other users
1313+/// b. drop all events with a lower rev than current rev
1414+/// c. apply event & update rev
1515+/// d. (non blocking) get blobs if missing
1616+/// e. (non blocking) parse for strongref and store strongrefs
1717+/// f. (non blocking) trigger garbage collection of blobs and strongref
1818+/// 6. once buffer is empty, parse events live
519#[tokio::main]
620async fn main() {
721 println!("User: {}", *config::USER);