+516
-68
Cargo.lock
+516
-68
Cargo.lock
···
24
24
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
25
25
dependencies = [
26
26
"cfg-if",
27
+
"getrandom 0.2.15",
27
28
"once_cell",
28
29
"version_check",
29
30
"zerocopy 0.7.35",
···
122
123
checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
123
124
124
125
[[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]]
125
132
name = "arrayvec"
126
133
version = "0.7.6"
127
134
source = "registry+https://github.com/rust-lang/crates.io-index"
···
155
162
"proc-macro2",
156
163
"quote",
157
164
"serde",
158
-
"syn",
165
+
"syn 2.0.103",
159
166
]
160
167
161
168
[[package]]
···
174
181
]
175
182
176
183
[[package]]
184
+
name = "async-channel"
185
+
version = "2.5.0"
186
+
source = "registry+https://github.com/rust-lang/crates.io-index"
187
+
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
188
+
dependencies = [
189
+
"concurrent-queue",
190
+
"event-listener-strategy",
191
+
"futures-core",
192
+
"pin-project-lite",
193
+
]
194
+
195
+
[[package]]
177
196
name = "async-compression"
178
197
version = "0.4.25"
179
198
source = "registry+https://github.com/rust-lang/crates.io-index"
···
216
235
dependencies = [
217
236
"proc-macro2",
218
237
"quote",
219
-
"syn",
238
+
"syn 2.0.103",
220
239
]
240
+
241
+
[[package]]
242
+
name = "async-task"
243
+
version = "4.7.1"
244
+
source = "registry+https://github.com/rust-lang/crates.io-index"
245
+
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
221
246
222
247
[[package]]
223
248
name = "async-trait"
···
227
252
dependencies = [
228
253
"proc-macro2",
229
254
"quote",
230
-
"syn",
255
+
"syn 2.0.103",
231
256
]
232
257
233
258
[[package]]
···
378
403
]
379
404
380
405
[[package]]
406
+
name = "auto_enums"
407
+
version = "0.8.7"
408
+
source = "registry+https://github.com/rust-lang/crates.io-index"
409
+
checksum = "9c170965892137a3a9aeb000b4524aa3cc022a310e709d848b6e1cdce4ab4781"
410
+
dependencies = [
411
+
"derive_utils",
412
+
"proc-macro2",
413
+
"quote",
414
+
"syn 2.0.103",
415
+
]
416
+
417
+
[[package]]
381
418
name = "autocfg"
382
419
version = "1.4.0"
383
420
source = "registry+https://github.com/rust-lang/crates.io-index"
···
613
650
"regex",
614
651
"rustc-hash 1.1.0",
615
652
"shlex",
616
-
"syn",
653
+
"syn 2.0.103",
617
654
"which",
618
655
]
619
656
···
632
669
"regex",
633
670
"rustc-hash 1.1.0",
634
671
"shlex",
635
-
"syn",
672
+
"syn 2.0.103",
636
673
]
637
674
638
675
[[package]]
···
650
687
"regex",
651
688
"rustc-hash 2.1.1",
652
689
"shlex",
653
-
"syn",
690
+
"syn 2.0.103",
654
691
]
655
692
656
693
[[package]]
···
813
850
814
851
[[package]]
815
852
name = "clap"
816
-
version = "4.5.40"
853
+
version = "4.5.41"
817
854
source = "registry+https://github.com/rust-lang/crates.io-index"
818
-
checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f"
855
+
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
819
856
dependencies = [
820
857
"clap_builder",
821
858
"clap_derive",
···
823
860
824
861
[[package]]
825
862
name = "clap_builder"
826
-
version = "4.5.40"
863
+
version = "4.5.41"
827
864
source = "registry+https://github.com/rust-lang/crates.io-index"
828
-
checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e"
865
+
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
829
866
dependencies = [
830
867
"anstream",
831
868
"anstyle",
832
869
"clap_lex",
833
-
"strsim",
870
+
"strsim 0.11.1",
834
871
]
835
872
836
873
[[package]]
837
874
name = "clap_derive"
838
-
version = "4.5.40"
875
+
version = "4.5.41"
839
876
source = "registry+https://github.com/rust-lang/crates.io-index"
840
-
checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce"
877
+
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
841
878
dependencies = [
842
879
"heck",
843
880
"proc-macro2",
844
881
"quote",
845
-
"syn",
882
+
"syn 2.0.103",
846
883
]
847
884
848
885
[[package]]
···
872
909
]
873
910
874
911
[[package]]
912
+
name = "cmsketch"
913
+
version = "0.2.2"
914
+
source = "registry+https://github.com/rust-lang/crates.io-index"
915
+
checksum = "553c840ee51da812c6cd621f9f7e07dfb00a49f91283a8e6380c78cba4f61aba"
916
+
dependencies = [
917
+
"paste",
918
+
]
919
+
920
+
[[package]]
875
921
name = "colorchoice"
876
922
version = "1.0.3"
877
923
source = "registry+https://github.com/rust-lang/crates.io-index"
···
911
957
"clap",
912
958
"ctrlc",
913
959
"flume",
914
-
"fs4",
960
+
"fs4 0.12.0",
915
961
"headers-accept",
916
962
"links",
917
963
"mediatype",
···
1076
1122
1077
1123
[[package]]
1078
1124
name = "darling"
1125
+
version = "0.14.4"
1126
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1127
+
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
1128
+
dependencies = [
1129
+
"darling_core 0.14.4",
1130
+
"darling_macro 0.14.4",
1131
+
]
1132
+
1133
+
[[package]]
1134
+
name = "darling"
1079
1135
version = "0.20.11"
1080
1136
source = "registry+https://github.com/rust-lang/crates.io-index"
1081
1137
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
1082
1138
dependencies = [
1083
-
"darling_core",
1084
-
"darling_macro",
1139
+
"darling_core 0.20.11",
1140
+
"darling_macro 0.20.11",
1141
+
]
1142
+
1143
+
[[package]]
1144
+
name = "darling_core"
1145
+
version = "0.14.4"
1146
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1147
+
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
1148
+
dependencies = [
1149
+
"fnv",
1150
+
"ident_case",
1151
+
"proc-macro2",
1152
+
"quote",
1153
+
"strsim 0.10.0",
1154
+
"syn 1.0.109",
1085
1155
]
1086
1156
1087
1157
[[package]]
···
1094
1164
"ident_case",
1095
1165
"proc-macro2",
1096
1166
"quote",
1097
-
"strsim",
1098
-
"syn",
1167
+
"strsim 0.11.1",
1168
+
"syn 2.0.103",
1169
+
]
1170
+
1171
+
[[package]]
1172
+
name = "darling_macro"
1173
+
version = "0.14.4"
1174
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1175
+
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
1176
+
dependencies = [
1177
+
"darling_core 0.14.4",
1178
+
"quote",
1179
+
"syn 1.0.109",
1099
1180
]
1100
1181
1101
1182
[[package]]
···
1104
1185
source = "registry+https://github.com/rust-lang/crates.io-index"
1105
1186
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
1106
1187
dependencies = [
1107
-
"darling_core",
1188
+
"darling_core 0.20.11",
1108
1189
"quote",
1109
-
"syn",
1190
+
"syn 2.0.103",
1110
1191
]
1111
1192
1112
1193
[[package]]
···
1146
1227
checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f"
1147
1228
dependencies = [
1148
1229
"data-encoding",
1149
-
"syn",
1230
+
"syn 2.0.103",
1150
1231
]
1151
1232
1152
1233
[[package]]
···
1191
1272
source = "registry+https://github.com/rust-lang/crates.io-index"
1192
1273
checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
1193
1274
dependencies = [
1194
-
"darling",
1275
+
"darling 0.20.11",
1195
1276
"proc-macro2",
1196
1277
"quote",
1197
-
"syn",
1278
+
"syn 2.0.103",
1198
1279
]
1199
1280
1200
1281
[[package]]
···
1204
1285
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
1205
1286
dependencies = [
1206
1287
"derive_builder_core",
1207
-
"syn",
1288
+
"syn 2.0.103",
1289
+
]
1290
+
1291
+
[[package]]
1292
+
name = "derive_utils"
1293
+
version = "0.15.0"
1294
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1295
+
checksum = "ccfae181bab5ab6c5478b2ccb69e4c68a02f8c3ec72f6616bfec9dbc599d2ee0"
1296
+
dependencies = [
1297
+
"proc-macro2",
1298
+
"quote",
1299
+
"syn 2.0.103",
1208
1300
]
1209
1301
1210
1302
[[package]]
···
1248
1340
dependencies = [
1249
1341
"proc-macro2",
1250
1342
"quote",
1251
-
"syn",
1343
+
"syn 2.0.103",
1252
1344
]
1253
1345
1254
1346
[[package]]
···
1258
1350
checksum = "c0d05e1c0dbad51b52c38bda7adceef61b9efc2baf04acfe8726a8c4630a6f57"
1259
1351
1260
1352
[[package]]
1353
+
name = "downcast-rs"
1354
+
version = "1.2.1"
1355
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1356
+
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
1357
+
1358
+
[[package]]
1261
1359
name = "dropshot"
1262
1360
version = "0.16.2"
1263
1361
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1319
1417
"semver",
1320
1418
"serde",
1321
1419
"serde_tokenstream",
1322
-
"syn",
1420
+
"syn 2.0.103",
1323
1421
]
1324
1422
1325
1423
[[package]]
···
1392
1490
"heck",
1393
1491
"proc-macro2",
1394
1492
"quote",
1395
-
"syn",
1493
+
"syn 2.0.103",
1396
1494
]
1397
1495
1398
1496
[[package]]
···
1404
1502
"once_cell",
1405
1503
"proc-macro2",
1406
1504
"quote",
1407
-
"syn",
1505
+
"syn 2.0.103",
1408
1506
]
1409
1507
1410
1508
[[package]]
···
1526
1624
source = "registry+https://github.com/rust-lang/crates.io-index"
1527
1625
checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095"
1528
1626
dependencies = [
1627
+
"futures-core",
1628
+
"futures-sink",
1629
+
"nanorand",
1529
1630
"spin",
1530
1631
]
1531
1632
···
1566
1667
]
1567
1668
1568
1669
[[package]]
1670
+
name = "foyer"
1671
+
version = "0.18.0"
1672
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1673
+
checksum = "0b4d8e96374206ff1b4265f2e2e6e1f80bc3048957b2a1e7fdeef929d68f318f"
1674
+
dependencies = [
1675
+
"equivalent",
1676
+
"foyer-common",
1677
+
"foyer-memory",
1678
+
"foyer-storage",
1679
+
"madsim-tokio",
1680
+
"mixtrics",
1681
+
"pin-project",
1682
+
"serde",
1683
+
"thiserror 2.0.12",
1684
+
"tokio",
1685
+
"tracing",
1686
+
]
1687
+
1688
+
[[package]]
1689
+
name = "foyer-common"
1690
+
version = "0.18.0"
1691
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1692
+
checksum = "911b8e3f23d5fe55b0b240f75af1d2fa5cb7261d3f9b38ef1c57bbc9f0449317"
1693
+
dependencies = [
1694
+
"bincode 1.3.3",
1695
+
"bytes",
1696
+
"cfg-if",
1697
+
"itertools 0.14.0",
1698
+
"madsim-tokio",
1699
+
"mixtrics",
1700
+
"parking_lot",
1701
+
"pin-project",
1702
+
"serde",
1703
+
"thiserror 2.0.12",
1704
+
"tokio",
1705
+
"twox-hash",
1706
+
]
1707
+
1708
+
[[package]]
1709
+
name = "foyer-intrusive-collections"
1710
+
version = "0.10.0-dev"
1711
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1712
+
checksum = "6e4fee46bea69e0596130e3210e65d3424e0ac1e6df3bde6636304bdf1ca4a3b"
1713
+
dependencies = [
1714
+
"memoffset",
1715
+
]
1716
+
1717
+
[[package]]
1718
+
name = "foyer-memory"
1719
+
version = "0.18.0"
1720
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1721
+
checksum = "506883d5a8500dea1b1662f7180f3534bdcbfa718d3253db7179552ef83612fa"
1722
+
dependencies = [
1723
+
"arc-swap",
1724
+
"bitflags",
1725
+
"cmsketch",
1726
+
"equivalent",
1727
+
"foyer-common",
1728
+
"foyer-intrusive-collections",
1729
+
"hashbrown 0.15.2",
1730
+
"itertools 0.14.0",
1731
+
"madsim-tokio",
1732
+
"mixtrics",
1733
+
"parking_lot",
1734
+
"pin-project",
1735
+
"serde",
1736
+
"thiserror 2.0.12",
1737
+
"tokio",
1738
+
"tracing",
1739
+
]
1740
+
1741
+
[[package]]
1742
+
name = "foyer-storage"
1743
+
version = "0.18.0"
1744
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1745
+
checksum = "1ba8403a54a2f2032fb647e49c442e5feeb33f3989f7024f1b178341a016f06d"
1746
+
dependencies = [
1747
+
"allocator-api2",
1748
+
"anyhow",
1749
+
"auto_enums",
1750
+
"bytes",
1751
+
"equivalent",
1752
+
"flume",
1753
+
"foyer-common",
1754
+
"foyer-memory",
1755
+
"fs4 0.13.1",
1756
+
"futures-core",
1757
+
"futures-util",
1758
+
"itertools 0.14.0",
1759
+
"libc",
1760
+
"lz4",
1761
+
"madsim-tokio",
1762
+
"ordered_hash_map",
1763
+
"parking_lot",
1764
+
"paste",
1765
+
"pin-project",
1766
+
"rand 0.9.1",
1767
+
"serde",
1768
+
"thiserror 2.0.12",
1769
+
"tokio",
1770
+
"tracing",
1771
+
"twox-hash",
1772
+
"zstd",
1773
+
]
1774
+
1775
+
[[package]]
1569
1776
name = "fs4"
1570
1777
version = "0.12.0"
1571
1778
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1576
1783
]
1577
1784
1578
1785
[[package]]
1786
+
name = "fs4"
1787
+
version = "0.13.1"
1788
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1789
+
checksum = "8640e34b88f7652208ce9e88b1a37a2ae95227d84abec377ccd3c5cfeb141ed4"
1790
+
dependencies = [
1791
+
"rustix 1.0.5",
1792
+
"windows-sys 0.59.0",
1793
+
]
1794
+
1795
+
[[package]]
1579
1796
name = "fs_extra"
1580
1797
version = "1.3.0"
1581
1798
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1637
1854
dependencies = [
1638
1855
"proc-macro2",
1639
1856
"quote",
1640
-
"syn",
1857
+
"syn 2.0.103",
1641
1858
]
1642
1859
1643
1860
[[package]]
···
1792
2009
1793
2010
[[package]]
1794
2011
name = "hashbrown"
2012
+
version = "0.13.2"
2013
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2014
+
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
2015
+
dependencies = [
2016
+
"ahash",
2017
+
]
2018
+
2019
+
[[package]]
2020
+
name = "hashbrown"
1795
2021
version = "0.14.5"
1796
2022
source = "registry+https://github.com/rust-lang/crates.io-index"
1797
2023
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
···
2073
2299
"libc",
2074
2300
"percent-encoding",
2075
2301
"pin-project-lite",
2076
-
"socket2",
2302
+
"socket2 0.5.9",
2077
2303
"system-configuration",
2078
2304
"tokio",
2079
2305
"tower-service",
···
2220
2446
dependencies = [
2221
2447
"proc-macro2",
2222
2448
"quote",
2223
-
"syn",
2449
+
"syn 2.0.103",
2224
2450
]
2225
2451
2226
2452
[[package]]
···
2282
2508
]
2283
2509
2284
2510
[[package]]
2511
+
name = "io-uring"
2512
+
version = "0.7.9"
2513
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2514
+
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
2515
+
dependencies = [
2516
+
"bitflags",
2517
+
"cfg-if",
2518
+
"libc",
2519
+
]
2520
+
2521
+
[[package]]
2285
2522
name = "ipconfig"
2286
2523
version = "0.3.2"
2287
2524
source = "registry+https://github.com/rust-lang/crates.io-index"
2288
2525
checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f"
2289
2526
dependencies = [
2290
-
"socket2",
2527
+
"socket2 0.5.9",
2291
2528
"widestring",
2292
2529
"windows-sys 0.48.0",
2293
2530
"winreg",
···
2356
2593
]
2357
2594
2358
2595
[[package]]
2596
+
name = "itertools"
2597
+
version = "0.14.0"
2598
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2599
+
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
2600
+
dependencies = [
2601
+
"either",
2602
+
]
2603
+
2604
+
[[package]]
2359
2605
name = "itoa"
2360
2606
version = "1.0.15"
2361
2607
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2403
2649
dependencies = [
2404
2650
"proc-macro2",
2405
2651
"quote",
2406
-
"syn",
2652
+
"syn 2.0.103",
2407
2653
]
2408
2654
2409
2655
[[package]]
···
2503
2749
2504
2750
[[package]]
2505
2751
name = "libc"
2506
-
version = "0.2.171"
2752
+
version = "0.2.174"
2507
2753
source = "registry+https://github.com/rust-lang/crates.io-index"
2508
-
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
2754
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
2509
2755
2510
2756
[[package]]
2511
2757
name = "libfuzzer-sys"
···
2672
2918
]
2673
2919
2674
2920
[[package]]
2921
+
name = "lz4"
2922
+
version = "1.28.1"
2923
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2924
+
checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4"
2925
+
dependencies = [
2926
+
"lz4-sys",
2927
+
]
2928
+
2929
+
[[package]]
2675
2930
name = "lz4-sys"
2676
2931
version = "1.11.1+lz4-1.10.0"
2677
2932
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2697
2952
]
2698
2953
2699
2954
[[package]]
2955
+
name = "madsim"
2956
+
version = "0.2.32"
2957
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2958
+
checksum = "db6694555643da293dfb89e33c2880a13b62711d64b6588bc7df6ce4110b27f1"
2959
+
dependencies = [
2960
+
"ahash",
2961
+
"async-channel",
2962
+
"async-stream",
2963
+
"async-task",
2964
+
"bincode 1.3.3",
2965
+
"bytes",
2966
+
"downcast-rs",
2967
+
"futures-util",
2968
+
"lazy_static",
2969
+
"libc",
2970
+
"madsim-macros",
2971
+
"naive-timer",
2972
+
"panic-message",
2973
+
"rand 0.8.5",
2974
+
"rand_xoshiro 0.6.0",
2975
+
"rustversion",
2976
+
"serde",
2977
+
"spin",
2978
+
"tokio",
2979
+
"tokio-util",
2980
+
"toml",
2981
+
"tracing",
2982
+
"tracing-subscriber",
2983
+
]
2984
+
2985
+
[[package]]
2986
+
name = "madsim-macros"
2987
+
version = "0.2.12"
2988
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2989
+
checksum = "f3d248e97b1a48826a12c3828d921e8548e714394bf17274dd0a93910dc946e1"
2990
+
dependencies = [
2991
+
"darling 0.14.4",
2992
+
"proc-macro2",
2993
+
"quote",
2994
+
"syn 1.0.109",
2995
+
]
2996
+
2997
+
[[package]]
2998
+
name = "madsim-tokio"
2999
+
version = "0.2.30"
3000
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3001
+
checksum = "7d3eb2acc57c82d21d699119b859e2df70a91dbdb84734885a1e72be83bdecb5"
3002
+
dependencies = [
3003
+
"madsim",
3004
+
"spin",
3005
+
"tokio",
3006
+
]
3007
+
3008
+
[[package]]
2700
3009
name = "match_cfg"
2701
3010
version = "0.1.0"
2702
3011
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2728
3037
version = "2.7.4"
2729
3038
source = "registry+https://github.com/rust-lang/crates.io-index"
2730
3039
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
3040
+
3041
+
[[package]]
3042
+
name = "memoffset"
3043
+
version = "0.9.1"
3044
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3045
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
3046
+
dependencies = [
3047
+
"autocfg",
3048
+
]
2731
3049
2732
3050
[[package]]
2733
3051
name = "metrics"
···
2871
3189
]
2872
3190
2873
3191
[[package]]
3192
+
name = "mixtrics"
3193
+
version = "0.2.0"
3194
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3195
+
checksum = "adbcddf5a90b959eea97ae505e0391f5c6dd411fbf546d43b9c59ad1c3bd4391"
3196
+
dependencies = [
3197
+
"itertools 0.14.0",
3198
+
"parking_lot",
3199
+
]
3200
+
3201
+
[[package]]
2874
3202
name = "moka"
2875
3203
version = "0.12.10"
2876
3204
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2932
3260
]
2933
3261
2934
3262
[[package]]
3263
+
name = "naive-timer"
3264
+
version = "0.2.0"
3265
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3266
+
checksum = "034a0ad7deebf0c2abcf2435950a6666c3c15ea9d8fad0c0f48efa8a7f843fed"
3267
+
3268
+
[[package]]
3269
+
name = "nanorand"
3270
+
version = "0.7.0"
3271
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3272
+
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
3273
+
dependencies = [
3274
+
"getrandom 0.2.15",
3275
+
]
3276
+
3277
+
[[package]]
2935
3278
name = "native-tls"
2936
3279
version = "0.2.14"
2937
3280
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3130
3473
dependencies = [
3131
3474
"proc-macro2",
3132
3475
"quote",
3133
-
"syn",
3476
+
"syn 2.0.103",
3134
3477
]
3135
3478
3136
3479
[[package]]
···
3162
3505
]
3163
3506
3164
3507
[[package]]
3508
+
name = "ordered_hash_map"
3509
+
version = "0.4.0"
3510
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3511
+
checksum = "ab0e5f22bf6dd04abd854a8874247813a8fa2c8c1260eba6fbb150270ce7c176"
3512
+
dependencies = [
3513
+
"hashbrown 0.13.2",
3514
+
]
3515
+
3516
+
[[package]]
3165
3517
name = "overload"
3166
3518
version = "0.1.1"
3167
3519
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3188
3540
"elliptic-curve",
3189
3541
"primeorder",
3190
3542
]
3543
+
3544
+
[[package]]
3545
+
name = "panic-message"
3546
+
version = "0.3.0"
3547
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3548
+
checksum = "384e52fd8fbd4cbe3c317e8216260c21a0f9134de108cea8a4dd4e7e152c472d"
3191
3549
3192
3550
[[package]]
3193
3551
name = "parking"
···
3298
3656
"pest_meta",
3299
3657
"proc-macro2",
3300
3658
"quote",
3301
-
"syn",
3659
+
"syn 2.0.103",
3302
3660
]
3303
3661
3304
3662
[[package]]
···
3312
3670
]
3313
3671
3314
3672
[[package]]
3673
+
name = "pin-project"
3674
+
version = "1.1.10"
3675
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3676
+
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
3677
+
dependencies = [
3678
+
"pin-project-internal",
3679
+
]
3680
+
3681
+
[[package]]
3682
+
name = "pin-project-internal"
3683
+
version = "1.1.10"
3684
+
source = "registry+https://github.com/rust-lang/crates.io-index"
3685
+
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
3686
+
dependencies = [
3687
+
"proc-macro2",
3688
+
"quote",
3689
+
"syn 2.0.103",
3690
+
]
3691
+
3692
+
[[package]]
3315
3693
name = "pin-project-lite"
3316
3694
version = "0.2.16"
3317
3695
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3387
3765
checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55"
3388
3766
dependencies = [
3389
3767
"proc-macro2",
3390
-
"syn",
3768
+
"syn 2.0.103",
3391
3769
]
3392
3770
3393
3771
[[package]]
···
3604
3982
dependencies = [
3605
3983
"proc-macro2",
3606
3984
"quote",
3607
-
"syn",
3985
+
"syn 2.0.103",
3608
3986
]
3609
3987
3610
3988
[[package]]
···
3947
4325
"proc-macro2",
3948
4326
"quote",
3949
4327
"serde_derive_internals",
3950
-
"syn",
4328
+
"syn 2.0.103",
3951
4329
]
3952
4330
3953
4331
[[package]]
···
4050
4428
dependencies = [
4051
4429
"proc-macro2",
4052
4430
"quote",
4053
-
"syn",
4431
+
"syn 2.0.103",
4054
4432
]
4055
4433
4056
4434
[[package]]
···
4061
4439
dependencies = [
4062
4440
"proc-macro2",
4063
4441
"quote",
4064
-
"syn",
4442
+
"syn 2.0.103",
4065
4443
]
4066
4444
4067
4445
[[package]]
···
4079
4457
4080
4458
[[package]]
4081
4459
name = "serde_json"
4082
-
version = "1.0.140"
4460
+
version = "1.0.141"
4083
4461
source = "registry+https://github.com/rust-lang/crates.io-index"
4084
-
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
4462
+
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
4085
4463
dependencies = [
4086
4464
"itoa",
4087
4465
"memchr",
···
4130
4508
"proc-macro2",
4131
4509
"quote",
4132
4510
"serde",
4133
-
"syn",
4511
+
"syn 2.0.103",
4134
4512
]
4135
4513
4136
4514
[[package]]
···
4169
4547
source = "registry+https://github.com/rust-lang/crates.io-index"
4170
4548
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
4171
4549
dependencies = [
4172
-
"darling",
4550
+
"darling 0.20.11",
4173
4551
"proc-macro2",
4174
4552
"quote",
4175
-
"syn",
4553
+
"syn 2.0.103",
4176
4554
]
4177
4555
4178
4556
[[package]]
···
4259
4637
]
4260
4638
4261
4639
[[package]]
4640
+
name = "slingshot"
4641
+
version = "0.1.0"
4642
+
dependencies = [
4643
+
"axum",
4644
+
"clap",
4645
+
"ctrlc",
4646
+
"env_logger",
4647
+
"foyer",
4648
+
"jetstream",
4649
+
"log",
4650
+
"metrics",
4651
+
"metrics-exporter-prometheus 0.17.2",
4652
+
"serde",
4653
+
"serde_json",
4654
+
"thiserror 2.0.12",
4655
+
"tokio",
4656
+
"tokio-util",
4657
+
]
4658
+
4659
+
[[package]]
4262
4660
name = "slog"
4263
4661
version = "2.7.0"
4264
4662
source = "registry+https://github.com/rust-lang/crates.io-index"
···
4330
4728
]
4331
4729
4332
4730
[[package]]
4731
+
name = "socket2"
4732
+
version = "0.6.0"
4733
+
source = "registry+https://github.com/rust-lang/crates.io-index"
4734
+
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
4735
+
dependencies = [
4736
+
"libc",
4737
+
"windows-sys 0.59.0",
4738
+
]
4739
+
4740
+
[[package]]
4333
4741
name = "spacedust"
4334
4742
version = "0.1.0"
4335
4743
dependencies = [
···
4391
4799
4392
4800
[[package]]
4393
4801
name = "strsim"
4802
+
version = "0.10.0"
4803
+
source = "registry+https://github.com/rust-lang/crates.io-index"
4804
+
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
4805
+
4806
+
[[package]]
4807
+
name = "strsim"
4394
4808
version = "0.11.1"
4395
4809
source = "registry+https://github.com/rust-lang/crates.io-index"
4396
4810
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
···
4403
4817
4404
4818
[[package]]
4405
4819
name = "syn"
4820
+
version = "1.0.109"
4821
+
source = "registry+https://github.com/rust-lang/crates.io-index"
4822
+
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
4823
+
dependencies = [
4824
+
"proc-macro2",
4825
+
"quote",
4826
+
"unicode-ident",
4827
+
]
4828
+
4829
+
[[package]]
4830
+
name = "syn"
4406
4831
version = "2.0.103"
4407
4832
source = "registry+https://github.com/rust-lang/crates.io-index"
4408
4833
checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8"
···
4429
4854
dependencies = [
4430
4855
"proc-macro2",
4431
4856
"quote",
4432
-
"syn",
4857
+
"syn 2.0.103",
4433
4858
]
4434
4859
4435
4860
[[package]]
···
4515
4940
dependencies = [
4516
4941
"proc-macro2",
4517
4942
"quote",
4518
-
"syn",
4943
+
"syn 2.0.103",
4519
4944
]
4520
4945
4521
4946
[[package]]
···
4526
4951
dependencies = [
4527
4952
"proc-macro2",
4528
4953
"quote",
4529
-
"syn",
4954
+
"syn 2.0.103",
4530
4955
]
4531
4956
4532
4957
[[package]]
···
4625
5050
4626
5051
[[package]]
4627
5052
name = "tokio"
4628
-
version = "1.45.1"
5053
+
version = "1.47.0"
4629
5054
source = "registry+https://github.com/rust-lang/crates.io-index"
4630
-
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
5055
+
checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35"
4631
5056
dependencies = [
4632
5057
"backtrace",
4633
5058
"bytes",
5059
+
"io-uring",
4634
5060
"libc",
4635
5061
"mio",
4636
5062
"parking_lot",
4637
5063
"pin-project-lite",
4638
5064
"signal-hook-registry",
4639
-
"socket2",
5065
+
"slab",
5066
+
"socket2 0.6.0",
4640
5067
"tokio-macros",
4641
-
"windows-sys 0.52.0",
5068
+
"windows-sys 0.59.0",
4642
5069
]
4643
5070
4644
5071
[[package]]
···
4649
5076
dependencies = [
4650
5077
"proc-macro2",
4651
5078
"quote",
4652
-
"syn",
5079
+
"syn 2.0.103",
4653
5080
]
4654
5081
4655
5082
[[package]]
···
4817
5244
dependencies = [
4818
5245
"log",
4819
5246
"pin-project-lite",
5247
+
"tracing-attributes",
4820
5248
"tracing-core",
4821
5249
]
4822
5250
4823
5251
[[package]]
5252
+
name = "tracing-attributes"
5253
+
version = "0.1.30"
5254
+
source = "registry+https://github.com/rust-lang/crates.io-index"
5255
+
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
5256
+
dependencies = [
5257
+
"proc-macro2",
5258
+
"quote",
5259
+
"syn 2.0.103",
5260
+
]
5261
+
5262
+
[[package]]
4824
5263
name = "tracing-core"
4825
5264
version = "0.1.33"
4826
5265
source = "registry+https://github.com/rust-lang/crates.io-index"
···
4867
5306
dependencies = [
4868
5307
"proc-macro2",
4869
5308
"quote",
4870
-
"syn",
5309
+
"syn 2.0.103",
4871
5310
]
4872
5311
4873
5312
[[package]]
···
4910
5349
"sha1",
4911
5350
"thiserror 2.0.12",
4912
5351
"utf-8",
5352
+
]
5353
+
5354
+
[[package]]
5355
+
name = "twox-hash"
5356
+
version = "2.1.1"
5357
+
source = "registry+https://github.com/rust-lang/crates.io-index"
5358
+
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
5359
+
dependencies = [
5360
+
"rand 0.9.1",
4913
5361
]
4914
5362
4915
5363
[[package]]
···
5157
5605
"log",
5158
5606
"proc-macro2",
5159
5607
"quote",
5160
-
"syn",
5608
+
"syn 2.0.103",
5161
5609
"wasm-bindgen-shared",
5162
5610
]
5163
5611
···
5192
5640
dependencies = [
5193
5641
"proc-macro2",
5194
5642
"quote",
5195
-
"syn",
5643
+
"syn 2.0.103",
5196
5644
"wasm-bindgen-backend",
5197
5645
"wasm-bindgen-shared",
5198
5646
]
···
5352
5800
dependencies = [
5353
5801
"proc-macro2",
5354
5802
"quote",
5355
-
"syn",
5803
+
"syn 2.0.103",
5356
5804
]
5357
5805
5358
5806
[[package]]
···
5363
5811
dependencies = [
5364
5812
"proc-macro2",
5365
5813
"quote",
5366
-
"syn",
5814
+
"syn 2.0.103",
5367
5815
]
5368
5816
5369
5817
[[package]]
···
5374
5822
dependencies = [
5375
5823
"proc-macro2",
5376
5824
"quote",
5377
-
"syn",
5825
+
"syn 2.0.103",
5378
5826
]
5379
5827
5380
5828
[[package]]
···
5385
5833
dependencies = [
5386
5834
"proc-macro2",
5387
5835
"quote",
5388
-
"syn",
5836
+
"syn 2.0.103",
5389
5837
]
5390
5838
5391
5839
[[package]]
···
5665
6113
dependencies = [
5666
6114
"proc-macro2",
5667
6115
"quote",
5668
-
"syn",
6116
+
"syn 2.0.103",
5669
6117
"synstructure",
5670
6118
]
5671
6119
···
5695
6143
dependencies = [
5696
6144
"proc-macro2",
5697
6145
"quote",
5698
-
"syn",
6146
+
"syn 2.0.103",
5699
6147
]
5700
6148
5701
6149
[[package]]
···
5706
6154
dependencies = [
5707
6155
"proc-macro2",
5708
6156
"quote",
5709
-
"syn",
6157
+
"syn 2.0.103",
5710
6158
]
5711
6159
5712
6160
[[package]]
···
5726
6174
dependencies = [
5727
6175
"proc-macro2",
5728
6176
"quote",
5729
-
"syn",
6177
+
"syn 2.0.103",
5730
6178
"synstructure",
5731
6179
]
5732
6180
···
5758
6206
dependencies = [
5759
6207
"proc-macro2",
5760
6208
"quote",
5761
-
"syn",
6209
+
"syn 2.0.103",
5762
6210
]
5763
6211
5764
6212
[[package]]
+1
slingshot/.gitignore
+1
slingshot/.gitignore
···
1
+
foyer
+19
slingshot/Cargo.toml
+19
slingshot/Cargo.toml
···
1
+
[package]
2
+
name = "slingshot"
3
+
version = "0.1.0"
4
+
edition = "2024"
5
+
6
+
[dependencies]
7
+
clap = { version = "4.5.41", features = ["derive"] }
8
+
ctrlc = "3.4.7"
9
+
env_logger = "0.11.8"
10
+
foyer = { version = "0.18.0", features = ["serde"] }
11
+
jetstream = { path = "../jetstream", features = ["metrics"] }
12
+
log = "0.4.27"
13
+
metrics = "0.24.2"
14
+
metrics-exporter-prometheus = { version = "0.17.1", features = ["http-listener"] }
15
+
serde = { version = "1.0.219", features = ["derive"] }
16
+
serde_json = { version = "1.0.141", features = ["raw_value"] }
17
+
thiserror = "2.0.12"
18
+
tokio = { version = "1.47.0", features = ["full"] }
19
+
tokio-util = "0.7.15"
+76
slingshot/src/consumer.rs
+76
slingshot/src/consumer.rs
···
1
+
use crate::CachedRecord;
2
+
use foyer::HybridCache;
3
+
use crate::error::ConsumerError;
4
+
use jetstream::{
5
+
DefaultJetstreamEndpoints, JetstreamCompression, JetstreamConfig, JetstreamConnector,
6
+
events::{CommitOp, Cursor, EventKind},
7
+
};
8
+
use tokio_util::sync::CancellationToken;
9
+
10
+
pub async fn consume(
11
+
jetstream_endpoint: String,
12
+
cursor: Option<Cursor>,
13
+
no_zstd: bool,
14
+
shutdown: CancellationToken,
15
+
cache: HybridCache<String, CachedRecord>,
16
+
) -> Result<(), ConsumerError> {
17
+
let endpoint = DefaultJetstreamEndpoints::endpoint_or_shortcut(&jetstream_endpoint);
18
+
if endpoint == jetstream_endpoint {
19
+
log::info!("consumer: connecting jetstream at {endpoint}");
20
+
} else {
21
+
log::info!("consumer: connecting jetstream at {jetstream_endpoint} => {endpoint}");
22
+
}
23
+
let config: JetstreamConfig = JetstreamConfig {
24
+
endpoint,
25
+
compression: if no_zstd {
26
+
JetstreamCompression::None
27
+
} else {
28
+
JetstreamCompression::Zstd
29
+
},
30
+
replay_on_reconnect: true,
31
+
channel_size: 1024, // buffer up to ~1s of jetstream events
32
+
..Default::default()
33
+
};
34
+
let mut receiver = JetstreamConnector::new(config)?
35
+
.connect_cursor(cursor)
36
+
.await?;
37
+
38
+
log::info!("consumer: receiving messages..");
39
+
loop {
40
+
if shutdown.is_cancelled() {
41
+
log::info!("consumer: exiting for shutdown");
42
+
return Ok(());
43
+
}
44
+
let Some(mut event) = receiver.recv().await else {
45
+
log::error!("consumer: could not receive event, bailing");
46
+
break;
47
+
};
48
+
49
+
if event.kind != EventKind::Commit {
50
+
continue;
51
+
}
52
+
let Some(ref mut commit) = event.commit else {
53
+
log::warn!("consumer: commit event missing commit data, ignoring");
54
+
continue;
55
+
};
56
+
57
+
// TODO: something a bit more robust
58
+
let at_uri = format!(
59
+
"at://{}/{}/{}",
60
+
&*event.did, &*commit.collection, &*commit.rkey
61
+
);
62
+
63
+
if commit.operation == CommitOp::Delete {
64
+
cache.insert(at_uri, CachedRecord::Deleted);
65
+
} else {
66
+
let Some(record) = commit.record.take() else {
67
+
log::warn!("consumer: commit update/delete missing record, ignoring");
68
+
continue;
69
+
};
70
+
71
+
cache.insert(at_uri, CachedRecord::Found(record.into()));
72
+
}
73
+
}
74
+
75
+
Err(ConsumerError::JetstreamEnded)
76
+
}
+21
slingshot/src/error.rs
+21
slingshot/src/error.rs
···
1
+
use thiserror::Error;
2
+
3
+
#[derive(Debug, Error)]
4
+
pub enum ConsumerError {
5
+
#[error(transparent)]
6
+
JetstreamConnectionError(#[from] jetstream::error::ConnectionError),
7
+
#[error(transparent)]
8
+
JetstreamConfigValidationError(#[from] jetstream::error::ConfigValidationError),
9
+
#[error("jetstream ended")]
10
+
JetstreamEnded,
11
+
#[error("delay queue output dropped")]
12
+
DelayQueueOutputDropped,
13
+
}
14
+
15
+
#[derive(Debug, Error)]
16
+
pub enum MainTaskError {
17
+
#[error(transparent)]
18
+
ConsumerTaskError(#[from] ConsumerError),
19
+
// #[error(transparent)]
20
+
// ServerTaskError(#[from] ServerError),
21
+
}
+17
slingshot/src/firehose_cache.rs
+17
slingshot/src/firehose_cache.rs
···
1
+
use std::path::Path;
2
+
use crate::CachedRecord;
3
+
use foyer::{HybridCache, DirectFsDeviceOptions, Engine, HybridCacheBuilder};
4
+
5
+
6
+
pub async fn firehose_cache(dir: impl AsRef<Path>) -> Result<HybridCache<String, CachedRecord>, String> {
7
+
let cache = HybridCacheBuilder::new()
8
+
.with_name("firehose")
9
+
.memory(64 * 2_usize.pow(20))
10
+
.with_weighter(|k: &String, v| k.len() + std::mem::size_of_val(v))
11
+
.storage(Engine::large())
12
+
.with_device_options(DirectFsDeviceOptions::new(dir))
13
+
.build()
14
+
.await
15
+
.map_err(|e| format!("foyer setup error: {e:?}"))?;
16
+
Ok(cache)
17
+
}
+8
slingshot/src/lib.rs
+8
slingshot/src/lib.rs
+107
slingshot/src/main.rs
+107
slingshot/src/main.rs
···
1
+
// use foyer::HybridCache;
2
+
// use foyer::{Engine, DirectFsDeviceOptions, HybridCacheBuilder};
3
+
use metrics_exporter_prometheus::PrometheusBuilder;
4
+
use slingshot::{consume, error::MainTaskError, firehose_cache};
5
+
6
+
use clap::Parser;
7
+
use tokio_util::sync::CancellationToken;
8
+
9
+
10
+
/// Slingshot record edge cache
11
+
#[derive(Parser, Debug, Clone)]
12
+
#[command(version, about, long_about = None)]
13
+
struct Args {
14
+
/// Jetstream server to connect to (exclusive with --fixture). Provide either a wss:// URL, or a shorhand value:
15
+
/// 'us-east-1', 'us-east-2', 'us-west-1', or 'us-west-2'
16
+
#[arg(long)]
17
+
jetstream: String,
18
+
/// don't request zstd-compressed jetstream events
19
+
///
20
+
/// reduces CPU at the expense of more ingress bandwidth
21
+
#[arg(long, action)]
22
+
jetstream_no_zstd: bool,
23
+
}
24
+
25
+
#[tokio::main]
26
+
async fn main() -> Result<(), String> {
27
+
env_logger::init();
28
+
29
+
let shutdown = CancellationToken::new();
30
+
31
+
let ctrlc_shutdown = shutdown.clone();
32
+
ctrlc::set_handler(move || ctrlc_shutdown.cancel()).expect("failed to set ctrl-c handler");
33
+
34
+
let args = Args::parse();
35
+
36
+
if let Err(e) = install_metrics_server() {
37
+
log::error!("failed to install metrics server: {e:?}");
38
+
} else {
39
+
log::info!("metrics listening at http://0.0.0.0:8765");
40
+
}
41
+
42
+
log::info!("setting up firehose cache...");
43
+
let cache = firehose_cache("./foyer").await?;
44
+
log::info!("firehose cache ready.");
45
+
46
+
let mut tasks: tokio::task::JoinSet<Result<(), MainTaskError>> = tokio::task::JoinSet::new();
47
+
48
+
let consumer_shutdown = shutdown.clone();
49
+
tasks.spawn(async move {
50
+
consume(
51
+
args.jetstream,
52
+
None,
53
+
args.jetstream_no_zstd,
54
+
consumer_shutdown,
55
+
cache,
56
+
)
57
+
.await?;
58
+
Ok(())
59
+
});
60
+
61
+
62
+
tokio::select! {
63
+
_ = shutdown.cancelled() => log::warn!("shutdown requested"),
64
+
Some(r) = tasks.join_next() => {
65
+
log::warn!("a task exited, shutting down: {r:?}");
66
+
shutdown.cancel();
67
+
}
68
+
}
69
+
70
+
tokio::select! {
71
+
_ = async {
72
+
while let Some(completed) = tasks.join_next().await {
73
+
log::info!("shutdown: task completed: {completed:?}");
74
+
}
75
+
} => {},
76
+
_ = tokio::time::sleep(std::time::Duration::from_secs(3)) => {
77
+
log::info!("shutdown: not all tasks completed on time. aborting...");
78
+
tasks.shutdown().await;
79
+
},
80
+
}
81
+
82
+
log::info!("bye!");
83
+
84
+
Ok(())
85
+
}
86
+
87
+
fn install_metrics_server() -> Result<(), metrics_exporter_prometheus::BuildError> {
88
+
log::info!("installing metrics server...");
89
+
let host = [0, 0, 0, 0];
90
+
let port = 8765;
91
+
PrometheusBuilder::new()
92
+
.set_quantiles(&[0.5, 0.9, 0.99, 1.0])?
93
+
.set_bucket_duration(std::time::Duration::from_secs(300))?
94
+
.set_bucket_count(std::num::NonZero::new(12).unwrap()) // count * duration = 60 mins. stuff doesn't happen that fast here.
95
+
.set_enable_unit_suffix(false) // this seemed buggy for constellation (sometimes wouldn't engage)
96
+
.with_http_listener((host, port))
97
+
.install()?;
98
+
log::info!(
99
+
"metrics server installed! listening on http://{}.{}.{}.{}:{port}",
100
+
host[0],
101
+
host[1],
102
+
host[2],
103
+
host[3]
104
+
);
105
+
Ok(())
106
+
}
107
+
+24
slingshot/src/record.rs
+24
slingshot/src/record.rs
···
1
+
use serde_json::value::RawValue;
2
+
use serde::{Serialize, Deserialize};
3
+
4
+
#[derive(Debug, Serialize, Deserialize)]
5
+
pub struct RawRecord(String);
6
+
7
+
impl From<Box<RawValue>> for RawRecord {
8
+
fn from(rv: Box<RawValue>) -> Self {
9
+
Self(rv.get().to_string())
10
+
}
11
+
}
12
+
13
+
/// only for use with stored (validated) values, not general strings
14
+
impl From<RawRecord> for Box<RawValue> {
15
+
fn from(RawRecord(s): RawRecord) -> Self {
16
+
RawValue::from_string(s).expect("stored string from RawValue to be valid")
17
+
}
18
+
}
19
+
20
+
#[derive(Debug, Serialize, Deserialize)]
21
+
pub enum CachedRecord {
22
+
Found(RawRecord),
23
+
Deleted,
24
+
}