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

Configure Feed

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

Merge branch 'constellation/eat-rocks'

+474 -44
+354 -13
Cargo.lock
··· 767 767 checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" 768 768 769 769 [[package]] 770 + name = "chacha20" 771 + version = "0.10.0" 772 + source = "registry+https://github.com/rust-lang/crates.io-index" 773 + checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" 774 + dependencies = [ 775 + "cfg-if", 776 + "cpufeatures 0.3.0", 777 + "rand_core 0.10.0", 778 + ] 779 + 780 + [[package]] 770 781 name = "chrono" 771 782 version = "0.4.41" 772 783 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 941 952 "bincode 1.3.3", 942 953 "clap", 943 954 "ctrlc", 955 + "eat-rocks", 944 956 "flume", 945 957 "fs4 0.12.0", 946 958 "headers-accept", ··· 962 974 "tokio", 963 975 "tokio-util", 964 976 "tower-http", 977 + "tracing", 978 + "tracing-subscriber", 965 979 "tungstenite 0.26.2", 966 980 "zstd", 967 981 ] ··· 1019 1033 checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" 1020 1034 dependencies = [ 1021 1035 "libc", 1036 + ] 1037 + 1038 + [[package]] 1039 + name = "cpufeatures" 1040 + version = "0.3.0" 1041 + source = "registry+https://github.com/rust-lang/crates.io-index" 1042 + checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" 1043 + dependencies = [ 1044 + "libc", 1045 + ] 1046 + 1047 + [[package]] 1048 + name = "crc32c" 1049 + version = "0.6.8" 1050 + source = "registry+https://github.com/rust-lang/crates.io-index" 1051 + checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" 1052 + dependencies = [ 1053 + "rustc_version", 1022 1054 ] 1023 1055 1024 1056 [[package]] ··· 1370 1402 version = "1.0.19" 1371 1403 source = "registry+https://github.com/rust-lang/crates.io-index" 1372 1404 checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" 1405 + 1406 + [[package]] 1407 + name = "eat-rocks" 1408 + version = "0.2.0" 1409 + source = "registry+https://github.com/rust-lang/crates.io-index" 1410 + checksum = "39085e0daac22aea54faf9c0b92d5a391143cc24f9b2fee8fac4cf2fdc56f7b2" 1411 + dependencies = [ 1412 + "crc32c", 1413 + "futures", 1414 + "object_store", 1415 + "thiserror 2.0.18", 1416 + "tokio", 1417 + "tracing", 1418 + ] 1373 1419 1374 1420 [[package]] 1375 1421 name = "ecdsa" ··· 1937 1983 "cfg-if", 1938 1984 "js-sys", 1939 1985 "libc", 1940 - "r-efi", 1986 + "r-efi 5.2.0", 1941 1987 "wasi 0.14.2+wasi-0.2.4", 1942 1988 "wasm-bindgen", 1989 + ] 1990 + 1991 + [[package]] 1992 + name = "getrandom" 1993 + version = "0.4.2" 1994 + source = "registry+https://github.com/rust-lang/crates.io-index" 1995 + checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" 1996 + dependencies = [ 1997 + "cfg-if", 1998 + "libc", 1999 + "r-efi 6.0.0", 2000 + "rand_core 0.10.0", 2001 + "wasip2", 2002 + "wasip3", 1943 2003 ] 1944 2004 1945 2005 [[package]] ··· 2253 2313 ] 2254 2314 2255 2315 [[package]] 2316 + name = "humantime" 2317 + version = "2.3.0" 2318 + source = "registry+https://github.com/rust-lang/crates.io-index" 2319 + checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" 2320 + 2321 + [[package]] 2256 2322 name = "hyper" 2257 2323 version = "1.9.0" 2258 2324 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2476 2542 ] 2477 2543 2478 2544 [[package]] 2545 + name = "id-arena" 2546 + version = "2.3.0" 2547 + source = "registry+https://github.com/rust-lang/crates.io-index" 2548 + checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" 2549 + 2550 + [[package]] 2479 2551 name = "ident_case" 2480 2552 version = "1.0.1" 2481 2553 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2779 2851 checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 2780 2852 2781 2853 [[package]] 2854 + name = "leb128fmt" 2855 + version = "0.1.0" 2856 + source = "registry+https://github.com/rust-lang/crates.io-index" 2857 + checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" 2858 + 2859 + [[package]] 2782 2860 name = "left-right" 2783 2861 version = "0.11.7" 2784 2862 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3029 3107 checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" 3030 3108 3031 3109 [[package]] 3110 + name = "md-5" 3111 + version = "0.10.6" 3112 + source = "registry+https://github.com/rust-lang/crates.io-index" 3113 + checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" 3114 + dependencies = [ 3115 + "cfg-if", 3116 + "digest", 3117 + ] 3118 + 3119 + [[package]] 3032 3120 name = "mea" 3033 3121 version = "0.6.3" 3034 3122 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3391 3479 ] 3392 3480 3393 3481 [[package]] 3482 + name = "object_store" 3483 + version = "0.13.2" 3484 + source = "registry+https://github.com/rust-lang/crates.io-index" 3485 + checksum = "622acbc9100d3c10e2ee15804b0caa40e55c933d5aa53814cd520805b7958a49" 3486 + dependencies = [ 3487 + "async-trait", 3488 + "base64 0.22.1", 3489 + "bytes", 3490 + "chrono", 3491 + "form_urlencoded", 3492 + "futures-channel", 3493 + "futures-core", 3494 + "futures-util", 3495 + "http", 3496 + "http-body-util", 3497 + "humantime", 3498 + "hyper", 3499 + "itertools 0.14.0", 3500 + "md-5", 3501 + "parking_lot", 3502 + "percent-encoding", 3503 + "quick-xml 0.39.2", 3504 + "rand 0.10.1", 3505 + "reqwest", 3506 + "ring", 3507 + "serde", 3508 + "serde_json", 3509 + "serde_urlencoded", 3510 + "thiserror 2.0.18", 3511 + "tokio", 3512 + "tracing", 3513 + "url", 3514 + "walkdir", 3515 + "wasm-bindgen-futures", 3516 + "web-time", 3517 + ] 3518 + 3519 + [[package]] 3394 3520 name = "oid-registry" 3395 3521 version = "0.8.1" 3396 3522 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3654 3780 "percent-encoding", 3655 3781 "pin-project-lite", 3656 3782 "poem-derive", 3657 - "quick-xml", 3783 + "quick-xml 0.36.2", 3658 3784 "rcgen", 3659 3785 "regex", 3660 3786 "reqwest", ··· 3706 3832 "num-traits", 3707 3833 "poem", 3708 3834 "poem-openapi-derive", 3709 - "quick-xml", 3835 + "quick-xml 0.36.2", 3710 3836 "regex", 3711 3837 "serde", 3712 3838 "serde_json", ··· 3857 3983 ] 3858 3984 3859 3985 [[package]] 3986 + name = "quick-xml" 3987 + version = "0.39.2" 3988 + source = "registry+https://github.com/rust-lang/crates.io-index" 3989 + checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" 3990 + dependencies = [ 3991 + "memchr", 3992 + "serde", 3993 + ] 3994 + 3995 + [[package]] 3860 3996 name = "quick_cache" 3861 3997 version = "0.6.12" 3862 3998 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3937 4073 checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" 3938 4074 3939 4075 [[package]] 4076 + name = "r-efi" 4077 + version = "6.0.0" 4078 + source = "registry+https://github.com/rust-lang/crates.io-index" 4079 + checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" 4080 + 4081 + [[package]] 3940 4082 name = "radix_trie" 3941 4083 version = "0.2.1" 3942 4084 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3968 4110 ] 3969 4111 3970 4112 [[package]] 4113 + name = "rand" 4114 + version = "0.10.1" 4115 + source = "registry+https://github.com/rust-lang/crates.io-index" 4116 + checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" 4117 + dependencies = [ 4118 + "chacha20", 4119 + "getrandom 0.4.2", 4120 + "rand_core 0.10.0", 4121 + ] 4122 + 4123 + [[package]] 3971 4124 name = "rand_chacha" 3972 4125 version = "0.3.1" 3973 4126 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4006 4159 ] 4007 4160 4008 4161 [[package]] 4162 + name = "rand_core" 4163 + version = "0.10.0" 4164 + source = "registry+https://github.com/rust-lang/crates.io-index" 4165 + checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" 4166 + 4167 + [[package]] 4009 4168 name = "rand_xoshiro" 4010 4169 version = "0.7.0" 4011 4170 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4168 4327 "url", 4169 4328 "wasm-bindgen", 4170 4329 "wasm-bindgen-futures", 4330 + "wasm-streams", 4171 4331 "web-sys", 4172 4332 ] 4173 4333 ··· 4402 4562 checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" 4403 4563 4404 4564 [[package]] 4565 + name = "same-file" 4566 + version = "1.0.6" 4567 + source = "registry+https://github.com/rust-lang/crates.io-index" 4568 + checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 4569 + dependencies = [ 4570 + "winapi-util", 4571 + ] 4572 + 4573 + [[package]] 4405 4574 name = "schannel" 4406 4575 version = "0.1.27" 4407 4576 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4712 4881 checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 4713 4882 dependencies = [ 4714 4883 "cfg-if", 4715 - "cpufeatures", 4884 + "cpufeatures 0.2.17", 4716 4885 "digest", 4717 4886 ] 4718 4887 ··· 4723 4892 checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" 4724 4893 dependencies = [ 4725 4894 "cfg-if", 4726 - "cpufeatures", 4895 + "cpufeatures 0.2.17", 4727 4896 "digest", 4728 4897 ] 4729 4898 ··· 5401 5570 5402 5571 [[package]] 5403 5572 name = "tracing" 5404 - version = "0.1.41" 5573 + version = "0.1.44" 5405 5574 source = "registry+https://github.com/rust-lang/crates.io-index" 5406 - checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 5575 + checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" 5407 5576 dependencies = [ 5408 5577 "log", 5409 5578 "pin-project-lite", ··· 5413 5582 5414 5583 [[package]] 5415 5584 name = "tracing-attributes" 5416 - version = "0.1.30" 5585 + version = "0.1.31" 5417 5586 source = "registry+https://github.com/rust-lang/crates.io-index" 5418 - checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" 5587 + checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" 5419 5588 dependencies = [ 5420 5589 "proc-macro2", 5421 5590 "quote", ··· 5424 5593 5425 5594 [[package]] 5426 5595 name = "tracing-core" 5427 - version = "0.1.33" 5596 + version = "0.1.36" 5428 5597 source = "registry+https://github.com/rust-lang/crates.io-index" 5429 - checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" 5598 + checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" 5430 5599 dependencies = [ 5431 5600 "once_cell", 5432 5601 "valuable", ··· 5445 5614 5446 5615 [[package]] 5447 5616 name = "tracing-subscriber" 5448 - version = "0.3.20" 5617 + version = "0.3.23" 5449 5618 source = "registry+https://github.com/rust-lang/crates.io-index" 5450 - checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" 5619 + checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" 5451 5620 dependencies = [ 5452 5621 "matchers", 5453 5622 "nu-ansi-term", ··· 5730 5899 ] 5731 5900 5732 5901 [[package]] 5902 + name = "walkdir" 5903 + version = "2.5.0" 5904 + source = "registry+https://github.com/rust-lang/crates.io-index" 5905 + checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" 5906 + dependencies = [ 5907 + "same-file", 5908 + "winapi-util", 5909 + ] 5910 + 5911 + [[package]] 5733 5912 name = "want" 5734 5913 version = "0.3.1" 5735 5914 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 5751 5930 checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" 5752 5931 dependencies = [ 5753 5932 "wit-bindgen-rt", 5933 + ] 5934 + 5935 + [[package]] 5936 + name = "wasip2" 5937 + version = "1.0.2+wasi-0.2.9" 5938 + source = "registry+https://github.com/rust-lang/crates.io-index" 5939 + checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" 5940 + dependencies = [ 5941 + "wit-bindgen", 5942 + ] 5943 + 5944 + [[package]] 5945 + name = "wasip3" 5946 + version = "0.4.0+wasi-0.3.0-rc-2026-01-06" 5947 + source = "registry+https://github.com/rust-lang/crates.io-index" 5948 + checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" 5949 + dependencies = [ 5950 + "wit-bindgen", 5754 5951 ] 5755 5952 5756 5953 [[package]] ··· 5825 6022 ] 5826 6023 5827 6024 [[package]] 6025 + name = "wasm-encoder" 6026 + version = "0.244.0" 6027 + source = "registry+https://github.com/rust-lang/crates.io-index" 6028 + checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" 6029 + dependencies = [ 6030 + "leb128fmt", 6031 + "wasmparser", 6032 + ] 6033 + 6034 + [[package]] 6035 + name = "wasm-metadata" 6036 + version = "0.244.0" 6037 + source = "registry+https://github.com/rust-lang/crates.io-index" 6038 + checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" 6039 + dependencies = [ 6040 + "anyhow", 6041 + "indexmap 2.11.4", 6042 + "wasm-encoder", 6043 + "wasmparser", 6044 + ] 6045 + 6046 + [[package]] 6047 + name = "wasm-streams" 6048 + version = "0.4.2" 6049 + source = "registry+https://github.com/rust-lang/crates.io-index" 6050 + checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" 6051 + dependencies = [ 6052 + "futures-util", 6053 + "js-sys", 6054 + "wasm-bindgen", 6055 + "wasm-bindgen-futures", 6056 + "web-sys", 6057 + ] 6058 + 6059 + [[package]] 6060 + name = "wasmparser" 6061 + version = "0.244.0" 6062 + source = "registry+https://github.com/rust-lang/crates.io-index" 6063 + checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" 6064 + dependencies = [ 6065 + "bitflags", 6066 + "hashbrown 0.15.2", 6067 + "indexmap 2.11.4", 6068 + "semver", 6069 + ] 6070 + 6071 + [[package]] 5828 6072 name = "web-sys" 5829 6073 version = "0.3.77" 5830 6074 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 5885 6129 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 5886 6130 5887 6131 [[package]] 6132 + name = "winapi-util" 6133 + version = "0.1.11" 6134 + source = "registry+https://github.com/rust-lang/crates.io-index" 6135 + checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" 6136 + dependencies = [ 6137 + "windows-sys 0.59.0", 6138 + ] 6139 + 6140 + [[package]] 5888 6141 name = "winapi-x86_64-pc-windows-gnu" 5889 6142 version = "0.4.0" 5890 6143 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 6157 6410 ] 6158 6411 6159 6412 [[package]] 6413 + name = "wit-bindgen" 6414 + version = "0.51.0" 6415 + source = "registry+https://github.com/rust-lang/crates.io-index" 6416 + checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" 6417 + dependencies = [ 6418 + "wit-bindgen-rust-macro", 6419 + ] 6420 + 6421 + [[package]] 6422 + name = "wit-bindgen-core" 6423 + version = "0.51.0" 6424 + source = "registry+https://github.com/rust-lang/crates.io-index" 6425 + checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" 6426 + dependencies = [ 6427 + "anyhow", 6428 + "heck", 6429 + "wit-parser", 6430 + ] 6431 + 6432 + [[package]] 6160 6433 name = "wit-bindgen-rt" 6161 6434 version = "0.39.0" 6162 6435 source = "registry+https://github.com/rust-lang/crates.io-index" 6163 6436 checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" 6164 6437 dependencies = [ 6165 6438 "bitflags", 6439 + ] 6440 + 6441 + [[package]] 6442 + name = "wit-bindgen-rust" 6443 + version = "0.51.0" 6444 + source = "registry+https://github.com/rust-lang/crates.io-index" 6445 + checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" 6446 + dependencies = [ 6447 + "anyhow", 6448 + "heck", 6449 + "indexmap 2.11.4", 6450 + "prettyplease", 6451 + "syn", 6452 + "wasm-metadata", 6453 + "wit-bindgen-core", 6454 + "wit-component", 6455 + ] 6456 + 6457 + [[package]] 6458 + name = "wit-bindgen-rust-macro" 6459 + version = "0.51.0" 6460 + source = "registry+https://github.com/rust-lang/crates.io-index" 6461 + checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" 6462 + dependencies = [ 6463 + "anyhow", 6464 + "prettyplease", 6465 + "proc-macro2", 6466 + "quote", 6467 + "syn", 6468 + "wit-bindgen-core", 6469 + "wit-bindgen-rust", 6470 + ] 6471 + 6472 + [[package]] 6473 + name = "wit-component" 6474 + version = "0.244.0" 6475 + source = "registry+https://github.com/rust-lang/crates.io-index" 6476 + checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" 6477 + dependencies = [ 6478 + "anyhow", 6479 + "bitflags", 6480 + "indexmap 2.11.4", 6481 + "log", 6482 + "serde", 6483 + "serde_derive", 6484 + "serde_json", 6485 + "wasm-encoder", 6486 + "wasm-metadata", 6487 + "wasmparser", 6488 + "wit-parser", 6489 + ] 6490 + 6491 + [[package]] 6492 + name = "wit-parser" 6493 + version = "0.244.0" 6494 + source = "registry+https://github.com/rust-lang/crates.io-index" 6495 + checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" 6496 + dependencies = [ 6497 + "anyhow", 6498 + "id-arena", 6499 + "indexmap 2.11.4", 6500 + "log", 6501 + "semver", 6502 + "serde", 6503 + "serde_derive", 6504 + "serde_json", 6505 + "unicode-xid", 6506 + "wasmparser", 6166 6507 ] 6167 6508 6168 6509 [[package]]
+2
Cargo.toml
··· 18 18 metrics-exporter-prometheus = { version = "0.18.3", default-features = false, features = ["http-listener"] } 19 19 metrics-util = "0.20.3" 20 20 thiserror = "2.0.18" 21 + tracing = "0.1.44" 22 + tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
+4 -1
constellation/Cargo.toml
··· 13 13 bincode = "1.3.3" 14 14 clap = { workspace = true } 15 15 ctrlc = "3.4.5" 16 + eat-rocks = { version = "0.2.0", optional = true, features = ["easy"] } 16 17 flume = { version = "0.11.1", default-features = false } 17 18 fs4 = { version = "0.12.0", features = ["sync"] } 18 19 headers-accept = "0.1.4" ··· 32 33 tinyjson = "2.5.1" 33 34 tokio-util = "0.7.13" 34 35 tower-http = { version = "0.6.2", features = ["cors"] } 36 + tracing = { workspace = true } 37 + tracing-subscriber = { workspace = true } 35 38 zstd = "0.13.2" 36 39 37 40 [dependencies.tokio] ··· 47 50 48 51 [features] 49 52 default = ["rocks"] 50 - rocks = ["dep:rocksdb"] 53 + rocks = ["dep:rocksdb", "dep:eat-rocks"]
+114 -30
constellation/src/bin/rocks-restore-from-backup.rs
··· 2 2 use anyhow::Result; 3 3 use clap::Parser; 4 4 use std::path::PathBuf; 5 + use std::time; 6 + use tracing::{error, info}; 5 7 6 8 #[cfg(feature = "rocks")] 7 9 use rocksdb::backup::{BackupEngine, BackupEngineOptions, RestoreOptions}; 8 10 9 - use std::time; 10 - 11 - /// Aggregate links in the at-mosphere 11 + /// Restore a rocksdb database 12 12 #[derive(Parser, Debug)] 13 13 #[command(version, about, long_about = None)] 14 14 struct Args { 15 - /// the backup directory to restore *from* 15 + /// the directory to restore the database into 16 + dest: PathBuf, 17 + /// restore from a rocksdb backup folder 18 + #[arg(long, conflicts_with_all = ["endpoint", "prefix", "concurrency"])] 19 + fs_dir: Option<PathBuf>, 20 + /// restore from public object storage 21 + #[arg(long, default_value = "https://constellation.t3.storage.dev")] 22 + endpoint: String, 23 + /// specific backup to restore (default: latest) 16 24 #[arg(long)] 17 - from_backup_dir: PathBuf, 18 - /// the db dir to restore *to* 25 + backup: Option<u32>, 26 + /// object-store key prefix 27 + #[arg(long, default_value = "")] 28 + prefix: String, 29 + /// concurrency limit for object storage operations 30 + /// 31 + /// TODO: wire this through for the filesystem mode as well. 19 32 #[arg(long)] 20 - to_data_dir: PathBuf, 33 + concurrency: Option<usize>, 21 34 } 22 35 23 36 #[cfg(feature = "rocks")] 24 37 fn main() -> Result<()> { 25 - let args = Args::parse(); 26 - 27 - eprintln!( 28 - "restoring latest rocksdb backup from {:?} to {:?}...", 29 - args.from_backup_dir, args.to_data_dir 30 - ); 31 - 32 - let mut engine = BackupEngine::open( 33 - &BackupEngineOptions::new(args.from_backup_dir)?, 34 - &rocksdb::Env::new()?, 35 - )?; 38 + use tracing_subscriber::EnvFilter; 39 + tracing_subscriber::fmt() 40 + .with_env_filter( 41 + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")), 42 + ) 43 + .init(); 36 44 45 + let args = Args::parse(); 37 46 let t0 = Instant::now(); 38 - if let Err(e) = engine.restore_from_latest_backup( 39 - &args.to_data_dir, 40 - &args.to_data_dir, 41 - &RestoreOptions::default(), 42 - ) { 43 - eprintln!( 44 - "restoring from backup failed after {:?}: {e:?}", 45 - t0.elapsed() 47 + 48 + let result = if let Some(fs_dir) = args.fs_dir { 49 + info!( 50 + ?fs_dir, 51 + ?args.dest, 52 + backup = describe_backup(args.backup), 53 + mode = "rocksdb fs", 54 + "restoring rocksdb backup..." 46 55 ); 56 + restore_from_dir(&fs_dir, &args.dest, args.backup) 47 57 } else { 48 - eprintln!( 49 - "success, restored latest from backup after {:?}", 50 - t0.elapsed() 58 + info!( 59 + args.endpoint, 60 + args.prefix, 61 + ?args.dest, 62 + ?args.concurrency, 63 + backup = describe_backup(args.backup), 64 + mode = "eat-rocks object storage", 65 + "restoring rocksdb backup..." 51 66 ); 67 + restore_from_object_store( 68 + &args.endpoint, 69 + &args.prefix, 70 + &args.dest, 71 + args.backup, 72 + args.concurrency, 73 + ) 74 + }; 75 + 76 + match result { 77 + Ok(()) => info!( 78 + elapsed = ?t0.elapsed(), 79 + "backup restored." 80 + ), 81 + Err(err) => error!( 82 + ?err, 83 + elapsed = ?t0.elapsed(), 84 + "failed to restore backup." 85 + ), 52 86 } 87 + Ok(()) 88 + } 53 89 54 - eprintln!("bye."); 90 + fn describe_backup(backup: Option<u32>) -> String { 91 + match backup { 92 + Some(id) => format!("#{id}"), 93 + None => "(latest)".to_string(), 94 + } 95 + } 96 + 97 + #[cfg(feature = "rocks")] 98 + fn restore_from_dir( 99 + fs_dir: &std::path::Path, 100 + dest: &std::path::Path, 101 + backup_id: Option<u32>, 102 + ) -> Result<()> { 103 + let mut engine = BackupEngine::open(&BackupEngineOptions::new(fs_dir)?, &rocksdb::Env::new()?)?; 104 + let opts = RestoreOptions::default(); 105 + match backup_id { 106 + Some(id) => engine.restore_from_backup(dest, dest, &opts, id)?, 107 + None => engine.restore_from_latest_backup(dest, dest, &opts)?, 108 + } 109 + Ok(()) 110 + } 111 + 112 + #[cfg(feature = "rocks")] 113 + fn restore_from_object_store( 114 + endpoint: &str, 115 + prefix: &str, 116 + dest: &std::path::Path, 117 + backup_id: Option<u32>, 118 + concurrency: Option<usize>, 119 + ) -> Result<()> { 120 + use eat_rocks::{public_bucket, restore, RestoreOptions, TargetMode}; 121 + use tokio::runtime::Runtime; 122 + 123 + let rt = Runtime::new()?; 124 + rt.block_on(async { 125 + let store = public_bucket(endpoint)?; 126 + restore( 127 + store, 128 + prefix, 129 + dest, 130 + RestoreOptions { 131 + backup_id: backup_id.map(u64::from), 132 + concurrency: concurrency.unwrap_or(RestoreOptions::default().concurrency), 133 + target_mode: TargetMode::CreateOrReplace, 134 + ..Default::default() 135 + }, 136 + ) 137 + .await 138 + })?; 55 139 Ok(()) 56 140 }