this repo has no description

refactor to make more manageable

vielle.dev e3993064 7864b962

verified
+150 -19
+138
Cargo.lock
··· 79 79 ] 80 80 81 81 [[package]] 82 + name = "anstream" 83 + version = "0.6.21" 84 + source = "registry+https://github.com/rust-lang/crates.io-index" 85 + checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" 86 + dependencies = [ 87 + "anstyle", 88 + "anstyle-parse", 89 + "anstyle-query", 90 + "anstyle-wincon", 91 + "colorchoice", 92 + "is_terminal_polyfill", 93 + "utf8parse", 94 + ] 95 + 96 + [[package]] 97 + name = "anstyle" 98 + version = "1.0.13" 99 + source = "registry+https://github.com/rust-lang/crates.io-index" 100 + checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" 101 + 102 + [[package]] 103 + name = "anstyle-parse" 104 + version = "0.2.7" 105 + source = "registry+https://github.com/rust-lang/crates.io-index" 106 + checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" 107 + dependencies = [ 108 + "utf8parse", 109 + ] 110 + 111 + [[package]] 112 + name = "anstyle-query" 113 + version = "1.1.5" 114 + source = "registry+https://github.com/rust-lang/crates.io-index" 115 + checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" 116 + dependencies = [ 117 + "windows-sys 0.61.2", 118 + ] 119 + 120 + [[package]] 121 + name = "anstyle-wincon" 122 + version = "3.0.11" 123 + source = "registry+https://github.com/rust-lang/crates.io-index" 124 + checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" 125 + dependencies = [ 126 + "anstyle", 127 + "once_cell_polyfill", 128 + "windows-sys 0.61.2", 129 + ] 130 + 131 + [[package]] 82 132 name = "ascii" 83 133 version = "1.1.0" 84 134 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 442 492 ] 443 493 444 494 [[package]] 495 + name = "colorchoice" 496 + version = "1.0.4" 497 + source = "registry+https://github.com/rust-lang/crates.io-index" 498 + checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" 499 + 500 + [[package]] 445 501 name = "combine" 446 502 version = "4.6.7" 447 503 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 828 884 ] 829 885 830 886 [[package]] 887 + name = "env_filter" 888 + version = "0.1.4" 889 + source = "registry+https://github.com/rust-lang/crates.io-index" 890 + checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" 891 + dependencies = [ 892 + "log", 893 + "regex", 894 + ] 895 + 896 + [[package]] 897 + name = "env_logger" 898 + version = "0.11.8" 899 + source = "registry+https://github.com/rust-lang/crates.io-index" 900 + checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" 901 + dependencies = [ 902 + "anstream", 903 + "anstyle", 904 + "env_filter", 905 + "jiff", 906 + "log", 907 + ] 908 + 909 + [[package]] 831 910 name = "equivalent" 832 911 version = "1.0.2" 833 912 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1539 1618 name = "index" 1540 1619 version = "0.1.0" 1541 1620 dependencies = [ 1621 + "env_logger", 1542 1622 "jacquard", 1623 + "log", 1543 1624 "sqlx", 1544 1625 "thiserror 2.0.17", 1545 1626 "tokio", ··· 1624 1705 "memchr", 1625 1706 "serde", 1626 1707 ] 1708 + 1709 + [[package]] 1710 + name = "is_terminal_polyfill" 1711 + version = "1.70.2" 1712 + source = "registry+https://github.com/rust-lang/crates.io-index" 1713 + checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" 1627 1714 1628 1715 [[package]] 1629 1716 name = "itoa" ··· 1818 1905 ] 1819 1906 1820 1907 [[package]] 1908 + name = "jiff" 1909 + version = "0.2.16" 1910 + source = "registry+https://github.com/rust-lang/crates.io-index" 1911 + checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" 1912 + dependencies = [ 1913 + "jiff-static", 1914 + "log", 1915 + "portable-atomic", 1916 + "portable-atomic-util", 1917 + "serde_core", 1918 + ] 1919 + 1920 + [[package]] 1921 + name = "jiff-static" 1922 + version = "0.2.16" 1923 + source = "registry+https://github.com/rust-lang/crates.io-index" 1924 + checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" 1925 + dependencies = [ 1926 + "proc-macro2", 1927 + "quote", 1928 + "syn 2.0.109", 1929 + ] 1930 + 1931 + [[package]] 1821 1932 name = "jni" 1822 1933 version = "0.21.1" 1823 1934 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2303 2414 checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 2304 2415 2305 2416 [[package]] 2417 + name = "once_cell_polyfill" 2418 + version = "1.70.2" 2419 + source = "registry+https://github.com/rust-lang/crates.io-index" 2420 + checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" 2421 + 2422 + [[package]] 2306 2423 name = "ouroboros" 2307 2424 version = "0.18.5" 2308 2425 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2468 2585 version = "0.3.32" 2469 2586 source = "registry+https://github.com/rust-lang/crates.io-index" 2470 2587 checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" 2588 + 2589 + [[package]] 2590 + name = "portable-atomic" 2591 + version = "1.11.1" 2592 + source = "registry+https://github.com/rust-lang/crates.io-index" 2593 + checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" 2594 + 2595 + [[package]] 2596 + name = "portable-atomic-util" 2597 + version = "0.2.4" 2598 + source = "registry+https://github.com/rust-lang/crates.io-index" 2599 + checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" 2600 + dependencies = [ 2601 + "portable-atomic", 2602 + ] 2471 2603 2472 2604 [[package]] 2473 2605 name = "potential_utf" ··· 4036 4168 version = "1.0.4" 4037 4169 source = "registry+https://github.com/rust-lang/crates.io-index" 4038 4170 checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 4171 + 4172 + [[package]] 4173 + name = "utf8parse" 4174 + version = "0.2.2" 4175 + source = "registry+https://github.com/rust-lang/crates.io-index" 4176 + checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 4039 4177 4040 4178 [[package]] 4041 4179 name = "vcpkg"
+2
Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 + env_logger = "0.11.8" 7 8 jacquard = "0.9.0" 9 + log = "0.4.28" 8 10 sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres"] } 9 11 thiserror = "2.0.17" 10 12 tokio = "1.48.0"
+9 -19
src/main.rs
··· 1 + use sqlx::{Pool, Postgres}; 2 + 1 3 mod config; 2 4 mod db; 3 - mod resolver; 5 + mod utils; 4 6 5 - /// backfill works as follows (https://docs.bsky.app/docs/advanced-guides/backfill) 6 - /// 7 - /// 1. resolve did -> pds 8 - /// 2. stream com.atproto.sync.subscribeRepos to a buffer 9 - /// 3. get a car file from com.atproto.sync.getRepo (diff if a rev is stored in database) 10 - /// 4. apply car file diff to database (incl rev) 11 - /// 5. start playing events from buffer 12 - /// a. drop all events from other users 13 - /// b. drop all events with a lower rev than current rev 14 - /// c. apply event & update rev 15 - /// d. (non blocking) get blobs if missing 16 - /// e. (non blocking) parse for strongref and store strongrefs 17 - /// f. (non blocking) trigger garbage collection of blobs and strongref 18 - /// 6. once buffer is empty, parse events live 19 7 #[tokio::main] 20 - async fn main() { 8 + async fn main() -> Result<(), ()> { 9 + env_logger::init(); 21 10 println!("User: {}", *config::USER); 22 - let conn = db::init().await; 11 + let conn: Pool<Postgres> = db::init().await; 23 12 println!("Database connected and initialized"); 24 13 25 - let pds = match resolver::resolve(&config::USER).await { 14 + let pds = match utils::resolver::resolve(&config::USER).await { 26 15 Ok(val) => val, 27 16 Err(err) => panic!("{}", err), 28 17 }; 29 18 30 - println!("PDS: {}", pds); 19 + println!("Completed sucessfully!"); 20 + Ok(()) 31 21 }
src/resolver.rs src/utils/resolver.rs
+1
src/utils/mod.rs
··· 1 + pub mod resolver;