Fast and robust atproto CAR file processing in rust
15
fork

Configure Feed

Select the types of activity you want to include in your feed.

it's you, sqlite. it's always been you.

you're not the fastest but you are the most well-behaved.

+39 -932
+2 -547
Cargo.lock
··· 127 127 128 128 [[package]] 129 129 name = "bincode" 130 - version = "1.3.3" 131 - source = "registry+https://github.com/rust-lang/crates.io-index" 132 - checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 133 - dependencies = [ 134 - "serde", 135 - ] 136 - 137 - [[package]] 138 - name = "bincode" 139 130 version = "2.0.1" 140 131 source = "registry+https://github.com/rust-lang/crates.io-index" 141 132 checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" ··· 159 150 version = "2.9.4" 160 151 source = "registry+https://github.com/rust-lang/crates.io-index" 161 152 checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" 162 - dependencies = [ 163 - "serde", 164 - ] 165 153 166 154 [[package]] 167 155 name = "bumpalo" ··· 170 158 checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" 171 159 172 160 [[package]] 173 - name = "byteorder" 174 - version = "1.5.0" 175 - source = "registry+https://github.com/rust-lang/crates.io-index" 176 - checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 177 - 178 - [[package]] 179 161 name = "bytes" 180 162 version = "1.10.1" 181 163 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 194 176 checksum = "b544cf8c89359205f4f990d0e6f3828db42df85b5dac95d09157a250eb0749c4" 195 177 dependencies = [ 196 178 "serde", 197 - ] 198 - 199 - [[package]] 200 - name = "cc" 201 - version = "1.2.44" 202 - source = "registry+https://github.com/rust-lang/crates.io-index" 203 - checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" 204 - dependencies = [ 205 - "find-msvc-tools", 206 - "shlex", 207 179 ] 208 180 209 181 [[package]] ··· 368 340 ] 369 341 370 342 [[package]] 371 - name = "crossbeam-queue" 372 - version = "0.3.12" 373 - source = "registry+https://github.com/rust-lang/crates.io-index" 374 - checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" 375 - dependencies = [ 376 - "crossbeam-utils", 377 - ] 378 - 379 - [[package]] 380 343 name = "crossbeam-utils" 381 344 version = "0.8.21" 382 345 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 415 378 ] 416 379 417 380 [[package]] 418 - name = "displaydoc" 419 - version = "0.2.5" 420 - source = "registry+https://github.com/rust-lang/crates.io-index" 421 - checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" 422 - dependencies = [ 423 - "proc-macro2", 424 - "quote", 425 - "syn 2.0.106", 426 - ] 427 - 428 - [[package]] 429 - name = "doxygen-rs" 430 - version = "0.4.2" 431 - source = "registry+https://github.com/rust-lang/crates.io-index" 432 - checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" 433 - dependencies = [ 434 - "phf", 435 - ] 436 - 437 - [[package]] 438 381 name = "either" 439 382 version = "1.15.0" 440 383 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 492 435 checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 493 436 494 437 [[package]] 495 - name = "find-msvc-tools" 496 - version = "0.1.4" 497 - source = "registry+https://github.com/rust-lang/crates.io-index" 498 - checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" 499 - 500 - [[package]] 501 438 name = "foldhash" 502 439 version = "0.1.5" 503 440 source = "registry+https://github.com/rust-lang/crates.io-index" 504 441 checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" 505 442 506 443 [[package]] 507 - name = "form_urlencoded" 508 - version = "1.2.2" 509 - source = "registry+https://github.com/rust-lang/crates.io-index" 510 - checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" 511 - dependencies = [ 512 - "percent-encoding", 513 - ] 514 - 515 - [[package]] 516 444 name = "futures" 517 445 version = "0.3.31" 518 446 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 603 531 604 532 [[package]] 605 533 name = "getrandom" 606 - version = "0.2.16" 607 - source = "registry+https://github.com/rust-lang/crates.io-index" 608 - checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" 609 - dependencies = [ 610 - "cfg-if", 611 - "libc", 612 - "wasi 0.11.1+wasi-snapshot-preview1", 613 - ] 614 - 615 - [[package]] 616 - name = "getrandom" 617 534 version = "0.3.3" 618 535 source = "registry+https://github.com/rust-lang/crates.io-index" 619 536 checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" ··· 666 583 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 667 584 668 585 [[package]] 669 - name = "heed" 670 - version = "0.22.0" 671 - source = "registry+https://github.com/rust-lang/crates.io-index" 672 - checksum = "6a56c94661ddfb51aa9cdfbf102cfcc340aa69267f95ebccc4af08d7c530d393" 673 - dependencies = [ 674 - "bitflags", 675 - "byteorder", 676 - "heed-traits", 677 - "heed-types", 678 - "libc", 679 - "lmdb-master-sys", 680 - "once_cell", 681 - "page_size", 682 - "serde", 683 - "synchronoise", 684 - "url", 685 - ] 686 - 687 - [[package]] 688 - name = "heed-traits" 689 - version = "0.20.0" 690 - source = "registry+https://github.com/rust-lang/crates.io-index" 691 - checksum = "eb3130048d404c57ce5a1ac61a903696e8fcde7e8c2991e9fcfc1f27c3ef74ff" 692 - 693 - [[package]] 694 - name = "heed-types" 695 - version = "0.21.0" 696 - source = "registry+https://github.com/rust-lang/crates.io-index" 697 - checksum = "13c255bdf46e07fb840d120a36dcc81f385140d7191c76a7391672675c01a55d" 698 - dependencies = [ 699 - "bincode 1.3.3", 700 - "byteorder", 701 - "heed-traits", 702 - "serde", 703 - "serde_json", 704 - ] 705 - 706 - [[package]] 707 - name = "icu_collections" 708 - version = "2.1.1" 709 - source = "registry+https://github.com/rust-lang/crates.io-index" 710 - checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" 711 - dependencies = [ 712 - "displaydoc", 713 - "potential_utf", 714 - "yoke", 715 - "zerofrom", 716 - "zerovec", 717 - ] 718 - 719 - [[package]] 720 - name = "icu_locale_core" 721 - version = "2.1.1" 722 - source = "registry+https://github.com/rust-lang/crates.io-index" 723 - checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" 724 - dependencies = [ 725 - "displaydoc", 726 - "litemap", 727 - "tinystr", 728 - "writeable", 729 - "zerovec", 730 - ] 731 - 732 - [[package]] 733 - name = "icu_normalizer" 734 - version = "2.1.1" 735 - source = "registry+https://github.com/rust-lang/crates.io-index" 736 - checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" 737 - dependencies = [ 738 - "icu_collections", 739 - "icu_normalizer_data", 740 - "icu_properties", 741 - "icu_provider", 742 - "smallvec", 743 - "zerovec", 744 - ] 745 - 746 - [[package]] 747 - name = "icu_normalizer_data" 748 - version = "2.1.1" 749 - source = "registry+https://github.com/rust-lang/crates.io-index" 750 - checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" 751 - 752 - [[package]] 753 - name = "icu_properties" 754 - version = "2.1.1" 755 - source = "registry+https://github.com/rust-lang/crates.io-index" 756 - checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" 757 - dependencies = [ 758 - "icu_collections", 759 - "icu_locale_core", 760 - "icu_properties_data", 761 - "icu_provider", 762 - "zerotrie", 763 - "zerovec", 764 - ] 765 - 766 - [[package]] 767 - name = "icu_properties_data" 768 - version = "2.1.1" 769 - source = "registry+https://github.com/rust-lang/crates.io-index" 770 - checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" 771 - 772 - [[package]] 773 - name = "icu_provider" 774 - version = "2.1.1" 775 - source = "registry+https://github.com/rust-lang/crates.io-index" 776 - checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" 777 - dependencies = [ 778 - "displaydoc", 779 - "icu_locale_core", 780 - "writeable", 781 - "yoke", 782 - "zerofrom", 783 - "zerotrie", 784 - "zerovec", 785 - ] 786 - 787 - [[package]] 788 - name = "idna" 789 - version = "1.1.0" 790 - source = "registry+https://github.com/rust-lang/crates.io-index" 791 - checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" 792 - dependencies = [ 793 - "idna_adapter", 794 - "smallvec", 795 - "utf8_iter", 796 - ] 797 - 798 - [[package]] 799 - name = "idna_adapter" 800 - version = "1.2.1" 801 - source = "registry+https://github.com/rust-lang/crates.io-index" 802 - checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" 803 - dependencies = [ 804 - "icu_normalizer", 805 - "icu_properties", 806 - ] 807 - 808 - [[package]] 809 586 name = "io-uring" 810 587 version = "0.7.10" 811 588 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 921 698 checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" 922 699 923 700 [[package]] 924 - name = "litemap" 925 - version = "0.8.1" 926 - source = "registry+https://github.com/rust-lang/crates.io-index" 927 - checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" 928 - 929 - [[package]] 930 - name = "lmdb-master-sys" 931 - version = "0.2.5" 932 - source = "registry+https://github.com/rust-lang/crates.io-index" 933 - checksum = "864808e0b19fb6dd3b70ba94ee671b82fce17554cf80aeb0a155c65bb08027df" 934 - dependencies = [ 935 - "cc", 936 - "doxygen-rs", 937 - "libc", 938 - ] 939 - 940 - [[package]] 941 701 name = "lock_api" 942 702 version = "0.4.14" 943 703 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1049 809 checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" 1050 810 1051 811 [[package]] 1052 - name = "page_size" 1053 - version = "0.6.0" 1054 - source = "registry+https://github.com/rust-lang/crates.io-index" 1055 - checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" 1056 - dependencies = [ 1057 - "libc", 1058 - "winapi", 1059 - ] 1060 - 1061 - [[package]] 1062 812 name = "parking_lot" 1063 813 version = "0.12.5" 1064 814 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1082 832 ] 1083 833 1084 834 [[package]] 1085 - name = "percent-encoding" 1086 - version = "2.3.2" 1087 - source = "registry+https://github.com/rust-lang/crates.io-index" 1088 - checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" 1089 - 1090 - [[package]] 1091 - name = "phf" 1092 - version = "0.11.3" 1093 - source = "registry+https://github.com/rust-lang/crates.io-index" 1094 - checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" 1095 - dependencies = [ 1096 - "phf_macros", 1097 - "phf_shared", 1098 - ] 1099 - 1100 - [[package]] 1101 - name = "phf_generator" 1102 - version = "0.11.3" 1103 - source = "registry+https://github.com/rust-lang/crates.io-index" 1104 - checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" 1105 - dependencies = [ 1106 - "phf_shared", 1107 - "rand", 1108 - ] 1109 - 1110 - [[package]] 1111 - name = "phf_macros" 1112 - version = "0.11.3" 1113 - source = "registry+https://github.com/rust-lang/crates.io-index" 1114 - checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" 1115 - dependencies = [ 1116 - "phf_generator", 1117 - "phf_shared", 1118 - "proc-macro2", 1119 - "quote", 1120 - "syn 2.0.106", 1121 - ] 1122 - 1123 - [[package]] 1124 - name = "phf_shared" 1125 - version = "0.11.3" 1126 - source = "registry+https://github.com/rust-lang/crates.io-index" 1127 - checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" 1128 - dependencies = [ 1129 - "siphasher", 1130 - ] 1131 - 1132 - [[package]] 1133 835 name = "pin-project-lite" 1134 836 version = "0.2.16" 1135 837 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1191 893 ] 1192 894 1193 895 [[package]] 1194 - name = "potential_utf" 1195 - version = "0.1.4" 1196 - source = "registry+https://github.com/rust-lang/crates.io-index" 1197 - checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" 1198 - dependencies = [ 1199 - "zerovec", 1200 - ] 1201 - 1202 - [[package]] 1203 - name = "ppv-lite86" 1204 - version = "0.2.21" 1205 - source = "registry+https://github.com/rust-lang/crates.io-index" 1206 - checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" 1207 - dependencies = [ 1208 - "zerocopy", 1209 - ] 1210 - 1211 - [[package]] 1212 896 name = "proc-macro2" 1213 897 version = "1.0.101" 1214 898 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1233 917 checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" 1234 918 1235 919 [[package]] 1236 - name = "rand" 1237 - version = "0.8.5" 1238 - source = "registry+https://github.com/rust-lang/crates.io-index" 1239 - checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1240 - dependencies = [ 1241 - "libc", 1242 - "rand_chacha", 1243 - "rand_core", 1244 - ] 1245 - 1246 - [[package]] 1247 - name = "rand_chacha" 1248 - version = "0.3.1" 1249 - source = "registry+https://github.com/rust-lang/crates.io-index" 1250 - checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1251 - dependencies = [ 1252 - "ppv-lite86", 1253 - "rand_core", 1254 - ] 1255 - 1256 - [[package]] 1257 - name = "rand_core" 1258 - version = "0.6.4" 1259 - source = "registry+https://github.com/rust-lang/crates.io-index" 1260 - checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1261 - dependencies = [ 1262 - "getrandom 0.2.16", 1263 - ] 1264 - 1265 - [[package]] 1266 920 name = "rayon" 1267 921 version = "1.11.0" 1268 922 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1283 937 ] 1284 938 1285 939 [[package]] 1286 - name = "redb" 1287 - version = "3.1.0" 1288 - source = "registry+https://github.com/rust-lang/crates.io-index" 1289 - checksum = "ae323eb086579a3769daa2c753bb96deb95993c534711e0dbe881b5192906a06" 1290 - dependencies = [ 1291 - "libc", 1292 - ] 1293 - 1294 - [[package]] 1295 940 name = "redox_syscall" 1296 941 version = "0.5.18" 1297 942 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1333 978 name = "repo-stream" 1334 979 version = "0.1.1" 1335 980 dependencies = [ 1336 - "bincode 2.0.1", 981 + "bincode", 1337 982 "clap", 1338 983 "criterion", 1339 984 "env_logger", 1340 985 "futures", 1341 986 "futures-core", 1342 - "heed", 1343 987 "ipld-core", 1344 988 "iroh-car", 1345 989 "log", 1346 990 "multibase", 1347 - "redb", 1348 991 "rusqlite", 1349 - "rustcask", 1350 992 "serde", 1351 993 "serde_bytes", 1352 994 "serde_ipld_dagcbor", ··· 1376 1018 checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" 1377 1019 1378 1020 [[package]] 1379 - name = "rustcask" 1380 - version = "0.1.0" 1381 - source = "registry+https://github.com/rust-lang/crates.io-index" 1382 - checksum = "e17ed1a2733a60fea8495ddcb42c22cabd17afec7ffa7b024b161dd662da4003" 1383 - dependencies = [ 1384 - "bincode 1.3.3", 1385 - "bytes", 1386 - "clap", 1387 - "log", 1388 - "rand", 1389 - "regex", 1390 - "serde", 1391 - "tokio", 1392 - ] 1393 - 1394 - [[package]] 1395 1021 name = "rustix" 1396 1022 version = "1.1.2" 1397 1023 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1497 1123 ] 1498 1124 1499 1125 [[package]] 1500 - name = "shlex" 1501 - version = "1.3.0" 1502 - source = "registry+https://github.com/rust-lang/crates.io-index" 1503 - checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1504 - 1505 - [[package]] 1506 1126 name = "signal-hook-registry" 1507 1127 version = "1.4.6" 1508 1128 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1512 1132 ] 1513 1133 1514 1134 [[package]] 1515 - name = "siphasher" 1516 - version = "1.0.1" 1517 - source = "registry+https://github.com/rust-lang/crates.io-index" 1518 - checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" 1519 - 1520 - [[package]] 1521 1135 name = "slab" 1522 1136 version = "0.4.11" 1523 1137 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1538 1152 "libc", 1539 1153 "windows-sys 0.59.0", 1540 1154 ] 1541 - 1542 - [[package]] 1543 - name = "stable_deref_trait" 1544 - version = "1.2.1" 1545 - source = "registry+https://github.com/rust-lang/crates.io-index" 1546 - checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" 1547 1155 1548 1156 [[package]] 1549 1157 name = "strsim" ··· 1574 1182 ] 1575 1183 1576 1184 [[package]] 1577 - name = "synchronoise" 1578 - version = "1.0.1" 1579 - source = "registry+https://github.com/rust-lang/crates.io-index" 1580 - checksum = "3dbc01390fc626ce8d1cffe3376ded2b72a11bb70e1c75f404a210e4daa4def2" 1581 - dependencies = [ 1582 - "crossbeam-queue", 1583 - ] 1584 - 1585 - [[package]] 1586 - name = "synstructure" 1587 - version = "0.13.2" 1588 - source = "registry+https://github.com/rust-lang/crates.io-index" 1589 - checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" 1590 - dependencies = [ 1591 - "proc-macro2", 1592 - "quote", 1593 - "syn 2.0.106", 1594 - ] 1595 - 1596 - [[package]] 1597 1185 name = "tempfile" 1598 1186 version = "3.23.0" 1599 1187 source = "registry+https://github.com/rust-lang/crates.io-index" 1600 1188 checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" 1601 1189 dependencies = [ 1602 1190 "fastrand", 1603 - "getrandom 0.3.3", 1191 + "getrandom", 1604 1192 "once_cell", 1605 1193 "rustix", 1606 1194 "windows-sys 0.60.2", ··· 1644 1232 "proc-macro2", 1645 1233 "quote", 1646 1234 "syn 2.0.106", 1647 - ] 1648 - 1649 - [[package]] 1650 - name = "tinystr" 1651 - version = "0.8.2" 1652 - source = "registry+https://github.com/rust-lang/crates.io-index" 1653 - checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" 1654 - dependencies = [ 1655 - "displaydoc", 1656 - "zerovec", 1657 1235 ] 1658 1236 1659 1237 [[package]] ··· 1722 1300 checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" 1723 1301 1724 1302 [[package]] 1725 - name = "url" 1726 - version = "2.5.7" 1727 - source = "registry+https://github.com/rust-lang/crates.io-index" 1728 - checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" 1729 - dependencies = [ 1730 - "form_urlencoded", 1731 - "idna", 1732 - "percent-encoding", 1733 - "serde", 1734 - ] 1735 - 1736 - [[package]] 1737 - name = "utf8_iter" 1738 - version = "1.0.4" 1739 - source = "registry+https://github.com/rust-lang/crates.io-index" 1740 - checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 1741 - 1742 - [[package]] 1743 1303 name = "utf8parse" 1744 1304 version = "0.2.2" 1745 1305 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1861 1421 ] 1862 1422 1863 1423 [[package]] 1864 - name = "winapi" 1865 - version = "0.3.9" 1866 - source = "registry+https://github.com/rust-lang/crates.io-index" 1867 - checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1868 - dependencies = [ 1869 - "winapi-i686-pc-windows-gnu", 1870 - "winapi-x86_64-pc-windows-gnu", 1871 - ] 1872 - 1873 - [[package]] 1874 - name = "winapi-i686-pc-windows-gnu" 1875 - version = "0.4.0" 1876 - source = "registry+https://github.com/rust-lang/crates.io-index" 1877 - checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1878 - 1879 - [[package]] 1880 1424 name = "winapi-util" 1881 1425 version = "0.1.11" 1882 1426 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1884 1428 dependencies = [ 1885 1429 "windows-sys 0.60.2", 1886 1430 ] 1887 - 1888 - [[package]] 1889 - name = "winapi-x86_64-pc-windows-gnu" 1890 - version = "0.4.0" 1891 - source = "registry+https://github.com/rust-lang/crates.io-index" 1892 - checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1893 1431 1894 1432 [[package]] 1895 1433 name = "windows-link" ··· 2051 1589 checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" 2052 1590 2053 1591 [[package]] 2054 - name = "writeable" 2055 - version = "0.6.2" 2056 - source = "registry+https://github.com/rust-lang/crates.io-index" 2057 - checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" 2058 - 2059 - [[package]] 2060 - name = "yoke" 2061 - version = "0.8.1" 2062 - source = "registry+https://github.com/rust-lang/crates.io-index" 2063 - checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" 2064 - dependencies = [ 2065 - "stable_deref_trait", 2066 - "yoke-derive", 2067 - "zerofrom", 2068 - ] 2069 - 2070 - [[package]] 2071 - name = "yoke-derive" 2072 - version = "0.8.1" 2073 - source = "registry+https://github.com/rust-lang/crates.io-index" 2074 - checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" 2075 - dependencies = [ 2076 - "proc-macro2", 2077 - "quote", 2078 - "syn 2.0.106", 2079 - "synstructure", 2080 - ] 2081 - 2082 - [[package]] 2083 1592 name = "zerocopy" 2084 1593 version = "0.8.27" 2085 1594 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2098 1607 "quote", 2099 1608 "syn 2.0.106", 2100 1609 ] 2101 - 2102 - [[package]] 2103 - name = "zerofrom" 2104 - version = "0.1.6" 2105 - source = "registry+https://github.com/rust-lang/crates.io-index" 2106 - checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" 2107 - dependencies = [ 2108 - "zerofrom-derive", 2109 - ] 2110 - 2111 - [[package]] 2112 - name = "zerofrom-derive" 2113 - version = "0.1.6" 2114 - source = "registry+https://github.com/rust-lang/crates.io-index" 2115 - checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" 2116 - dependencies = [ 2117 - "proc-macro2", 2118 - "quote", 2119 - "syn 2.0.106", 2120 - "synstructure", 2121 - ] 2122 - 2123 - [[package]] 2124 - name = "zerotrie" 2125 - version = "0.2.3" 2126 - source = "registry+https://github.com/rust-lang/crates.io-index" 2127 - checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" 2128 - dependencies = [ 2129 - "displaydoc", 2130 - "yoke", 2131 - "zerofrom", 2132 - ] 2133 - 2134 - [[package]] 2135 - name = "zerovec" 2136 - version = "0.11.5" 2137 - source = "registry+https://github.com/rust-lang/crates.io-index" 2138 - checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" 2139 - dependencies = [ 2140 - "yoke", 2141 - "zerofrom", 2142 - "zerovec-derive", 2143 - ] 2144 - 2145 - [[package]] 2146 - name = "zerovec-derive" 2147 - version = "0.11.2" 2148 - source = "registry+https://github.com/rust-lang/crates.io-index" 2149 - checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" 2150 - dependencies = [ 2151 - "proc-macro2", 2152 - "quote", 2153 - "syn 2.0.106", 2154 - ]
+2 -5
Cargo.toml
··· 10 10 bincode = { version = "2.0.1", features = ["serde"] } 11 11 futures = "0.3.31" 12 12 futures-core = "0.3.31" 13 - heed = "0.22.0" 14 13 ipld-core = { version = "0.4.2", features = ["serde"] } 15 14 iroh-car = "0.5.1" 16 15 log = "0.4.28" 17 16 multibase = "0.9.2" 18 - redb = "3.1.0" 19 17 rusqlite = "0.37.0" 20 - rustcask = "0.1.0" 21 18 serde = { version = "1.0.228", features = ["derive"] } 22 19 serde_bytes = "0.11.19" 23 20 serde_ipld_dagcbor = "0.6.4" ··· 36 33 inherits = "release" 37 34 debug = true 38 35 39 - [profile.release] 40 - debug = true 36 + # [profile.release] 37 + # debug = true 41 38 42 39 [[bench]] 43 40 name = "non-huge-cars"
+1 -5
examples/disk-read-file/main.rs
··· 41 41 repo_stream::drive::Vehicle::Lil(_, _) => panic!("try this on a bigger car"), 42 42 repo_stream::drive::Vehicle::Big(big_stuff) => { 43 43 let disk_store = repo_stream::disk::SqliteStore::new(tmpfile.clone(), limit_mb); 44 - // let disk_store = repo_stream::disk::RedbStore::new(tmpfile.clone(), limit_mb); 45 - // let disk_store = repo_stream::disk::RustcaskStore::new(tmpfile.clone()); 46 - // let disk_store = repo_stream::disk::HeedStore::new(tmpfile.clone()); 47 44 let (commit, driver) = big_stuff.finish_loading(disk_store).await?; 48 45 log::warn!("big: {:?}", commit); 49 46 driver ··· 67 64 drop(driver); 68 65 log::info!("bye! {n}"); 69 66 70 - std::fs::remove_file(tmpfile).unwrap(); 71 - // std::fs::remove_dir_all(tmpfile).unwrap(); 67 + std::fs::remove_file(tmpfile).unwrap(); // need to also remove -shm -wal 72 68 73 69 Ok(()) 74 70 }
+14 -348
src/disk.rs
··· 1 - use redb::ReadableDatabase; 2 1 use rusqlite::OptionalExtension; 3 - use std::error::Error; 4 2 use std::path::PathBuf; 5 3 6 - pub trait StorageErrorBase: Error + Send + 'static {} 7 - 8 - /// high level potential storage resource 9 - /// 10 - /// separating this allows (hopefully) implementing a storage pool that can 11 - /// async-block when until a member is available to use 12 - pub trait DiskStore { 13 - type StorageError: StorageErrorBase + Send; 14 - type Access: DiskAccess<StorageError = Self::StorageError>; 15 - fn get_access(&mut self) -> impl Future<Output = Result<Self::Access, Self::StorageError>>; 16 - } 17 - 18 - /// actual concrete access to disk storage 19 - pub trait DiskAccess: Send { 20 - type StorageError: StorageErrorBase; 21 - 22 - fn get_writer(&mut self) -> Result<impl DiskWriter<Self::StorageError>, Self::StorageError>; 23 - 24 - fn get_reader( 25 - &self, 26 - ) -> Result<impl DiskReader<StorageError = Self::StorageError>, Self::StorageError>; 27 - 28 - // TODO: force a cleanup implementation? 29 - } 30 - 31 - pub trait DiskWriter<E: StorageErrorBase> { 32 - fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> Result<(), E>; 33 - fn put_many(&mut self, _kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<(), E>; 34 - } 35 - 36 - pub trait DiskReader { 37 - type StorageError: StorageErrorBase; 38 - fn get(&mut self, key: Vec<u8>) -> Result<Option<Vec<u8>>, Self::StorageError>; 39 - } 40 - 41 - ///////////////// sqlite 42 - 43 4 pub struct SqliteStore { 44 5 path: PathBuf, 45 6 limit_mb: usize, ··· 51 12 } 52 13 } 53 14 54 - impl StorageErrorBase for rusqlite::Error {} 55 - 56 - impl DiskStore for SqliteStore { 57 - type StorageError = rusqlite::Error; 58 - type Access = SqliteAccess; 59 - async fn get_access(&mut self) -> Result<SqliteAccess, rusqlite::Error> { 15 + impl SqliteStore { 16 + pub async fn get_access(&mut self) -> Result<SqliteAccess, rusqlite::Error> { 60 17 let path = self.path.clone(); 61 18 let limit_mb = self.limit_mb; 62 19 let conn = tokio::task::spawn_blocking(move || { ··· 78 35 (), 79 36 )?; 80 37 81 - Ok::<_, Self::StorageError>(conn) 38 + Ok::<_, rusqlite::Error>(conn) 82 39 }) 83 40 .await 84 41 .expect("join error")?; ··· 91 48 conn: rusqlite::Connection, 92 49 } 93 50 94 - impl DiskAccess for SqliteAccess { 95 - type StorageError = rusqlite::Error; 96 - fn get_writer(&mut self) -> Result<impl DiskWriter<rusqlite::Error>, rusqlite::Error> { 51 + impl SqliteAccess { 52 + pub fn get_writer(&'_ mut self) -> Result<SqliteWriter<'_>, rusqlite::Error> { 97 53 let tx = self.conn.transaction()?; 98 54 // let insert_stmt = tx.prepare("INSERT INTO blocks (key, val) VALUES (?1, ?2)")?; 99 55 Ok(SqliteWriter { tx: Some(tx) }) 100 56 } 101 - fn get_reader( 102 - &self, 103 - ) -> Result<impl DiskReader<StorageError = rusqlite::Error>, rusqlite::Error> { 57 + pub fn get_reader(&'_ self) -> Result<SqliteReader<'_>, rusqlite::Error> { 104 58 let select_stmt = self.conn.prepare("SELECT val FROM blocks WHERE key = ?1")?; 105 59 Ok(SqliteReader { select_stmt }) 106 60 } ··· 118 72 } 119 73 } 120 74 121 - impl DiskWriter<rusqlite::Error> for SqliteWriter<'_> { 122 - fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> rusqlite::Result<()> { 75 + impl SqliteWriter<'_> { 76 + pub fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> rusqlite::Result<()> { 123 77 let tx = self.tx.as_ref().unwrap(); 124 78 let mut insert_stmt = tx.prepare_cached("INSERT INTO blocks (key, val) VALUES (?1, ?2)")?; 125 79 insert_stmt.execute((key, val))?; 126 80 Ok(()) 127 81 } 128 - fn put_many(&mut self, kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>) -> rusqlite::Result<()> { 82 + pub fn put_many( 83 + &mut self, 84 + kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>, 85 + ) -> rusqlite::Result<()> { 129 86 let tx = self.tx.as_ref().unwrap(); 130 87 let mut insert_stmt = tx.prepare_cached("INSERT INTO blocks (key, val) VALUES (?1, ?2)")?; 131 88 for (k, v) in kv { ··· 139 96 select_stmt: rusqlite::Statement<'conn>, 140 97 } 141 98 142 - impl DiskReader for SqliteReader<'_> { 143 - type StorageError = rusqlite::Error; 144 - fn get(&mut self, key: Vec<u8>) -> rusqlite::Result<Option<Vec<u8>>> { 99 + impl SqliteReader<'_> { 100 + pub fn get(&mut self, key: Vec<u8>) -> rusqlite::Result<Option<Vec<u8>>> { 145 101 self.select_stmt 146 102 .query_one((&key,), |row| row.get(0)) 147 103 .optional() 148 104 } 149 105 } 150 - 151 - //////////// redb why not 152 - 153 - const REDB_TABLE: redb::TableDefinition<&[u8], &[u8]> = redb::TableDefinition::new("blocks"); 154 - 155 - pub struct RedbStore { 156 - path: PathBuf, 157 - limit_mb: usize, 158 - } 159 - 160 - impl RedbStore { 161 - pub fn new(path: PathBuf, limit_mb: usize) -> Self { 162 - Self { path, limit_mb } 163 - } 164 - } 165 - 166 - impl StorageErrorBase for redb::Error {} 167 - 168 - impl DiskStore for RedbStore { 169 - type StorageError = redb::Error; 170 - type Access = RedbAccess; 171 - async fn get_access(&mut self) -> Result<RedbAccess, redb::Error> { 172 - let path = self.path.clone(); 173 - let limit_mb = self.limit_mb; 174 - let mb = 2_usize.pow(20); 175 - let db = tokio::task::spawn_blocking(move || { 176 - let db = redb::Database::builder() 177 - .set_cache_size(limit_mb * mb) 178 - .create(path)?; 179 - Ok::<_, Self::StorageError>(db) 180 - }) 181 - .await 182 - .expect("join error")?; 183 - 184 - Ok(RedbAccess { db }) 185 - } 186 - } 187 - 188 - pub struct RedbAccess { 189 - db: redb::Database, 190 - } 191 - 192 - impl DiskAccess for RedbAccess { 193 - type StorageError = redb::Error; 194 - fn get_writer(&mut self) -> Result<impl DiskWriter<redb::Error>, redb::Error> { 195 - let mut tx = self.db.begin_write()?; 196 - tx.set_durability(redb::Durability::None)?; 197 - Ok(RedbWriter { tx: Some(tx) }) 198 - } 199 - fn get_reader(&self) -> Result<impl DiskReader<StorageError = redb::Error>, redb::Error> { 200 - let tx = self.db.begin_read()?; 201 - Ok(RedbReader { tx }) 202 - } 203 - } 204 - 205 - pub struct RedbWriter { 206 - tx: Option<redb::WriteTransaction>, 207 - } 208 - 209 - impl DiskWriter<redb::Error> for RedbWriter { 210 - fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> Result<(), redb::Error> { 211 - let mut table = self.tx.as_ref().unwrap().open_table(REDB_TABLE)?; 212 - table.insert(&*key, &*val)?; 213 - Ok(()) 214 - } 215 - fn put_many( 216 - &mut self, 217 - kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>, 218 - ) -> Result<(), redb::Error> { 219 - let mut table = self.tx.as_ref().unwrap().open_table(REDB_TABLE)?; 220 - for (k, v) in kv { 221 - table.insert(&*k, &*v)?; 222 - } 223 - Ok(()) 224 - } 225 - } 226 - 227 - /// oops careful in async 228 - impl Drop for RedbWriter { 229 - fn drop(&mut self) { 230 - let tx = self.tx.take(); 231 - tx.unwrap().commit().unwrap(); 232 - } 233 - } 234 - 235 - pub struct RedbReader { 236 - tx: redb::ReadTransaction, 237 - } 238 - 239 - impl DiskReader for RedbReader { 240 - type StorageError = redb::Error; 241 - fn get(&mut self, key: Vec<u8>) -> Result<Option<Vec<u8>>, redb::Error> { 242 - let table = self.tx.open_table(REDB_TABLE)?; 243 - let rv = table.get(&*key)?.map(|guard| guard.value().to_vec()); 244 - Ok(rv) 245 - } 246 - } 247 - 248 - ///// rustcask?? 249 - 250 - pub struct RustcaskStore { 251 - path: PathBuf, 252 - } 253 - 254 - impl RustcaskStore { 255 - pub fn new(path: PathBuf) -> Self { 256 - Self { path } 257 - } 258 - } 259 - 260 - #[derive(Debug, thiserror::Error)] 261 - pub enum CaskError { 262 - #[error(transparent)] 263 - OpenError(#[from] rustcask::error::OpenError), 264 - #[error(transparent)] 265 - SetError(#[from] rustcask::error::SetError), 266 - #[error("failed to get key: {0}")] 267 - GetError(String), 268 - #[error("failed to ensure directory: {0}")] 269 - EnsureDirError(std::io::Error), 270 - } 271 - 272 - impl StorageErrorBase for CaskError {} 273 - 274 - impl DiskStore for RustcaskStore { 275 - type StorageError = CaskError; 276 - type Access = RustcaskAccess; 277 - async fn get_access(&mut self) -> Result<RustcaskAccess, CaskError> { 278 - let path = self.path.clone(); 279 - let db = tokio::task::spawn_blocking(move || { 280 - std::fs::create_dir_all(&path).map_err(CaskError::EnsureDirError)?; 281 - let db = rustcask::Rustcask::builder().open(&path)?; 282 - Ok::<_, Self::StorageError>(db) 283 - }) 284 - .await 285 - .expect("join error")?; 286 - 287 - Ok(RustcaskAccess { db }) 288 - } 289 - } 290 - 291 - pub struct RustcaskAccess { 292 - db: rustcask::Rustcask, 293 - } 294 - 295 - impl DiskAccess for RustcaskAccess { 296 - type StorageError = CaskError; 297 - fn get_writer(&mut self) -> Result<impl DiskWriter<CaskError>, CaskError> { 298 - Ok(RustcaskWriter { 299 - db: self.db.clone(), 300 - }) 301 - } 302 - fn get_reader(&self) -> Result<impl DiskReader<StorageError = CaskError>, CaskError> { 303 - Ok(RustcaskReader { 304 - db: self.db.clone(), 305 - }) 306 - } 307 - } 308 - 309 - pub struct RustcaskWriter { 310 - db: rustcask::Rustcask, 311 - } 312 - 313 - impl DiskWriter<CaskError> for RustcaskWriter { 314 - fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> Result<(), CaskError> { 315 - self.db.set(key, val)?; 316 - Ok(()) 317 - } 318 - fn put_many(&mut self, kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<(), CaskError> { 319 - for (k, v) in kv { 320 - self.db.set(k, v)?; 321 - } 322 - Ok(()) 323 - } 324 - } 325 - 326 - pub struct RustcaskReader { 327 - db: rustcask::Rustcask, 328 - } 329 - 330 - impl DiskReader for RustcaskReader { 331 - type StorageError = CaskError; 332 - fn get(&mut self, key: Vec<u8>) -> Result<Option<Vec<u8>>, CaskError> { 333 - self.db 334 - .get(&key) 335 - .map_err(|e| CaskError::GetError(e.to_string())) 336 - } 337 - } 338 - 339 - ///////// heeeeeeeeeeeeed 340 - 341 - type HeedBytes = heed::types::SerdeBincode<Vec<u8>>; 342 - type HeedDb = heed::Database<HeedBytes, HeedBytes>; 343 - // type HeedDb = heed::Database<Vec<u8>, Vec<u8>>; 344 - 345 - pub struct HeedStore { 346 - path: PathBuf, 347 - } 348 - 349 - impl HeedStore { 350 - pub fn new(path: PathBuf) -> Self { 351 - Self { path } 352 - } 353 - } 354 - 355 - impl StorageErrorBase for heed::Error {} 356 - 357 - impl DiskStore for HeedStore { 358 - type StorageError = heed::Error; 359 - type Access = HeedAccess; 360 - async fn get_access(&mut self) -> Result<HeedAccess, heed::Error> { 361 - let path = self.path.clone(); 362 - let env = tokio::task::spawn_blocking(move || { 363 - std::fs::create_dir_all(&path).unwrap(); 364 - let env = unsafe { 365 - heed::EnvOpenOptions::new() 366 - .map_size(2 * 2_usize.pow(30)) 367 - .open(path)? 368 - }; 369 - Ok::<_, Self::StorageError>(env) 370 - }) 371 - .await 372 - .expect("join error")?; 373 - 374 - Ok(HeedAccess { env, db: None }) 375 - } 376 - } 377 - 378 - pub struct HeedAccess { 379 - env: heed::Env, 380 - db: Option<HeedDb>, 381 - } 382 - 383 - impl DiskAccess for HeedAccess { 384 - type StorageError = heed::Error; 385 - fn get_writer(&mut self) -> Result<impl DiskWriter<heed::Error>, heed::Error> { 386 - let mut tx = self.env.write_txn()?; 387 - let db = self.env.create_database(&mut tx, None)?; 388 - self.db = Some(db); 389 - Ok(HeedWriter { tx: Some(tx), db }) 390 - } 391 - fn get_reader(&self) -> Result<impl DiskReader<StorageError = heed::Error>, heed::Error> { 392 - let tx = self.env.read_txn()?; 393 - let db = self.db.expect("should have called get_writer first"); 394 - Ok(HeedReader { tx, db }) 395 - } 396 - } 397 - 398 - pub struct HeedWriter<'tx> { 399 - tx: Option<heed::RwTxn<'tx>>, 400 - db: HeedDb, 401 - } 402 - 403 - impl DiskWriter<heed::Error> for HeedWriter<'_> { 404 - fn put(&mut self, key: Vec<u8>, val: Vec<u8>) -> Result<(), heed::Error> { 405 - let tx = self.tx.as_mut().unwrap(); 406 - self.db.put(tx, &key, &val)?; 407 - Ok(()) 408 - } 409 - fn put_many( 410 - &mut self, 411 - kv: impl Iterator<Item = (Vec<u8>, Vec<u8>)>, 412 - ) -> Result<(), heed::Error> { 413 - let tx = self.tx.as_mut().unwrap(); 414 - for (k, v) in kv { 415 - self.db.put(tx, &k, &v)?; 416 - } 417 - Ok(()) 418 - } 419 - } 420 - 421 - /// oops careful in async 422 - impl Drop for HeedWriter<'_> { 423 - fn drop(&mut self) { 424 - let tx = self.tx.take(); 425 - tx.unwrap().commit().unwrap(); 426 - } 427 - } 428 - 429 - pub struct HeedReader<'tx> { 430 - tx: heed::RoTxn<'tx, heed::WithTls>, 431 - db: HeedDb, 432 - } 433 - 434 - impl DiskReader for HeedReader<'_> { 435 - type StorageError = heed::Error; 436 - fn get(&mut self, key: Vec<u8>) -> Result<Option<Vec<u8>>, heed::Error> { 437 - self.db.get(&self.tx, &key) 438 - } 439 - }
+14 -21
src/drive.rs
··· 1 1 //! Consume an MST block stream, producing an ordered stream of records 2 2 3 - use crate::disk::{DiskAccess, DiskStore, DiskWriter, StorageErrorBase}; 3 + use crate::disk::{SqliteAccess, SqliteStore}; 4 4 use ipld_core::cid::Cid; 5 5 use iroh_car::CarReader; 6 6 use serde::de::DeserializeOwned; ··· 30 30 } 31 31 32 32 #[derive(Debug, thiserror::Error)] 33 - pub enum DiskDriveError<E: StorageErrorBase> { 33 + pub enum DiskDriveError { 34 34 #[error("Error from iroh_car: {0}")] 35 35 CarReader(#[from] iroh_car::Error), 36 36 #[error("Failed to decode commit block: {0}")] 37 37 BadBlock(#[from] serde_ipld_dagcbor::DecodeError<Infallible>), 38 38 #[error("Storage error")] 39 - StorageError(#[from] E), 39 + StorageError(#[from] rusqlite::Error), 40 40 #[error("The Commit block reference by the root was not found")] 41 41 MissingCommit, 42 42 #[error("The MST block {0} could not be found")] ··· 46 46 #[error("Decode error: {0}")] 47 47 BincodeDecodeError(#[from] bincode::error::DecodeError), 48 48 #[error("disk tripped: {0}")] 49 - DiskTripped(#[from] DiskTrip<E>), 49 + DiskTripped(#[from] DiskTrip), 50 50 } 51 51 52 52 pub trait Processable: Clone + Serialize + DeserializeOwned { ··· 190 190 } 191 191 192 192 impl<R: AsyncRead + Unpin, T: Processable + Send + 'static> BigCar<R, T> { 193 - pub async fn finish_loading<S: DiskStore>( 193 + pub async fn finish_loading( 194 194 mut self, 195 - mut store: S, 196 - ) -> Result<(Commit, BigCarReady<T, S::Access>), DiskDriveError<S::StorageError>> 197 - where 198 - S::Access: Send + 'static, 199 - S::StorageError: 'static, 200 - { 195 + mut store: SqliteStore, 196 + ) -> Result<(Commit, BigCarReady<T>), DiskDriveError> { 201 197 // set up access for real 202 198 let mut access = store.get_access().await?; 203 199 ··· 214 210 writer.put_many(kvs)?; 215 211 216 212 drop(writer); // cannot outlive access 217 - Ok::<_, DiskDriveError<S::StorageError>>(access) 213 + Ok::<_, DiskDriveError>(access) 218 214 }) 219 215 .await 220 216 .unwrap()?; ··· 262 258 writer.put_many(kvs)?; 263 259 264 260 drop(writer); // cannot outlive access 265 - Ok::<_, DiskDriveError<S::StorageError>>(access) 261 + Ok::<_, DiskDriveError>(access) 266 262 }) 267 263 .await 268 264 .unwrap()?; // TODO ··· 283 279 } 284 280 } 285 281 286 - pub struct BigCarReady<T: Clone, A: DiskAccess> { 282 + pub struct BigCarReady<T: Clone> { 287 283 process: fn(Vec<u8>) -> T, 288 - access: A, 284 + access: SqliteAccess, 289 285 walker: Walker, 290 286 } 291 287 292 - impl<T: Processable + Send + 'static, A: DiskAccess + Send + 'static> BigCarReady<T, A> { 288 + impl<T: Processable + Send + 'static> BigCarReady<T> { 293 289 pub async fn next_chunk( 294 290 mut self, 295 291 n: usize, 296 - ) -> Result<(Self, Option<Vec<(String, T)>>), DiskDriveError<A::StorageError>> 297 - where 298 - A::StorageError: Send, 299 - { 292 + ) -> Result<(Self, Option<Vec<(String, T)>>), DiskDriveError> { 300 293 let mut out = Vec::with_capacity(n); 301 294 (self, out) = tokio::task::spawn_blocking(move || { 302 295 let access = self.access; ··· 316 309 317 310 drop(reader); // cannot outlive access 318 311 self.access = access; 319 - Ok::<_, DiskDriveError<A::StorageError>>((self, out)) 312 + Ok::<_, DiskDriveError>((self, out)) 320 313 }) 321 314 .await 322 315 .unwrap()?; // TODO
+6 -6
src/walk.rs
··· 1 1 //! Depth-first MST traversal 2 2 3 - use crate::disk::{DiskReader, StorageErrorBase}; 3 + use crate::disk::SqliteReader; 4 4 use crate::drive::{MaybeProcessedBlock, Processable}; 5 5 use crate::mst::Node; 6 6 use ipld_core::cid::Cid; ··· 24 24 25 25 /// Errors that can happen while walking 26 26 #[derive(Debug, thiserror::Error)] 27 - pub enum DiskTrip<E: StorageErrorBase> { 27 + pub enum DiskTrip { 28 28 #[error("tripped: {0}")] 29 29 Trip(#[from] Trip), 30 30 #[error("storage error: {0}")] 31 - StorageError(#[from] E), 31 + StorageError(#[from] rusqlite::Error), 32 32 #[error("Decode error: {0}")] 33 33 BincodeDecodeError(#[from] bincode::error::DecodeError), 34 34 } ··· 170 170 } 171 171 172 172 /// blocking!!!!!! 173 - pub fn disk_step<T: Processable, R: DiskReader>( 173 + pub fn disk_step<T: Processable>( 174 174 &mut self, 175 - reader: &mut R, 175 + reader: &mut SqliteReader, 176 176 process: impl Fn(Vec<u8>) -> T, 177 - ) -> Result<Step<T>, DiskTrip<R::StorageError>> { 177 + ) -> Result<Step<T>, DiskTrip> { 178 178 loop { 179 179 let Some(mut need) = self.stack.last() else { 180 180 log::trace!("tried to walk but we're actually done.");