Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

update foyer #12

merged opened by bad-example.com targeting main from slingshot-update-foyer
Labels

None yet.

Participants 1
AT URI
at://did:plc:hdhoaan3xa3jiuq4fg4mefid/sh.tangled.repo.pull/3mdvpsrgzai22
+268 -388
Diff #0
+163 -339
Cargo.lock
··· 24 24 checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" 25 25 dependencies = [ 26 26 "cfg-if", 27 - "getrandom 0.2.15", 28 27 "once_cell", 29 28 "version_check", 30 29 "zerocopy 0.7.35", ··· 123 122 checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" 124 123 125 124 [[package]] 126 - name = "arc-swap" 127 - version = "1.7.1" 128 - source = "registry+https://github.com/rust-lang/crates.io-index" 129 - checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" 130 - 131 - [[package]] 132 125 name = "arrayvec" 133 126 version = "0.7.6" 134 127 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 162 155 "proc-macro2", 163 156 "quote", 164 157 "serde", 165 - "syn 2.0.106", 158 + "syn", 166 159 ] 167 160 168 161 [[package]] ··· 204 197 dependencies = [ 205 198 "proc-macro2", 206 199 "quote", 207 - "syn 2.0.106", 200 + "syn", 208 201 "synstructure", 209 202 ] 210 203 ··· 216 209 dependencies = [ 217 210 "proc-macro2", 218 211 "quote", 219 - "syn 2.0.106", 220 - ] 221 - 222 - [[package]] 223 - name = "async-channel" 224 - version = "2.5.0" 225 - source = "registry+https://github.com/rust-lang/crates.io-index" 226 - checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" 227 - dependencies = [ 228 - "concurrent-queue", 229 - "event-listener-strategy", 230 - "futures-core", 231 - "pin-project-lite", 212 + "syn", 232 213 ] 233 214 234 215 [[package]] ··· 274 255 dependencies = [ 275 256 "proc-macro2", 276 257 "quote", 277 - "syn 2.0.106", 258 + "syn", 278 259 ] 279 260 280 261 [[package]] 281 - name = "async-task" 282 - version = "4.7.1" 283 - source = "registry+https://github.com/rust-lang/crates.io-index" 284 - checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" 285 - 286 - [[package]] 287 262 name = "async-trait" 288 263 version = "0.1.88" 289 264 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 291 266 dependencies = [ 292 267 "proc-macro2", 293 268 "quote", 294 - "syn 2.0.106", 269 + "syn", 295 270 ] 296 271 297 272 [[package]] ··· 496 471 "serde_json", 497 472 "thiserror 1.0.69", 498 473 "trait-variant", 499 - ] 500 - 501 - [[package]] 502 - name = "auto_enums" 503 - version = "0.8.7" 504 - source = "registry+https://github.com/rust-lang/crates.io-index" 505 - checksum = "9c170965892137a3a9aeb000b4524aa3cc022a310e709d848b6e1cdce4ab4781" 506 - dependencies = [ 507 - "derive_utils", 508 - "proc-macro2", 509 - "quote", 510 - "syn 2.0.106", 511 474 ] 512 475 513 476 [[package]] ··· 749 712 "regex", 750 713 "rustc-hash 1.1.0", 751 714 "shlex", 752 - "syn 2.0.106", 715 + "syn", 753 716 "which", 754 717 ] 755 718 ··· 762 725 "bitflags", 763 726 "cexpr", 764 727 "clang-sys", 765 - "itertools 0.13.0", 728 + "itertools 0.12.1", 766 729 "proc-macro2", 767 730 "quote", 768 731 "regex", 769 732 "rustc-hash 1.1.0", 770 733 "shlex", 771 - "syn 2.0.106", 734 + "syn", 772 735 ] 773 736 774 737 [[package]] ··· 780 743 "bitflags", 781 744 "cexpr", 782 745 "clang-sys", 783 - "itertools 0.13.0", 746 + "itertools 0.12.1", 784 747 "proc-macro2", 785 748 "quote", 786 749 "regex", 787 750 "rustc-hash 2.1.1", 788 751 "shlex", 789 - "syn 2.0.106", 752 + "syn", 790 753 ] 791 754 792 755 [[package]] ··· 1009 972 "anstream", 1010 973 "anstyle", 1011 974 "clap_lex", 1012 - "strsim 0.11.1", 975 + "strsim", 1013 976 ] 1014 977 1015 978 [[package]] ··· 1021 984 "heck", 1022 985 "proc-macro2", 1023 986 "quote", 1024 - "syn 2.0.106", 987 + "syn", 1025 988 ] 1026 989 1027 990 [[package]] ··· 1173 1136 ] 1174 1137 1175 1138 [[package]] 1139 + name = "core_affinity" 1140 + version = "0.8.3" 1141 + source = "registry+https://github.com/rust-lang/crates.io-index" 1142 + checksum = "a034b3a7b624016c6e13f5df875747cc25f884156aad2abd12b6c46797971342" 1143 + dependencies = [ 1144 + "libc", 1145 + "num_cpus", 1146 + "winapi", 1147 + ] 1148 + 1149 + [[package]] 1176 1150 name = "cpufeatures" 1177 1151 version = "0.2.17" 1178 1152 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1270 1244 1271 1245 [[package]] 1272 1246 name = "darling" 1273 - version = "0.14.4" 1274 - source = "registry+https://github.com/rust-lang/crates.io-index" 1275 - checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" 1276 - dependencies = [ 1277 - "darling_core 0.14.4", 1278 - "darling_macro 0.14.4", 1279 - ] 1280 - 1281 - [[package]] 1282 - name = "darling" 1283 1247 version = "0.20.11" 1284 1248 source = "registry+https://github.com/rust-lang/crates.io-index" 1285 1249 checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 1286 1250 dependencies = [ 1287 - "darling_core 0.20.11", 1288 - "darling_macro 0.20.11", 1289 - ] 1290 - 1291 - [[package]] 1292 - name = "darling_core" 1293 - version = "0.14.4" 1294 - source = "registry+https://github.com/rust-lang/crates.io-index" 1295 - checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" 1296 - dependencies = [ 1297 - "fnv", 1298 - "ident_case", 1299 - "proc-macro2", 1300 - "quote", 1301 - "strsim 0.10.0", 1302 - "syn 1.0.109", 1251 + "darling_core", 1252 + "darling_macro", 1303 1253 ] 1304 1254 1305 1255 [[package]] ··· 1312 1262 "ident_case", 1313 1263 "proc-macro2", 1314 1264 "quote", 1315 - "strsim 0.11.1", 1316 - "syn 2.0.106", 1317 - ] 1318 - 1319 - [[package]] 1320 - name = "darling_macro" 1321 - version = "0.14.4" 1322 - source = "registry+https://github.com/rust-lang/crates.io-index" 1323 - checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" 1324 - dependencies = [ 1325 - "darling_core 0.14.4", 1326 - "quote", 1327 - "syn 1.0.109", 1265 + "strsim", 1266 + "syn", 1328 1267 ] 1329 1268 1330 1269 [[package]] ··· 1333 1272 source = "registry+https://github.com/rust-lang/crates.io-index" 1334 1273 checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 1335 1274 dependencies = [ 1336 - "darling_core 0.20.11", 1275 + "darling_core", 1337 1276 "quote", 1338 - "syn 2.0.106", 1277 + "syn", 1339 1278 ] 1340 1279 1341 1280 [[package]] ··· 1375 1314 checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f" 1376 1315 dependencies = [ 1377 1316 "data-encoding", 1378 - "syn 2.0.106", 1317 + "syn", 1379 1318 ] 1380 1319 1381 1320 [[package]] ··· 1434 1373 source = "registry+https://github.com/rust-lang/crates.io-index" 1435 1374 checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" 1436 1375 dependencies = [ 1437 - "darling 0.20.11", 1376 + "darling", 1438 1377 "proc-macro2", 1439 1378 "quote", 1440 - "syn 2.0.106", 1379 + "syn", 1441 1380 ] 1442 1381 1443 1382 [[package]] ··· 1447 1386 checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" 1448 1387 dependencies = [ 1449 1388 "derive_builder_core", 1450 - "syn 2.0.106", 1389 + "syn", 1451 1390 ] 1452 1391 1453 1392 [[package]] ··· 1467 1406 dependencies = [ 1468 1407 "proc-macro2", 1469 1408 "quote", 1470 - "syn 2.0.106", 1409 + "syn", 1471 1410 "unicode-xid", 1472 - ] 1473 - 1474 - [[package]] 1475 - name = "derive_utils" 1476 - version = "0.15.0" 1477 - source = "registry+https://github.com/rust-lang/crates.io-index" 1478 - checksum = "ccfae181bab5ab6c5478b2ccb69e4c68a02f8c3ec72f6616bfec9dbc599d2ee0" 1479 - dependencies = [ 1480 - "proc-macro2", 1481 - "quote", 1482 - "syn 2.0.106", 1483 1411 ] 1484 1412 1485 1413 [[package]] ··· 1523 1451 dependencies = [ 1524 1452 "proc-macro2", 1525 1453 "quote", 1526 - "syn 2.0.106", 1454 + "syn", 1527 1455 ] 1528 1456 1529 1457 [[package]] ··· 1533 1461 checksum = "c0d05e1c0dbad51b52c38bda7adceef61b9efc2baf04acfe8726a8c4630a6f57" 1534 1462 1535 1463 [[package]] 1536 - name = "downcast-rs" 1537 - version = "1.2.1" 1538 - source = "registry+https://github.com/rust-lang/crates.io-index" 1539 - checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" 1540 - 1541 - [[package]] 1542 1464 name = "dropshot" 1543 1465 version = "0.16.3" 1544 1466 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1582 1504 "thiserror 2.0.16", 1583 1505 "tokio", 1584 1506 "tokio-rustls 0.25.0", 1585 - "toml 0.9.7", 1507 + "toml", 1586 1508 "uuid", 1587 1509 "version_check", 1588 1510 "waitgroup", ··· 1600 1522 "semver", 1601 1523 "serde", 1602 1524 "serde_tokenstream", 1603 - "syn 2.0.106", 1525 + "syn", 1604 1526 ] 1605 1527 1606 1528 [[package]] ··· 1673 1595 "heck", 1674 1596 "proc-macro2", 1675 1597 "quote", 1676 - "syn 2.0.106", 1598 + "syn", 1677 1599 ] 1678 1600 1679 1601 [[package]] ··· 1685 1607 "once_cell", 1686 1608 "proc-macro2", 1687 1609 "quote", 1688 - "syn 2.0.106", 1610 + "syn", 1689 1611 ] 1690 1612 1691 1613 [[package]] ··· 1761 1683 checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" 1762 1684 1763 1685 [[package]] 1686 + name = "fastant" 1687 + version = "0.1.11" 1688 + source = "registry+https://github.com/rust-lang/crates.io-index" 1689 + checksum = "2e825441bfb2d831c47c97d05821552db8832479f44c571b97fededbf0099c07" 1690 + dependencies = [ 1691 + "small_ctor", 1692 + "web-time", 1693 + ] 1694 + 1695 + [[package]] 1764 1696 name = "fastrand" 1765 1697 version = "2.3.0" 1766 1698 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1835 1767 source = "registry+https://github.com/rust-lang/crates.io-index" 1836 1768 checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" 1837 1769 dependencies = [ 1838 - "futures-core", 1839 - "futures-sink", 1840 - "nanorand", 1841 1770 "spin", 1842 1771 ] 1843 1772 ··· 1854 1783 checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" 1855 1784 1856 1785 [[package]] 1786 + name = "foldhash" 1787 + version = "0.2.0" 1788 + source = "registry+https://github.com/rust-lang/crates.io-index" 1789 + checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" 1790 + 1791 + [[package]] 1857 1792 name = "foreign-types" 1858 1793 version = "0.3.2" 1859 1794 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1879 1814 1880 1815 [[package]] 1881 1816 name = "foyer" 1882 - version = "0.18.0" 1817 + version = "0.22.3" 1883 1818 source = "registry+https://github.com/rust-lang/crates.io-index" 1884 - checksum = "0b4d8e96374206ff1b4265f2e2e6e1f80bc3048957b2a1e7fdeef929d68f318f" 1819 + checksum = "3b0abc0b87814989efa711f9becd9f26969820e2d3905db27d10969c4bd45890" 1885 1820 dependencies = [ 1821 + "anyhow", 1886 1822 "equivalent", 1887 1823 "foyer-common", 1888 1824 "foyer-memory", 1889 1825 "foyer-storage", 1890 - "madsim-tokio", 1826 + "foyer-tokio", 1827 + "futures-util", 1828 + "mea", 1891 1829 "mixtrics", 1892 1830 "pin-project", 1893 1831 "serde", 1894 - "thiserror 2.0.16", 1895 - "tokio", 1896 1832 "tracing", 1897 1833 ] 1898 1834 1899 1835 [[package]] 1900 1836 name = "foyer-common" 1901 - version = "0.18.0" 1837 + version = "0.22.3" 1902 1838 source = "registry+https://github.com/rust-lang/crates.io-index" 1903 - checksum = "911b8e3f23d5fe55b0b240f75af1d2fa5cb7261d3f9b38ef1c57bbc9f0449317" 1839 + checksum = "a3db80d5dece93adb7ad709c84578794724a9cba342a7e566c3551c7ec626789" 1904 1840 dependencies = [ 1841 + "anyhow", 1905 1842 "bincode 1.3.3", 1906 1843 "bytes", 1907 1844 "cfg-if", 1908 - "itertools 0.14.0", 1909 - "madsim-tokio", 1845 + "foyer-tokio", 1910 1846 "mixtrics", 1911 1847 "parking_lot", 1912 1848 "pin-project", 1913 1849 "serde", 1914 - "thiserror 2.0.16", 1915 - "tokio", 1916 1850 "twox-hash", 1917 1851 ] 1918 1852 ··· 1927 1861 1928 1862 [[package]] 1929 1863 name = "foyer-memory" 1930 - version = "0.18.0" 1864 + version = "0.22.3" 1931 1865 source = "registry+https://github.com/rust-lang/crates.io-index" 1932 - checksum = "506883d5a8500dea1b1662f7180f3534bdcbfa718d3253db7179552ef83612fa" 1866 + checksum = "db907f40a527ca2aa2f40a5f68b32ea58aa70f050cd233518e9ffd402cfba6ce" 1933 1867 dependencies = [ 1934 - "arc-swap", 1868 + "anyhow", 1935 1869 "bitflags", 1936 1870 "cmsketch", 1937 1871 "equivalent", 1938 1872 "foyer-common", 1939 1873 "foyer-intrusive-collections", 1940 - "hashbrown 0.15.2", 1874 + "foyer-tokio", 1875 + "futures-util", 1876 + "hashbrown 0.16.1", 1941 1877 "itertools 0.14.0", 1942 - "madsim-tokio", 1878 + "mea", 1943 1879 "mixtrics", 1944 1880 "parking_lot", 1881 + "paste", 1945 1882 "pin-project", 1946 1883 "serde", 1947 - "thiserror 2.0.16", 1948 - "tokio", 1949 1884 "tracing", 1950 1885 ] 1951 1886 1952 1887 [[package]] 1953 1888 name = "foyer-storage" 1954 - version = "0.18.0" 1889 + version = "0.22.3" 1955 1890 source = "registry+https://github.com/rust-lang/crates.io-index" 1956 - checksum = "1ba8403a54a2f2032fb647e49c442e5feeb33f3989f7024f1b178341a016f06d" 1891 + checksum = "1983f1db3d0710e9c9d5fc116d9202dccd41a2d1e032572224f1aff5520aa958" 1957 1892 dependencies = [ 1958 1893 "allocator-api2", 1959 1894 "anyhow", 1960 - "auto_enums", 1961 1895 "bytes", 1896 + "core_affinity", 1962 1897 "equivalent", 1963 - "flume", 1898 + "fastant", 1964 1899 "foyer-common", 1965 1900 "foyer-memory", 1901 + "foyer-tokio", 1966 1902 "fs4 0.13.1", 1967 1903 "futures-core", 1968 1904 "futures-util", 1905 + "hashbrown 0.16.1", 1906 + "io-uring", 1969 1907 "itertools 0.14.0", 1970 1908 "libc", 1971 1909 "lz4", 1972 - "madsim-tokio", 1973 - "ordered_hash_map", 1910 + "mea", 1974 1911 "parking_lot", 1975 - "paste", 1976 1912 "pin-project", 1977 1913 "rand 0.9.1", 1978 1914 "serde", 1979 - "thiserror 2.0.16", 1980 - "tokio", 1981 1915 "tracing", 1982 1916 "twox-hash", 1983 1917 "zstd", 1918 + ] 1919 + 1920 + [[package]] 1921 + name = "foyer-tokio" 1922 + version = "0.22.3" 1923 + source = "registry+https://github.com/rust-lang/crates.io-index" 1924 + checksum = "f6577b05a7ffad0db555aedf00bfe52af818220fc4c1c3a7a12520896fc38627" 1925 + dependencies = [ 1926 + "tokio", 1984 1927 ] 1985 1928 1986 1929 [[package]] ··· 2065 2008 dependencies = [ 2066 2009 "proc-macro2", 2067 2010 "quote", 2068 - "syn 2.0.106", 2011 + "syn", 2069 2012 ] 2070 2013 2071 2014 [[package]] ··· 2232 2175 2233 2176 [[package]] 2234 2177 name = "hashbrown" 2235 - version = "0.13.2" 2236 - source = "registry+https://github.com/rust-lang/crates.io-index" 2237 - checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" 2238 - dependencies = [ 2239 - "ahash", 2240 - ] 2241 - 2242 - [[package]] 2243 - name = "hashbrown" 2244 2178 version = "0.14.5" 2245 2179 source = "registry+https://github.com/rust-lang/crates.io-index" 2246 2180 checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" ··· 2253 2187 dependencies = [ 2254 2188 "allocator-api2", 2255 2189 "equivalent", 2256 - "foldhash", 2190 + "foldhash 0.1.5", 2191 + ] 2192 + 2193 + [[package]] 2194 + name = "hashbrown" 2195 + version = "0.16.1" 2196 + source = "registry+https://github.com/rust-lang/crates.io-index" 2197 + checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" 2198 + dependencies = [ 2199 + "allocator-api2", 2200 + "equivalent", 2201 + "foldhash 0.2.0", 2257 2202 ] 2258 2203 2259 2204 [[package]] ··· 2687 2632 dependencies = [ 2688 2633 "proc-macro2", 2689 2634 "quote", 2690 - "syn 2.0.106", 2635 + "syn", 2691 2636 ] 2692 2637 2693 2638 [[package]] ··· 2827 2772 2828 2773 [[package]] 2829 2774 name = "itertools" 2830 - version = "0.13.0" 2831 - source = "registry+https://github.com/rust-lang/crates.io-index" 2832 - checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" 2833 - dependencies = [ 2834 - "either", 2835 - ] 2836 - 2837 - [[package]] 2838 - name = "itertools" 2839 2775 version = "0.14.0" 2840 2776 source = "registry+https://github.com/rust-lang/crates.io-index" 2841 2777 checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" ··· 2891 2827 dependencies = [ 2892 2828 "proc-macro2", 2893 2829 "quote", 2894 - "syn 2.0.106", 2830 + "syn", 2895 2831 ] 2896 2832 2897 2833 [[package]] ··· 3243 3179 ] 3244 3180 3245 3181 [[package]] 3246 - name = "madsim" 3247 - version = "0.2.32" 3248 - source = "registry+https://github.com/rust-lang/crates.io-index" 3249 - checksum = "db6694555643da293dfb89e33c2880a13b62711d64b6588bc7df6ce4110b27f1" 3250 - dependencies = [ 3251 - "ahash", 3252 - "async-channel", 3253 - "async-stream", 3254 - "async-task", 3255 - "bincode 1.3.3", 3256 - "bytes", 3257 - "downcast-rs", 3258 - "futures-util", 3259 - "lazy_static", 3260 - "libc", 3261 - "madsim-macros", 3262 - "naive-timer", 3263 - "panic-message", 3264 - "rand 0.8.5", 3265 - "rand_xoshiro 0.6.0", 3266 - "rustversion", 3267 - "serde", 3268 - "spin", 3269 - "tokio", 3270 - "tokio-util", 3271 - "toml 0.8.23", 3272 - "tracing", 3273 - "tracing-subscriber", 3274 - ] 3275 - 3276 - [[package]] 3277 - name = "madsim-macros" 3278 - version = "0.2.12" 3279 - source = "registry+https://github.com/rust-lang/crates.io-index" 3280 - checksum = "f3d248e97b1a48826a12c3828d921e8548e714394bf17274dd0a93910dc946e1" 3281 - dependencies = [ 3282 - "darling 0.14.4", 3283 - "proc-macro2", 3284 - "quote", 3285 - "syn 1.0.109", 3286 - ] 3287 - 3288 - [[package]] 3289 - name = "madsim-tokio" 3290 - version = "0.2.30" 3291 - source = "registry+https://github.com/rust-lang/crates.io-index" 3292 - checksum = "7d3eb2acc57c82d21d699119b859e2df70a91dbdb84734885a1e72be83bdecb5" 3293 - dependencies = [ 3294 - "madsim", 3295 - "spin", 3296 - "tokio", 3297 - ] 3298 - 3299 - [[package]] 3300 3182 name = "match_cfg" 3301 3183 version = "0.1.0" 3302 3184 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3316 3198 version = "0.8.4" 3317 3199 source = "registry+https://github.com/rust-lang/crates.io-index" 3318 3200 checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" 3201 + 3202 + [[package]] 3203 + name = "mea" 3204 + version = "0.6.3" 3205 + source = "registry+https://github.com/rust-lang/crates.io-index" 3206 + checksum = "6747f54621d156e1b47eb6b25f39a941b9fc347f98f67d25d8881ff99e8ed832" 3207 + dependencies = [ 3208 + "slab", 3209 + ] 3319 3210 3320 3211 [[package]] 3321 3212 name = "mediatype" ··· 3552 3443 ] 3553 3444 3554 3445 [[package]] 3555 - name = "naive-timer" 3556 - version = "0.2.0" 3557 - source = "registry+https://github.com/rust-lang/crates.io-index" 3558 - checksum = "034a0ad7deebf0c2abcf2435950a6666c3c15ea9d8fad0c0f48efa8a7f843fed" 3559 - 3560 - [[package]] 3561 - name = "nanorand" 3562 - version = "0.7.0" 3563 - source = "registry+https://github.com/rust-lang/crates.io-index" 3564 - checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" 3565 - dependencies = [ 3566 - "getrandom 0.2.15", 3567 - ] 3568 - 3569 - [[package]] 3570 3446 name = "native-tls" 3571 3447 version = "0.2.14" 3572 3448 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3699 3575 dependencies = [ 3700 3576 "autocfg", 3701 3577 "libm", 3578 + ] 3579 + 3580 + [[package]] 3581 + name = "num_cpus" 3582 + version = "1.17.0" 3583 + source = "registry+https://github.com/rust-lang/crates.io-index" 3584 + checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" 3585 + dependencies = [ 3586 + "hermit-abi", 3587 + "libc", 3702 3588 ] 3703 3589 3704 3590 [[package]] ··· 3772 3658 dependencies = [ 3773 3659 "proc-macro2", 3774 3660 "quote", 3775 - "syn 2.0.106", 3661 + "syn", 3776 3662 ] 3777 3663 3778 3664 [[package]] ··· 3804 3690 ] 3805 3691 3806 3692 [[package]] 3807 - name = "ordered_hash_map" 3808 - version = "0.4.0" 3809 - source = "registry+https://github.com/rust-lang/crates.io-index" 3810 - checksum = "ab0e5f22bf6dd04abd854a8874247813a8fa2c8c1260eba6fbb150270ce7c176" 3811 - dependencies = [ 3812 - "hashbrown 0.13.2", 3813 - ] 3814 - 3815 - [[package]] 3816 3693 name = "p256" 3817 3694 version = "0.13.2" 3818 3695 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3835 3712 ] 3836 3713 3837 3714 [[package]] 3838 - name = "panic-message" 3839 - version = "0.3.0" 3840 - source = "registry+https://github.com/rust-lang/crates.io-index" 3841 - checksum = "384e52fd8fbd4cbe3c317e8216260c21a0f9134de108cea8a4dd4e7e152c472d" 3842 - 3843 - [[package]] 3844 3715 name = "parking" 3845 3716 version = "2.2.1" 3846 3717 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3949 3820 "pest_meta", 3950 3821 "proc-macro2", 3951 3822 "quote", 3952 - "syn 2.0.106", 3823 + "syn", 3953 3824 ] 3954 3825 3955 3826 [[package]] ··· 3979 3850 dependencies = [ 3980 3851 "proc-macro2", 3981 3852 "quote", 3982 - "syn 2.0.106", 3853 + "syn", 3983 3854 ] 3984 3855 3985 3856 [[package]] ··· 4097 3968 "proc-macro-crate", 4098 3969 "proc-macro2", 4099 3970 "quote", 4100 - "syn 2.0.106", 3971 + "syn", 4101 3972 ] 4102 3973 4103 3974 [[package]] ··· 4132 4003 source = "registry+https://github.com/rust-lang/crates.io-index" 4133 4004 checksum = "41273b691a3d467a8c44d05506afba9f7b6bd56c9cdf80123de13fe52d7ec587" 4134 4005 dependencies = [ 4135 - "darling 0.20.11", 4006 + "darling", 4136 4007 "http", 4137 4008 "indexmap 2.11.4", 4138 4009 "mime", ··· 4140 4011 "proc-macro2", 4141 4012 "quote", 4142 4013 "regex", 4143 - "syn 2.0.106", 4014 + "syn", 4144 4015 "thiserror 2.0.16", 4145 4016 ] 4146 4017 ··· 4181 4052 checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" 4182 4053 dependencies = [ 4183 4054 "proc-macro2", 4184 - "syn 2.0.106", 4055 + "syn", 4185 4056 ] 4186 4057 4187 4058 [[package]] ··· 4492 4363 dependencies = [ 4493 4364 "proc-macro2", 4494 4365 "quote", 4495 - "syn 2.0.106", 4366 + "syn", 4496 4367 ] 4497 4368 4498 4369 [[package]] ··· 4874 4745 "proc-macro2", 4875 4746 "quote", 4876 4747 "serde_derive_internals", 4877 - "syn 2.0.106", 4748 + "syn", 4878 4749 ] 4879 4750 4880 4751 [[package]] ··· 5007 4878 dependencies = [ 5008 4879 "proc-macro2", 5009 4880 "quote", 5010 - "syn 2.0.106", 4881 + "syn", 5011 4882 ] 5012 4883 5013 4884 [[package]] ··· 5018 4889 dependencies = [ 5019 4890 "proc-macro2", 5020 4891 "quote", 5021 - "syn 2.0.106", 4892 + "syn", 5022 4893 ] 5023 4894 5024 4895 [[package]] ··· 5072 4943 5073 4944 [[package]] 5074 4945 name = "serde_spanned" 5075 - version = "0.6.9" 5076 - source = "registry+https://github.com/rust-lang/crates.io-index" 5077 - checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" 5078 - dependencies = [ 5079 - "serde", 5080 - ] 5081 - 5082 - [[package]] 5083 - name = "serde_spanned" 5084 4946 version = "1.0.2" 5085 4947 source = "registry+https://github.com/rust-lang/crates.io-index" 5086 4948 checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" ··· 5097 4959 "proc-macro2", 5098 4960 "quote", 5099 4961 "serde", 5100 - "syn 2.0.106", 4962 + "syn", 5101 4963 ] 5102 4964 5103 4965 [[package]] ··· 5136 4998 source = "registry+https://github.com/rust-lang/crates.io-index" 5137 4999 checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" 5138 5000 dependencies = [ 5139 - "darling 0.20.11", 5001 + "darling", 5140 5002 "proc-macro2", 5141 5003 "quote", 5142 - "syn 2.0.106", 5004 + "syn", 5143 5005 ] 5144 5006 5145 5007 [[package]] ··· 5231 5093 5232 5094 [[package]] 5233 5095 name = "slab" 5234 - version = "0.4.9" 5096 + version = "0.4.12" 5235 5097 source = "registry+https://github.com/rust-lang/crates.io-index" 5236 - checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 5237 - dependencies = [ 5238 - "autocfg", 5239 - ] 5098 + checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" 5240 5099 5241 5100 [[package]] 5242 5101 name = "slingshot" ··· 5325 5184 ] 5326 5185 5327 5186 [[package]] 5187 + name = "small_ctor" 5188 + version = "0.1.2" 5189 + source = "registry+https://github.com/rust-lang/crates.io-index" 5190 + checksum = "88414a5ca1f85d82cc34471e975f0f74f6aa54c40f062efa42c0080e7f763f81" 5191 + 5192 + [[package]] 5328 5193 name = "smallvec" 5329 5194 version = "1.15.0" 5330 5195 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 5412 5277 5413 5278 [[package]] 5414 5279 name = "strsim" 5415 - version = "0.10.0" 5416 - source = "registry+https://github.com/rust-lang/crates.io-index" 5417 - checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 5418 - 5419 - [[package]] 5420 - name = "strsim" 5421 5280 version = "0.11.1" 5422 5281 source = "registry+https://github.com/rust-lang/crates.io-index" 5423 5282 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" ··· 5430 5289 5431 5290 [[package]] 5432 5291 name = "syn" 5433 - version = "1.0.109" 5434 - source = "registry+https://github.com/rust-lang/crates.io-index" 5435 - checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 5436 - dependencies = [ 5437 - "proc-macro2", 5438 - "quote", 5439 - "unicode-ident", 5440 - ] 5441 - 5442 - [[package]] 5443 - name = "syn" 5444 5292 version = "2.0.106" 5445 5293 source = "registry+https://github.com/rust-lang/crates.io-index" 5446 5294 checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" ··· 5467 5315 dependencies = [ 5468 5316 "proc-macro2", 5469 5317 "quote", 5470 - "syn 2.0.106", 5318 + "syn", 5471 5319 ] 5472 5320 5473 5321 [[package]] ··· 5553 5401 dependencies = [ 5554 5402 "proc-macro2", 5555 5403 "quote", 5556 - "syn 2.0.106", 5404 + "syn", 5557 5405 ] 5558 5406 5559 5407 [[package]] ··· 5564 5412 dependencies = [ 5565 5413 "proc-macro2", 5566 5414 "quote", 5567 - "syn 2.0.106", 5415 + "syn", 5568 5416 ] 5569 5417 5570 5418 [[package]] ··· 5689 5537 dependencies = [ 5690 5538 "proc-macro2", 5691 5539 "quote", 5692 - "syn 2.0.106", 5540 + "syn", 5693 5541 ] 5694 5542 5695 5543 [[package]] ··· 5775 5623 5776 5624 [[package]] 5777 5625 name = "toml" 5778 - version = "0.8.23" 5779 - source = "registry+https://github.com/rust-lang/crates.io-index" 5780 - checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" 5781 - dependencies = [ 5782 - "serde", 5783 - "serde_spanned 0.6.9", 5784 - "toml_datetime 0.6.11", 5785 - "toml_edit", 5786 - ] 5787 - 5788 - [[package]] 5789 - name = "toml" 5790 5626 version = "0.9.7" 5791 5627 source = "registry+https://github.com/rust-lang/crates.io-index" 5792 5628 checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" 5793 5629 dependencies = [ 5794 5630 "indexmap 2.11.4", 5795 5631 "serde_core", 5796 - "serde_spanned 1.0.2", 5632 + "serde_spanned", 5797 5633 "toml_datetime 0.7.2", 5798 5634 "toml_parser", 5799 5635 "toml_writer", ··· 5805 5641 version = "0.6.11" 5806 5642 source = "registry+https://github.com/rust-lang/crates.io-index" 5807 5643 checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" 5808 - dependencies = [ 5809 - "serde", 5810 - ] 5811 5644 5812 5645 [[package]] 5813 5646 name = "toml_datetime" ··· 5825 5658 checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" 5826 5659 dependencies = [ 5827 5660 "indexmap 2.11.4", 5828 - "serde", 5829 - "serde_spanned 0.6.9", 5830 5661 "toml_datetime 0.6.11", 5831 - "toml_write", 5832 5662 "winnow", 5833 5663 ] 5834 5664 ··· 5840 5670 dependencies = [ 5841 5671 "winnow", 5842 5672 ] 5843 - 5844 - [[package]] 5845 - name = "toml_write" 5846 - version = "0.1.2" 5847 - source = "registry+https://github.com/rust-lang/crates.io-index" 5848 - checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" 5849 5673 5850 5674 [[package]] 5851 5675 name = "toml_writer" ··· 5919 5743 dependencies = [ 5920 5744 "proc-macro2", 5921 5745 "quote", 5922 - "syn 2.0.106", 5746 + "syn", 5923 5747 ] 5924 5748 5925 5749 [[package]] ··· 5969 5793 dependencies = [ 5970 5794 "proc-macro2", 5971 5795 "quote", 5972 - "syn 2.0.106", 5796 + "syn", 5973 5797 ] 5974 5798 5975 5799 [[package]] ··· 6291 6115 "log", 6292 6116 "proc-macro2", 6293 6117 "quote", 6294 - "syn 2.0.106", 6118 + "syn", 6295 6119 "wasm-bindgen-shared", 6296 6120 ] 6297 6121 ··· 6326 6150 dependencies = [ 6327 6151 "proc-macro2", 6328 6152 "quote", 6329 - "syn 2.0.106", 6153 + "syn", 6330 6154 "wasm-bindgen-backend", 6331 6155 "wasm-bindgen-shared", 6332 6156 ] ··· 6479 6303 dependencies = [ 6480 6304 "proc-macro2", 6481 6305 "quote", 6482 - "syn 2.0.106", 6306 + "syn", 6483 6307 ] 6484 6308 6485 6309 [[package]] ··· 6490 6314 dependencies = [ 6491 6315 "proc-macro2", 6492 6316 "quote", 6493 - "syn 2.0.106", 6317 + "syn", 6494 6318 ] 6495 6319 6496 6320 [[package]] ··· 6796 6620 dependencies = [ 6797 6621 "proc-macro2", 6798 6622 "quote", 6799 - "syn 2.0.106", 6623 + "syn", 6800 6624 "synstructure", 6801 6625 ] 6802 6626 ··· 6826 6650 dependencies = [ 6827 6651 "proc-macro2", 6828 6652 "quote", 6829 - "syn 2.0.106", 6653 + "syn", 6830 6654 ] 6831 6655 6832 6656 [[package]] ··· 6837 6661 dependencies = [ 6838 6662 "proc-macro2", 6839 6663 "quote", 6840 - "syn 2.0.106", 6664 + "syn", 6841 6665 ] 6842 6666 6843 6667 [[package]] ··· 6857 6681 dependencies = [ 6858 6682 "proc-macro2", 6859 6683 "quote", 6860 - "syn 2.0.106", 6684 + "syn", 6861 6685 "synstructure", 6862 6686 ] 6863 6687 ··· 6879 6703 dependencies = [ 6880 6704 "proc-macro2", 6881 6705 "quote", 6882 - "syn 2.0.106", 6706 + "syn", 6883 6707 ] 6884 6708 6885 6709 [[package]] ··· 6901 6725 dependencies = [ 6902 6726 "proc-macro2", 6903 6727 "quote", 6904 - "syn 2.0.106", 6728 + "syn", 6905 6729 ] 6906 6730 6907 6731 [[package]]
+1 -1
slingshot/Cargo.toml
··· 10 10 atrium-oauth = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } 11 11 clap = { workspace = true } 12 12 ctrlc = "3.4.7" 13 - foyer = { version = "0.18.0", features = ["serde"] } 13 + foyer = { version = "0.22.3", features = ["serde"] } 14 14 hickory-resolver = "0.25.2" 15 15 jetstream = { path = "../jetstream", features = ["metrics"] } 16 16 links = { path = "../links" }
+8
slingshot/readme.md
··· 5 5 ```bash 6 6 RUST_LOG=info,slingshot=trace ulimit -n 4096 && RUST_LOG=info cargo run -- --jetstream us-east-1 --cache-dir ./foyer 7 7 ``` 8 + 9 + the identity cache uses a lot of files so you probably need to bump ulimit 10 + 11 + on macos: 12 + 13 + ```bash 14 + ulimit -n 4096 15 + ```
+18 -8
slingshot/src/firehose_cache.rs
··· 1 1 use crate::CachedRecord; 2 - use foyer::{DirectFsDeviceOptions, Engine, HybridCache, HybridCacheBuilder}; 2 + use foyer::{ 3 + BlockEngineConfig, DeviceBuilder, FsDeviceBuilder, HybridCache, HybridCacheBuilder, 4 + PsyncIoEngineConfig, 5 + }; 3 6 use std::path::Path; 4 7 5 8 pub async fn firehose_cache( ··· 7 10 memory_mb: usize, 8 11 disk_gb: usize, 9 12 ) -> Result<HybridCache<String, CachedRecord>, String> { 13 + let device = FsDeviceBuilder::new(cache_dir) 14 + .with_capacity(disk_gb * 2_usize.pow(30)) 15 + .build() 16 + .map_err(|e| format!("foyer device setup error: {e}"))?; 17 + 18 + let engine = BlockEngineConfig::new(device).with_block_size(16 * 2_usize.pow(20)); // note: this does limit the max cached item size 19 + 10 20 let cache = HybridCacheBuilder::new() 11 21 .with_name("firehose") 12 22 .memory(memory_mb * 2_usize.pow(20)) 13 - .with_weighter(|k: &String, v| k.len() + std::mem::size_of_val(v)) 14 - .storage(Engine::large()) 15 - .with_device_options( 16 - DirectFsDeviceOptions::new(cache_dir) 17 - .with_capacity(disk_gb * 2_usize.pow(30)) 18 - .with_file_size(16 * 2_usize.pow(20)), // note: this does limit the max cached item size (records should be max 1mb cbor, bit bigger json) 19 - ) 23 + .with_weighter(|k: &String, v: &CachedRecord| { 24 + std::mem::size_of_val(k.as_str()) + v.weight() 25 + }) 26 + .storage() 27 + .with_io_engine_config(PsyncIoEngineConfig::default()) 28 + .with_engine_config(engine) 20 29 .build() 21 30 .await 22 31 .map_err(|e| format!("foyer setup error: {e:?}"))?; 32 + 23 33 Ok(cache) 24 34 }
+49 -24
slingshot/src/identity.rs
··· 26 26 handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig, DnsTxtResolver}, 27 27 }; 28 28 use atrium_oauth::DefaultHttpClient; // it's probably not worth bringing all of atrium_oauth for this but 29 - use foyer::{DirectFsDeviceOptions, Engine, HybridCache, HybridCacheBuilder}; 29 + use foyer::{ 30 + BlockEngineConfig, DeviceBuilder, FsDeviceBuilder, HybridCache, HybridCacheBuilder, 31 + PsyncIoEngineConfig, 32 + }; 30 33 use serde::{Deserialize, Serialize}; 31 34 use time::UtcDateTime; 32 35 ··· 40 43 Did(Did), 41 44 } 42 45 46 + impl IdentityKey { 47 + fn weight(&self) -> usize { 48 + let s = match self { 49 + IdentityKey::Handle(h) => h.as_str(), 50 + IdentityKey::Did(d) => d.as_str(), 51 + }; 52 + std::mem::size_of::<Self>() + std::mem::size_of_val(s) 53 + } 54 + } 55 + 43 56 #[derive(Debug, Serialize, Deserialize)] 44 57 struct IdentityVal(UtcDateTime, IdentityData); 45 58 ··· 48 61 NotFound, 49 62 Did(Did), 50 63 Doc(PartialMiniDoc), 64 + } 65 + 66 + impl IdentityVal { 67 + fn weight(&self) -> usize { 68 + let wrapping = std::mem::size_of::<Self>(); 69 + let inner = match &self.1 { 70 + IdentityData::NotFound => 0, 71 + IdentityData::Did(d) => std::mem::size_of_val(d.as_str()), 72 + IdentityData::Doc(d) => { 73 + std::mem::size_of_val(d.unverified_handle.as_str()) 74 + + std::mem::size_of_val(d.pds.as_str()) 75 + + std::mem::size_of_val(d.signing_key.as_str()) 76 + } 77 + }; 78 + wrapping + inner 79 + } 51 80 } 52 81 53 82 /// partial representation of a com.bad-example.identity mini atproto doc ··· 176 205 http_client: http_client.clone(), 177 206 }); 178 207 208 + let device = FsDeviceBuilder::new(cache_dir) 209 + .with_capacity(disk_gb * 2_usize.pow(30)) 210 + .build()?; 211 + let engine = BlockEngineConfig::new(device).with_block_size(2_usize.pow(20)); // note: this does limit the max cached item size 212 + 179 213 let cache = HybridCacheBuilder::new() 180 214 .with_name("identity") 181 215 .memory(memory_mb * 2_usize.pow(20)) 182 - .with_weighter(|k, v| std::mem::size_of_val(k) + std::mem::size_of_val(v)) 183 - .storage(Engine::small()) 184 - .with_device_options( 185 - DirectFsDeviceOptions::new(cache_dir) 186 - .with_capacity(disk_gb * 2_usize.pow(30)) // TODO: configurable (1GB to have something) 187 - .with_file_size(2_usize.pow(20)), // note: this does limit the max cached item size! 188 - ) 216 + .with_weighter(|k: &IdentityKey, v: &IdentityVal| k.weight() + v.weight()) 217 + .storage() 218 + .with_io_engine_config(PsyncIoEngineConfig::default()) 219 + .with_engine_config(engine) 189 220 .build() 190 221 .await?; 191 222 ··· 235 266 let key = IdentityKey::Handle(handle.clone()); 236 267 let entry = self 237 268 .cache 238 - .fetch(key.clone(), { 269 + .get_or_fetch(&key, { 239 270 let handle = handle.clone(); 240 271 let resolver = self.handle_resolver.clone(); 241 272 || async move { ··· 244 275 Err(atrium_identity::Error::NotFound) => { 245 276 Ok(IdentityVal(UtcDateTime::now(), IdentityData::NotFound)) 246 277 } 247 - Err(other) => Err(foyer::Error::Other(Box::new({ 278 + Err(other) => { 248 279 log::debug!("other error resolving handle: {other:?}"); 249 - IdentityError::ResolutionFailed(other) 250 - }))), 280 + Err(IdentityError::ResolutionFailed(other)) 281 + } 251 282 } 252 283 } 253 284 }) ··· 283 314 let key = IdentityKey::Did(did.clone()); 284 315 let entry = self 285 316 .cache 286 - .fetch(key.clone(), { 317 + .get_or_fetch(&key, { 287 318 let did = did.clone(); 288 319 let resolver = self.did_resolver.clone(); 289 320 || async move { ··· 291 322 Ok(did_doc) => { 292 323 // TODO: fix in atrium: should verify id is did 293 324 if did_doc.id != did.to_string() { 294 - return Err(foyer::Error::other(Box::new( 295 - IdentityError::BadDidDoc( 296 - "did doc's id did not match did".to_string(), 297 - ), 298 - ))); 325 + return Err(IdentityError::BadDidDoc( 326 + "did doc's id did not match did".to_string(), 327 + )); 299 328 } 300 - let mini_doc = did_doc.try_into().map_err(|e| { 301 - foyer::Error::Other(Box::new(IdentityError::BadDidDoc(e))) 302 - })?; 329 + let mini_doc = did_doc.try_into().map_err(IdentityError::BadDidDoc)?; 303 330 Ok(IdentityVal(UtcDateTime::now(), IdentityData::Doc(mini_doc))) 304 331 } 305 332 Err(atrium_identity::Error::NotFound) => { 306 333 Ok(IdentityVal(UtcDateTime::now(), IdentityData::NotFound)) 307 334 } 308 - Err(other) => Err(foyer::Error::Other(Box::new( 309 - IdentityError::ResolutionFailed(other), 310 - ))), 335 + Err(other) => Err(IdentityError::ResolutionFailed(other)), 311 336 } 312 337 } 313 338 })
+2 -1
slingshot/src/main.rs
··· 4 4 use slingshot::{ 5 5 Identity, Repo, consume, error::MainTaskError, firehose_cache, healthcheck, serve, 6 6 }; 7 + use std::net::SocketAddr; 7 8 use std::path::PathBuf; 8 9 9 10 use clap::Parser; ··· 30 31 /// cannot be used with acme -- if you need ipv6 see --acme-ipv6 31 32 #[arg(long, env = "SLINGSHOT_BIND")] 32 33 #[clap(default_value = "0.0.0.0:8080")] 33 - bind: std::net::SocketAddr, 34 + bind: SocketAddr, 34 35 /// memory cache size in megabytes for records 35 36 #[arg(long, env = "SLINGSHOT_RECORD_CACHE_MEMORY_MB")] 36 37 #[clap(default_value_t = 64)]
+11
slingshot/src/record.rs
··· 42 42 Deleted, 43 43 } 44 44 45 + impl CachedRecord { 46 + pub(crate) fn weight(&self) -> usize { 47 + let wrapping = std::mem::size_of::<Self>(); 48 + let inner = match self { 49 + CachedRecord::Found(RawRecord { record, .. }) => std::mem::size_of_val(record.as_str()), 50 + _ => 0, 51 + }; 52 + wrapping + inner 53 + } 54 + } 55 + 45 56 //////// upstream record fetching 46 57 47 58 #[derive(Deserialize)]
+16 -15
slingshot/src/server.rs
··· 565 565 566 566 let fr = self 567 567 .cache 568 - .fetch(at_uri.clone(), { 568 + .get_or_fetch(&at_uri, { 569 569 let cid = cid.clone(); 570 570 let repo_api = self.repo.clone(); 571 - || async move { 572 - repo_api 573 - .get_record(&did, &collection, &rkey, &cid) 574 - .await 575 - .map_err(|e| foyer::Error::Other(Box::new(e))) 576 - } 571 + || async move { repo_api.get_record(&did, &collection, &rkey, &cid).await } 577 572 }) 578 573 .await; 579 574 580 575 let entry = match fr { 581 576 Ok(e) => e, 582 - Err(foyer::Error::Other(e)) => { 583 - let record_error = match e.downcast::<RecordError>() { 584 - Ok(e) => e, 585 - Err(e) => { 586 - log::error!("error (foyer other) getting cache entry, {e:?}"); 577 + Err(e) if e.kind() == foyer::ErrorKind::External => { 578 + let record_error = match e.source().map(|s| s.downcast_ref::<RecordError>()) { 579 + Some(Some(e)) => e, 580 + other => { 581 + if other.is_none() { 582 + log::error!("external error without a source. wat? {e}"); 583 + } else { 584 + log::error!("downcast to RecordError failed...? {e}"); 585 + } 587 586 return GetRecordResponse::ServerError(xrpc_error( 588 587 "ServerError", 589 588 "sorry, something went wrong", 590 589 )); 591 590 } 592 591 }; 593 - let RecordError::UpstreamBadRequest(ErrorResponseObject { error, message }) = 594 - *record_error 592 + let RecordError::UpstreamBadRequest(ErrorResponseObject { 593 + ref error, 594 + ref message, 595 + }) = *record_error 595 596 else { 596 597 log::error!("RecordError getting cache entry, {record_error:?}"); 597 598 return GetRecordResponse::ServerError(xrpc_error( ··· 712 713 .server(if let Some(ref h) = acme_domain { 713 714 format!("https://{h}") 714 715 } else { 715 - "http://localhost:3000".to_string() 716 + format!("http://{bind}") // yeah should probably fix this for reverse-proxy scenarios but it's ok for dev for now 716 717 }) 717 718 .url_prefix("/xrpc") 718 719 .contact(

History

1 round 0 comments
sign up or login to add to the discussion
bad-example.com submitted #0
2 commits
expand
update foyer
tweaks for new version of foyer
expand 0 comments
pull request successfully merged