diff --git a/Cargo.lock b/Cargo.lock index 20771a4023..397923ae12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,6 +172,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + [[package]] name = "async-nats" version = "0.33.0" @@ -312,6 +321,17 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "auth-api-client" version = "0.1.0" @@ -681,6 +701,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bytecount" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" + [[package]] name = "byteorder" version = "1.5.0" @@ -715,6 +741,43 @@ dependencies = [ "tracing", ] +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.83" @@ -775,7 +838,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", - "half", + "half 2.3.1", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags 1.3.2", + "textwrap", + "unicode-width", ] [[package]] @@ -1075,7 +1149,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" name = "council" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "council-server", "si-std", @@ -1136,6 +1210,44 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +dependencies = [ + "atty", + "cast", + "clap 2.34.0", + "criterion-plot", + "csv", + "futures", + "itertools 0.10.5", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "tokio", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +dependencies = [ + "cast", + "itertools 0.10.5", +] + [[package]] name = "critical-section" version = "1.1.2" @@ -1195,7 +1307,7 @@ dependencies = [ "crossterm_winapi", "libc", "mio", - "parking_lot", + "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", "winapi", @@ -1210,7 +1322,7 @@ dependencies = [ "bitflags 2.4.2", "crossterm_winapi", "libc", - "parking_lot", + "parking_lot 0.12.1", "winapi", ] @@ -1251,6 +1363,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + [[package]] name = "ct-codecs" version = "1.1.1" @@ -1288,7 +1421,7 @@ dependencies = [ name = "cyclone" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "cyclone-server", "telemetry-application", @@ -1939,6 +2072,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "etcetera" version = "0.8.0" @@ -2011,7 +2153,7 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "windows-sys 0.52.0", ] @@ -2063,6 +2205,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "funty" version = "2.0.0" @@ -2119,7 +2271,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.12.1", ] [[package]] @@ -2194,6 +2346,15 @@ dependencies = [ "pin-project 0.4.30", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2286,6 +2447,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "half" version = "2.3.1" @@ -2362,6 +2529,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.6" @@ -2816,7 +2992,7 @@ checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ "bitflags 2.4.2", "libc", - "redox_syscall", + "redox_syscall 0.4.1", ] [[package]] @@ -2984,7 +3160,7 @@ dependencies = [ name = "module-index" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "module-index-server", "si-std", @@ -3047,6 +3223,30 @@ dependencies = [ "url", ] +[[package]] +name = "moka" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1911e88d5831f748a4097a43862d129e3c6fca831eecac9b8db6d01d93c9de2" +dependencies = [ + "async-lock", + "async-trait", + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "futures-util", + "once_cell", + "parking_lot 0.12.1", + "quanta", + "rustc_version", + "skeptic", + "smallvec", + "tagptr", + "thiserror", + "triomphe", + "uuid", +] + [[package]] name = "multer" version = "2.1.0" @@ -3289,7 +3489,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.6", "libc", ] @@ -3332,6 +3532,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "open" version = "5.0.1" @@ -3561,6 +3767,17 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -3568,7 +3785,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -3579,7 +3810,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -3707,7 +3938,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "pinga" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "pinga-server", "si-std", @@ -3777,6 +4008,34 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "podman-api" version = "0.10.0" @@ -4015,6 +4274,32 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" +dependencies = [ + "bitflags 2.4.2", + "memchr", + "unicase", +] + +[[package]] +name = "quanta" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + [[package]] name = "quick-xml" version = "0.30.0" @@ -4111,11 +4396,40 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.4.2", +] + +[[package]] +name = "rayon" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "rebaser" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "rebaser-server", "telemetry-application", @@ -4175,6 +4489,15 @@ dependencies = [ "veritech-client", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -4643,7 +4966,7 @@ dependencies = [ name = "sdf" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "nats-multiplexer", "rebaser-client", @@ -4858,6 +5181,9 @@ name = "semver" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +dependencies = [ + "serde", +] [[package]] name = "serde" @@ -4879,6 +5205,16 @@ dependencies = [ "serde_json", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half 1.8.3", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.196" @@ -5069,7 +5405,7 @@ dependencies = [ name = "si" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "derive_builder", "serde_json", @@ -5196,6 +5532,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "si-layer-cache" +version = "0.1.0" +dependencies = [ + "criterion", + "lazy_static", + "moka", + "serde", + "sled", + "tempfile", + "thiserror", + "tokio", +] + [[package]] name = "si-pkg" version = "0.1.0" @@ -5339,6 +5689,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ac45299ccbd390721be55b412d41931911f654fa99e2cb8bfb57184b2061fe" +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.9" @@ -5348,6 +5713,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "sled" +version = "0.34.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +dependencies = [ + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot 0.11.2", +] + [[package]] name = "smallstr" version = "0.3.0" @@ -5788,6 +6169,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tap" version = "1.0.1" @@ -5909,6 +6296,15 @@ dependencies = [ "syn 2.0.49", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.57" @@ -5979,6 +6375,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -6005,7 +6411,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", @@ -6047,7 +6453,7 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot", + "parking_lot 0.12.1", "percent-encoding", "phf", "pin-project-lite", @@ -6450,6 +6856,12 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "triomphe" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" + [[package]] name = "try-lock" version = "0.2.5" @@ -6621,7 +7033,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" name = "veritech" version = "0.1.0" dependencies = [ - "clap", + "clap 4.5.1", "color-eyre", "si-std", "telemetry-application", diff --git a/Cargo.toml b/Cargo.toml index 2dc4522146..3306b143cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ members = [ "lib/si-data-nats", "lib/si-data-pg", "lib/si-hash", + "lib/si-layer-cache", "lib/si-pkg", "lib/si-posthog-rs", "lib/si-settings", @@ -81,6 +82,7 @@ comfy-table = { version = "7.0.1", features = [ config = { version = "0.13.4", default-features = false, features = ["toml"] } console = "0.15.7" convert_case = "0.6.0" +criterion = { version = "0.3", features = [ "async_tokio" ] } crossbeam-channel = "0.5.8" deadpool = { version = "0.10.0", features = ["rt_tokio_1"] } deadpool-postgres = "0.12.1" @@ -114,6 +116,7 @@ jwt-simple = { version = "0.12.6", default-features = false, features = [ "pure-rust", ] } lazy_static = "1.4.0" +moka = { version = "0.12.5", features = [ "future" ] } names = { version = "0.14.0", default-features = false } nix = { version = "0.27.1", features = ["process", "signal"] } nkeys = "0.4.0" @@ -164,6 +167,7 @@ serde_json = { version = "1.0.96", features = ["preserve_order"] } serde_url_params = "0.2.1" serde_with = "3.0.0" serde_yaml = "0.9.21" +sled = "0.34.7" sodiumoxide = "0.2.7" stream-cancel = "0.8.1" strum = { version = "0.25.0", features = ["derive"] } diff --git a/lib/si-layer-cache/BUCK b/lib/si-layer-cache/BUCK new file mode 100644 index 0000000000..b53b3c0819 --- /dev/null +++ b/lib/si-layer-cache/BUCK @@ -0,0 +1,32 @@ +load("@prelude-si//:macros.bzl", "rust_library") + +rust_library( + name = "si-layer-cache", + deps = [ + "//third-party/rust:serde", + "//third-party/rust:thiserror", + "//third-party/rust:moka", + "//third-party/rust:sled", + "//third-party/rust:lazy_static", + ], + srcs = glob([ + "src/**/*.rs", + ]), +) + +rust_test( + name = "test-integration", + deps = [ + ":si-layer-cache", + "//third-party/rust:tokio", + "//third-party/rust:tempfile", + "//third-party/rust:criterion", + ], + srcs = glob([ + "tests/**/*.rs", + ]), + crate_root = "tests/integration.rs", + env = { + "CARGO_PKG_NAME": "integration", + }, +) diff --git a/lib/si-layer-cache/Cargo.toml b/lib/si-layer-cache/Cargo.toml new file mode 100644 index 0000000000..eb6a116cdb --- /dev/null +++ b/lib/si-layer-cache/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "si-layer-cache" +version = "0.1.0" +edition = "2021" +rust-version = "1.64" +publish = false + +[dependencies] +serde = { workspace = true } +thiserror = { workspace = true } +moka = { workspace = true } +sled = { workspace = true } +lazy_static = { workspace = true } + +[dev_dependencies] +tokio = { workspace = true } +tempfile = { workspace = true } +criterion = { workspace = true } + +[[bench]] +name = "insert_speed" +harness = false diff --git a/lib/si-layer-cache/benches/insert_speed.rs b/lib/si-layer-cache/benches/insert_speed.rs new file mode 100644 index 0000000000..79c1133272 --- /dev/null +++ b/lib/si-layer-cache/benches/insert_speed.rs @@ -0,0 +1,88 @@ +use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use si_layer_cache::{CacheType, LayerCache}; + +use tokio::runtime; + +const ASCII_LOWER: [u8; 26] = [ + b'a', b'b', b'c', b'd', b'e', b'f', b'g', b'h', b'i', b'j', b'k', b'l', b'm', b'n', b'o', b'p', + b'q', b'r', b's', b't', b'u', b'v', b'w', b'x', b'y', b'z', +]; + +const ONE_MB: usize = 1_000_000; + +pub async fn fresh_cache_count(objects: &[Vec], count: usize) { + let tempdir = tempfile::TempDir::new_in("/home/adam/benches").expect("cannotc reate tempdir"); + let layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); + for i in 0..count { + layer_cache + .insert(&CacheType::Object, [ASCII_LOWER[i]], objects[i].clone()) + .await + .expect("cannot insert into cache"); + } +} + +pub fn insert_speed_1_mb_object(c: &mut Criterion) { + let rt = runtime::Builder::new_multi_thread() + .build() + .expect("cannot make tokio runtime"); + let mut objects: Vec> = Vec::with_capacity(ASCII_LOWER.len()); + for letter in ASCII_LOWER.iter() { + let object = vec![*letter;ONE_MB]; + objects.push(object); + } + + c.bench_function("Cold Cache insert speed 1 1mb object", |b| { + b.to_async(&rt) + .iter(|| fresh_cache_count(black_box(&objects[..]), 1)) + }); + + c.bench_function("Cold Cache insert speed 26 1mb objects", |b| { + b.to_async(&rt) + .iter(|| fresh_cache_count(black_box(&objects[..]), ASCII_LOWER.len())) + }); +} + +pub fn hot_read_1_mb_object(c: &mut Criterion) { + let layer_cache = LayerCache::new("/home/adam/benches/.hot_read_1_mb_object") + .expect("cannot create layer cache"); + let rt = runtime::Builder::new_multi_thread() + .build() + .expect("cannot make tokio runtime"); + let object = vec![b'a';ONE_MB]; + let _r = rt.block_on(layer_cache.insert(&CacheType::Object, b"a", object)); + + c.bench_function("Hot Cache speed get one 1mb object", |b| { + b.to_async(&rt) + .iter(|| layer_cache.get(&CacheType::Object, [b'a'])) + }); +} + +pub async fn do_cold_memory_hot_disk(key: &[u8], layer_cache: &LayerCache) { + let _r = layer_cache.get(&CacheType::Object, key).await; + layer_cache.memory_cache.object_cache.remove(key).await; +} + +pub fn hot_disk_cold_memory_read_1_mb_object(c: &mut Criterion) { + let layer_cache = LayerCache::new("/home/adam/benches/.disk_cache_no_memory_1_mb_object") + .expect("cannot create layer cache"); + let rt = runtime::Builder::new_multi_thread() + .build() + .expect("cannot make tokio runtime"); + let letter = b'a'; + let object = vec![letter;ONE_MB]; + let _r = rt.block_on(layer_cache.insert(&CacheType::Object, b"a", object)); + let key = [letter]; + + c.bench_function("Hot Disk cold Memory cache speed get one 1mb object", |b| { + b.to_async(&rt) + .iter(|| do_cold_memory_hot_disk(black_box(&key), black_box(&layer_cache))) + }); +} + +criterion_group!( + benches, + insert_speed_1_mb_object, + hot_read_1_mb_object, + hot_disk_cold_memory_read_1_mb_object +); +criterion_main!(benches); diff --git a/lib/si-layer-cache/src/disk_cache.rs b/lib/si-layer-cache/src/disk_cache.rs new file mode 100644 index 0000000000..d0d6395e41 --- /dev/null +++ b/lib/si-layer-cache/src/disk_cache.rs @@ -0,0 +1,65 @@ +use std::path::Path; + +use sled::{self, IVec}; + +use crate::{error::LayerCacheResult, CacheType}; + +#[derive(Debug)] +pub struct DiskCache { + pub db: sled::Db, + pub object_tree: sled::Tree, + pub graph_tree: sled::Tree, +} + +impl DiskCache { + pub fn new(path: impl AsRef) -> LayerCacheResult { + let db = sled::open(path)?; + let object_tree = db.open_tree([CacheType::Object as u8])?; + let graph_tree = db.open_tree([CacheType::Graph as u8])?; + Ok(DiskCache { + db, + object_tree, + graph_tree, + }) + } + + fn get_tree(&self, cache_type: &CacheType) -> &sled::Tree { + match cache_type { + CacheType::Graph => &self.graph_tree, + CacheType::Object => &self.object_tree, + } + } + + pub fn get( + &self, + cache_type: &CacheType, + key: impl AsRef<[u8]>, + ) -> LayerCacheResult> { + let tree = self.get_tree(cache_type); + let result = tree.get(key)?; + Ok(result) + } + + pub fn contains_key( + &self, + cache_type: &CacheType, + key: impl AsRef<[u8]>, + ) -> LayerCacheResult { + let tree = self.get_tree(cache_type); + let key = key.as_ref(); + let result = tree.contains_key(key)?; + Ok(result) + } + + pub fn insert( + &self, + cache_type: &CacheType, + key: impl AsRef<[u8]>, + value: impl Into>, + ) -> LayerCacheResult<()> { + let tree = self.get_tree(cache_type); + let key = key.as_ref(); + let _result = tree.insert(key, value.into())?; + Ok(()) + } +} diff --git a/lib/si-layer-cache/src/error.rs b/lib/si-layer-cache/src/error.rs new file mode 100644 index 0000000000..fe4fa39176 --- /dev/null +++ b/lib/si-layer-cache/src/error.rs @@ -0,0 +1,9 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum LayerCacheError { + #[error(transparent)] + SledError(#[from] sled::Error), +} + +pub type LayerCacheResult = Result; diff --git a/lib/si-layer-cache/src/lib.rs b/lib/si-layer-cache/src/lib.rs new file mode 100644 index 0000000000..d1a89d121f --- /dev/null +++ b/lib/si-layer-cache/src/lib.rs @@ -0,0 +1,134 @@ +//! A fast in-memory, network aware, layered write-through cache for System Initiative. +//! +//! It should have 3 layers of caching: +//! +//! * Moka, an in-memory LRU style cache. +//! * Sled, an on-disk memory-mapped cache, to keep more data locally than can be held in memory +//! * Postgres, our final persistant storage layer. +//! +//! When a write is requested, the following happens: +//! +//! * The data is written first to a Moka cache +//! * Then written to Sled for persistent storage +//! * The data is then published to a nats topic layer-cache.workspaceId +//! * Any remote si-layer-cache instances listen to this topic, and populate their local caches +//! * Postgres gets written to eventually by a 'persister' process that writes to PG from the write +//! stream +//! +//! When a read is requested, the following happen: +//! +//! * The data is read from the moka cache +//! * On a miss, the data is read from sled, inserted into Moka, and returned to the user +//! * On a miss, the data is read from Postgres, inserted into sled, inserted into moka, and +//! returned to the user +//! +//! The postgres bits remain unimplemented! :) + +pub mod disk_cache; +pub mod error; +pub mod memory_cache; + +use std::fmt; +use std::path::Path; + +use memory_cache::{CacheKey, CacheValueRaw}; + +use crate::disk_cache::DiskCache; +use crate::error::LayerCacheResult; +use crate::memory_cache::{CacheKeyRef, CacheValue, MemoryCache}; + +#[derive(Eq, PartialEq, PartialOrd, Ord, Hash, Debug)] +pub enum CacheType { + Object = 1, + Graph, +} + +impl fmt::Display for CacheType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + CacheType::Object => write!(f, "object"), + CacheType::Graph => write!(f, "graph"), + } + } +} + +pub struct LayerCache { + pub memory_cache: MemoryCache, + pub disk_cache: DiskCache, +} + +impl LayerCache { + pub fn new(path: impl AsRef) -> LayerCacheResult { + let memory_cache = MemoryCache::new(); + let disk_cache = DiskCache::new(path)?; + Ok(LayerCache { + memory_cache, + disk_cache, + }) + } + + #[inline] + pub async fn get( + &self, + cache_type: &CacheType, + key: impl AsRef, + ) -> LayerCacheResult> { + let key = key.as_ref(); + let memory_value = self.memory_cache.get(cache_type, key).await; + if memory_value.is_some() { + Ok(memory_value) + } else { + let maybe_value = self.disk_cache.get(cache_type, key)?; + match maybe_value { + Some(value) => { + let d: Vec = value.as_ref().into(); + self.memory_cache + .insert(cache_type, Vec::from(key), d) + .await; + Ok(self.memory_cache.get(cache_type, key).await) + } + None => Ok(None), + } + } + } + + #[inline] + pub async fn insert( + &self, + cache_type: &CacheType, + key: impl Into, + value: impl Into, + ) -> LayerCacheResult<()> { + let key = key.into(); + let in_memory = self.memory_cache.contains_key(cache_type, &key); + let on_disk = self.disk_cache.contains_key(cache_type, &key)?; + + match (in_memory, on_disk) { + // In memory and on disk + (true, true) => Ok(()), + // Neither on memory or on disk + (false, false) => { + let value = value.into(); + self.memory_cache + .insert(cache_type, key.clone(), value.clone()) + .await; + self.disk_cache.insert(cache_type, key, value)?; + Ok(()) + } + // Not in memory, but on disk - we can write, becasue objects are immutable + (false, true) => { + let value = value.into(); + self.memory_cache + .insert(cache_type, key.clone(), value) + .await; + Ok(()) + } + // In memory, but not on disk + (true, false) => { + let value = value.into(); + self.disk_cache.insert(cache_type, key, value)?; + Ok(()) + } + } + } +} diff --git a/lib/si-layer-cache/src/memory_cache.rs b/lib/si-layer-cache/src/memory_cache.rs new file mode 100644 index 0000000000..37442c6759 --- /dev/null +++ b/lib/si-layer-cache/src/memory_cache.rs @@ -0,0 +1,69 @@ +use moka::future::Cache; +use std::sync::Arc; +use std::time::Duration; + +use crate::CacheType; + +pub type CacheKeyRef = [u8]; +pub type CacheKey = Vec; +pub type CacheValueRaw = Vec; +pub type CacheValue = Arc>; + +pub struct MemoryCache { + pub object_cache: Cache, + pub graph_cache: Cache, +} + +impl Default for MemoryCache { + fn default() -> Self { + Self::new() + } +} + +impl MemoryCache { + pub fn new() -> MemoryCache { + MemoryCache { + object_cache: Cache::builder() + .max_capacity(10000) + .time_to_idle(Duration::from_secs(36000)) + .build(), + graph_cache: Cache::builder() + .max_capacity(10000) + .time_to_idle(Duration::from_secs(36000)) + .build(), + } + } + + fn get_cache(&self, cache_type: &CacheType) -> &Cache { + match cache_type { + CacheType::Object => &self.object_cache, + CacheType::Graph => &self.graph_cache, + } + } + + pub async fn insert( + &self, + cache_type: &CacheType, + key: impl Into, + value: impl Into>, + ) { + let cache = self.get_cache(cache_type); + cache.insert(key.into(), Arc::new(value.into())).await; + } + + pub async fn get( + &self, + cache_type: &CacheType, + key: impl AsRef, + ) -> Option { + let cache = self.get_cache(cache_type); + let key = key.as_ref(); + cache.get(key).await + } + + pub fn contains_key(&self, cache_type: &CacheType, key: impl AsRef) -> bool { + let cache = self.get_cache(cache_type); + let key = key.as_ref(); + cache.contains_key(key) + } +} diff --git a/lib/si-layer-cache/tests/integration.rs b/lib/si-layer-cache/tests/integration.rs new file mode 100644 index 0000000000..2758dbf62b --- /dev/null +++ b/lib/si-layer-cache/tests/integration.rs @@ -0,0 +1 @@ +mod integration_test; diff --git a/lib/si-layer-cache/tests/integration_test/disk_cache.rs b/lib/si-layer-cache/tests/integration_test/disk_cache.rs new file mode 100644 index 0000000000..e9319054ea --- /dev/null +++ b/lib/si-layer-cache/tests/integration_test/disk_cache.rs @@ -0,0 +1,23 @@ +use si_layer_cache::{disk_cache::DiskCache, CacheType}; + +#[test] +fn new() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let _disk_cache = + DiskCache::new(tempdir).expect("cannot create disk cache and a tree for each type"); +} + +#[tokio::test] +async fn insert_and_get() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let disk_cache = + DiskCache::new(tempdir).expect("cannot create disk cache and a tree for each type"); + disk_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .expect("cannot insert object"); + let result = disk_cache + .get(&CacheType::Object, b"skid row") + .expect("cannot get object from disk") + .expect("object not found in disk cache"); + assert_eq!(&result[..], b"slave to the grind"); +} diff --git a/lib/si-layer-cache/tests/integration_test/memory_cache.rs b/lib/si-layer-cache/tests/integration_test/memory_cache.rs new file mode 100644 index 0000000000..e71627fbcd --- /dev/null +++ b/lib/si-layer-cache/tests/integration_test/memory_cache.rs @@ -0,0 +1,21 @@ +use si_layer_cache::memory_cache::MemoryCache; +use si_layer_cache::CacheType; + + +#[test] +fn new() { + let _memory_cache = MemoryCache::new(); +} + +#[tokio::test] +async fn insert_and_get() { + let memory_cache = MemoryCache::new(); + memory_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .await; + let result = memory_cache + .get(&CacheType::Object, b"skid row") + .await + .expect("cannot get from memory cache"); + assert_eq!(b"slave to the grind", &result[..]); +} diff --git a/lib/si-layer-cache/tests/integration_test/mod.rs b/lib/si-layer-cache/tests/integration_test/mod.rs new file mode 100644 index 0000000000..3aab1b6a3a --- /dev/null +++ b/lib/si-layer-cache/tests/integration_test/mod.rs @@ -0,0 +1,126 @@ +use si_layer_cache::{CacheType, LayerCache}; + +mod disk_cache; +mod memory_cache; + +#[test] +fn new() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let _layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); +} + +#[tokio::test] +async fn empty_insert_and_get() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); + layer_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .await + .expect("cannot insert into layer cache"); + + // Confirm the insert went into the memory cache + let memory_result = layer_cache + .memory_cache + .get(&CacheType::Object, b"skid row") + .await + .expect("cannot find value in memory cache"); + assert_eq!(b"slave to the grind", &memory_result[..]); + + // Confirm the insert went into the disk cache + let disk_result = layer_cache + .disk_cache + .get(&CacheType::Object, b"skid row") + .expect("error looking for value in disk cache") + .expect("cannot find value in disk cache"); + assert_eq!(b"slave to the grind", &disk_result[..]); + + // Confirm we can get directly from the layer cache + let result = layer_cache + .get(&CacheType::Object, b"skid row") + .await + .expect("error finding object") + .expect("cannot find object in cache"); + assert_eq!(b"slave to the grind", &result[..]); +} + +#[tokio::test] +async fn not_in_memory_but_on_disk_insert() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); + + // Insert the object directly to disk cache + layer_cache + .disk_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .expect("failed to insert to disk cache"); + + // There should not be anything for the key in memory cache + assert!(!layer_cache + .memory_cache + .contains_key(&CacheType::Object, b"skid row")); + + // Insert through the layer cache + layer_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .await + .expect("cannot insert into the cache"); + + // There should be an entry in memory now + assert!(layer_cache + .memory_cache + .contains_key(&CacheType::Object, b"skid row")); +} + +#[tokio::test] +async fn in_memory_but_not_on_disk_insert() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); + + // Insert the object directly to memory cache + layer_cache + .memory_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .await; + + // There should not be anything for the key in disk cache + assert!(!layer_cache + .disk_cache + .contains_key(&CacheType::Object, b"skid row") + .expect("cannot check if key exists in disk cache")); + + // Insert through the layer cache + layer_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .await + .expect("cannot insert into the cache"); + + // There should be an entry in disk now + assert!(layer_cache + .disk_cache + .contains_key(&CacheType::Object, b"skid row") + .expect("cannot read from disk cache")); +} + +#[tokio::test] +async fn get_inserts_to_memory() { + let tempdir = tempfile::tempdir().expect("cannot create tempdir"); + let layer_cache = LayerCache::new(tempdir).expect("cannot create layer cache"); + + layer_cache + .disk_cache + .insert(&CacheType::Object, b"skid row", b"slave to the grind") + .expect("failed to insert to disk cache"); + assert!(!layer_cache + .memory_cache + .contains_key(&CacheType::Object, b"skid row")); + + layer_cache + .get(&CacheType::Object, b"skid row") + .await + .expect("error getting object from cache") + .expect("object not in cachche"); + + assert!(layer_cache + .memory_cache + .contains_key(&CacheType::Object, b"skid row")); +} diff --git a/third-party/rust/BUCK b/third-party/rust/BUCK index 40291e3091..53223f9662 100644 --- a/third-party/rust/BUCK +++ b/third-party/rust/BUCK @@ -494,6 +494,24 @@ cargo.rust_library( ], ) +http_archive( + name = "async-lock-2.8.0.crate", + sha256 = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b", + strip_prefix = "async-lock-2.8.0", + urls = ["https://crates.io/api/v1/crates/async-lock/2.8.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "async-lock-2.8.0", + srcs = [":async-lock-2.8.0.crate"], + crate = "async_lock", + crate_root = "async-lock-2.8.0.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [":event-listener-2.5.3"], +) + alias( name = "async-nats", actual = ":async-nats-0.33.0", @@ -778,6 +796,43 @@ cargo.rust_library( ], ) +http_archive( + name = "atty-0.2.14.crate", + sha256 = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8", + strip_prefix = "atty-0.2.14", + urls = ["https://crates.io/api/v1/crates/atty/0.2.14/download"], + visibility = [], +) + +cargo.rust_library( + name = "atty-0.2.14", + srcs = [":atty-0.2.14.crate"], + crate = "atty", + crate_root = "atty-0.2.14.crate/src/lib.rs", + edition = "2015", + platform = { + "linux-arm64": dict( + deps = [":libc-0.2.153"], + ), + "linux-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "macos-arm64": dict( + deps = [":libc-0.2.153"], + ), + "macos-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "windows-gnu": dict( + deps = [":winapi-0.3.9"], + ), + "windows-msvc": dict( + deps = [":winapi-0.3.9"], + ), + }, + visibility = [], +) + http_archive( name = "autocfg-1.1.0.crate", sha256 = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa", @@ -1676,6 +1731,23 @@ cargo.rust_library( deps = [":serde-1.0.196"], ) +http_archive( + name = "cast-0.3.0.crate", + sha256 = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5", + strip_prefix = "cast-0.3.0", + urls = ["https://crates.io/api/v1/crates/cast/0.3.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "cast-0.3.0", + srcs = [":cast-0.3.0.crate"], + crate = "cast", + crate_root = "cast-0.3.0.crate/src/lib.rs", + edition = "2018", + visibility = [], +) + http_archive( name = "cc-1.0.83.crate", sha256 = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0", @@ -1861,6 +1933,28 @@ cargo.rust_library( ], ) +http_archive( + name = "clap-2.34.0.crate", + sha256 = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c", + strip_prefix = "clap-2.34.0", + urls = ["https://crates.io/api/v1/crates/clap/2.34.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "clap-2.34.0", + srcs = [":clap-2.34.0.crate"], + crate = "clap", + crate_root = "clap-2.34.0.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [ + ":bitflags-1.3.2", + ":textwrap-0.11.0", + ":unicode-width-0.1.11", + ], +) + alias( name = "clap", actual = ":clap-4.5.1", @@ -2624,6 +2718,91 @@ cargo.rust_library( deps = [":cfg-if-1.0.0"], ) +alias( + name = "criterion", + actual = ":criterion-0.3.6", + visibility = ["PUBLIC"], +) + +http_archive( + name = "criterion-0.3.6.crate", + sha256 = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f", + strip_prefix = "criterion-0.3.6", + urls = ["https://crates.io/api/v1/crates/criterion/0.3.6/download"], + visibility = [], +) + +cargo.rust_library( + name = "criterion-0.3.6", + srcs = [":criterion-0.3.6.crate"], + crate = "criterion", + crate_root = "criterion-0.3.6.crate/src/lib.rs", + edition = "2018", + env = { + "CARGO_MANIFEST_DIR": "criterion-0.3.6.crate", + "CARGO_PKG_AUTHORS": "Jorge Aparicio :Brook Heisler ", + "CARGO_PKG_DESCRIPTION": "Statistics-driven micro-benchmarking library", + "CARGO_PKG_NAME": "criterion", + "CARGO_PKG_REPOSITORY": "https://github.com/bheisler/criterion.rs", + "CARGO_PKG_VERSION": "0.3.6", + "CARGO_PKG_VERSION_MAJOR": "0", + "CARGO_PKG_VERSION_MINOR": "3", + "CARGO_PKG_VERSION_PATCH": "6", + }, + features = [ + "async", + "async_tokio", + "cargo_bench_support", + "default", + "futures", + "tokio", + ], + visibility = [], + deps = [ + ":atty-0.2.14", + ":cast-0.3.0", + ":clap-2.34.0", + ":criterion-plot-0.4.5", + ":csv-1.3.0", + ":futures-0.3.30", + ":itertools-0.10.5", + ":lazy_static-1.4.0", + ":num-traits-0.2.18", + ":oorandom-11.1.3", + ":plotters-0.3.5", + ":rayon-1.9.0", + ":regex-1.10.3", + ":serde-1.0.196", + ":serde_cbor-0.11.2", + ":serde_derive-1.0.196", + ":serde_json-1.0.113", + ":tinytemplate-1.2.1", + ":tokio-1.36.0", + ":walkdir-2.4.0", + ], +) + +http_archive( + name = "criterion-plot-0.4.5.crate", + sha256 = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876", + strip_prefix = "criterion-plot-0.4.5", + urls = ["https://crates.io/api/v1/crates/criterion-plot/0.4.5/download"], + visibility = [], +) + +cargo.rust_library( + name = "criterion-plot-0.4.5", + srcs = [":criterion-plot-0.4.5.crate"], + crate = "criterion_plot", + crate_root = "criterion-plot-0.4.5.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [ + ":cast-0.3.0", + ":itertools-0.10.5", + ], +) + alias( name = "crossbeam-channel", actual = ":crossbeam-channel-0.5.11", @@ -2704,6 +2883,7 @@ cargo.rust_library( }, features = [ "alloc", + "default", "std", ], visibility = [], @@ -2758,7 +2938,10 @@ cargo.rust_library( "CARGO_PKG_VERSION_MINOR": "8", "CARGO_PKG_VERSION_PATCH": "19", }, - features = ["std"], + features = [ + "default", + "std", + ], visibility = [], ) @@ -3004,6 +3187,48 @@ cargo.rust_library( ], ) +http_archive( + name = "csv-1.3.0.crate", + sha256 = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe", + strip_prefix = "csv-1.3.0", + urls = ["https://crates.io/api/v1/crates/csv/1.3.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "csv-1.3.0", + srcs = [":csv-1.3.0.crate"], + crate = "csv", + crate_root = "csv-1.3.0.crate/src/lib.rs", + edition = "2021", + visibility = [], + deps = [ + ":csv-core-0.1.11", + ":itoa-1.0.10", + ":ryu-1.0.16", + ":serde-1.0.196", + ], +) + +http_archive( + name = "csv-core-0.1.11.crate", + sha256 = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70", + strip_prefix = "csv-core-0.1.11", + urls = ["https://crates.io/api/v1/crates/csv-core/0.1.11/download"], + visibility = [], +) + +cargo.rust_library( + name = "csv-core-0.1.11", + srcs = [":csv-core-0.1.11.crate"], + crate = "csv_core", + crate_root = "csv-core-0.1.11.crate/src/lib.rs", + edition = "2018", + features = ["default"], + visibility = [], + deps = [":memchr-2.7.1"], +) + http_archive( name = "ct-codecs-1.1.1.crate", sha256 = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df", @@ -4545,6 +4770,43 @@ cargo.rust_library( deps = [":percent-encoding-2.3.1"], ) +http_archive( + name = "fs2-0.4.3.crate", + sha256 = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213", + strip_prefix = "fs2-0.4.3", + urls = ["https://crates.io/api/v1/crates/fs2/0.4.3/download"], + visibility = [], +) + +cargo.rust_library( + name = "fs2-0.4.3", + srcs = [":fs2-0.4.3.crate"], + crate = "fs2", + crate_root = "fs2-0.4.3.crate/src/lib.rs", + edition = "2015", + platform = { + "linux-arm64": dict( + deps = [":libc-0.2.153"], + ), + "linux-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "macos-arm64": dict( + deps = [":libc-0.2.153"], + ), + "macos-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "windows-gnu": dict( + deps = [":winapi-0.3.9"], + ), + "windows-msvc": dict( + deps = [":winapi-0.3.9"], + ), + }, + visibility = [], +) + alias( name = "futures", actual = ":futures-0.3.30", @@ -4928,6 +5190,24 @@ cargo.rust_library( ], ) +http_archive( + name = "fxhash-0.2.1.crate", + sha256 = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c", + strip_prefix = "fxhash-0.2.1", + urls = ["https://crates.io/api/v1/crates/fxhash/0.2.1/download"], + visibility = [], +) + +cargo.rust_library( + name = "fxhash-0.2.1", + srcs = [":fxhash-0.2.1.crate"], + crate = "fxhash", + crate_root = "fxhash-0.2.1.crate/lib.rs", + edition = "2015", + visibility = [], + deps = [":byteorder-1.5.0"], +) + http_archive( name = "generic-array-0.14.7.crate", sha256 = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a", @@ -5149,6 +5429,23 @@ cargo.rust_library( ], ) +http_archive( + name = "half-1.8.3.crate", + sha256 = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403", + strip_prefix = "half-1.8.3", + urls = ["https://crates.io/api/v1/crates/half/1.8.3/download"], + visibility = [], +) + +cargo.rust_library( + name = "half-1.8.3", + srcs = [":half-1.8.3.crate"], + crate = "half", + crate_root = "half-1.8.3.crate/src/lib.rs", + edition = "2018", + visibility = [], +) + http_archive( name = "half-2.3.1.crate", sha256 = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872", @@ -6090,6 +6387,24 @@ cargo.rust_library( ], ) +http_archive( + name = "instant-0.1.12.crate", + sha256 = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c", + strip_prefix = "instant-0.1.12", + urls = ["https://crates.io/api/v1/crates/instant/0.1.12/download"], + visibility = [], +) + +cargo.rust_library( + name = "instant-0.1.12", + srcs = [":instant-0.1.12.crate"], + crate = "instant", + crate_root = "instant-0.1.12.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [":cfg-if-1.0.0"], +) + http_archive( name = "ipnet-2.9.0.crate", sha256 = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3", @@ -6164,7 +6479,11 @@ cargo.rust_library( crate = "itertools", crate_root = "itertools-0.10.5.crate/src/lib.rs", edition = "2018", - features = ["use_alloc"], + features = [ + "default", + "use_alloc", + "use_std", + ], visibility = [], deps = [":either-1.10.0"], ) @@ -7312,6 +7631,54 @@ cargo.rust_library( deps = [":log-0.4.20"], ) +alias( + name = "moka", + actual = ":moka-0.12.5", + visibility = ["PUBLIC"], +) + +http_archive( + name = "moka-0.12.5.crate", + sha256 = "b1911e88d5831f748a4097a43862d129e3c6fca831eecac9b8db6d01d93c9de2", + strip_prefix = "moka-0.12.5", + urls = ["https://crates.io/api/v1/crates/moka/0.12.5/download"], + visibility = [], +) + +cargo.rust_library( + name = "moka-0.12.5", + srcs = [":moka-0.12.5.crate"], + crate = "moka", + crate_root = "moka-0.12.5.crate/src/lib.rs", + edition = "2021", + features = [ + "async-lock", + "async-trait", + "atomic64", + "default", + "future", + "futures-util", + "quanta", + ], + visibility = [], + deps = [ + ":async-lock-2.8.0", + ":async-trait-0.1.77", + ":crossbeam-channel-0.5.11", + ":crossbeam-epoch-0.9.18", + ":crossbeam-utils-0.8.19", + ":futures-util-0.3.30", + ":once_cell-1.19.0", + ":parking_lot-0.12.1", + ":quanta-0.12.2", + ":smallvec-1.13.1", + ":tagptr-0.2.0", + ":thiserror-1.0.57", + ":triomphe-0.1.11", + ":uuid-1.7.0", + ], +) + http_archive( name = "multer-2.1.0.crate", sha256 = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2", @@ -8015,6 +8382,23 @@ cargo.rust_library( visibility = [], ) +http_archive( + name = "oorandom-11.1.3.crate", + sha256 = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575", + strip_prefix = "oorandom-11.1.3", + urls = ["https://crates.io/api/v1/crates/oorandom/11.1.3/download"], + visibility = [], +) + +cargo.rust_library( + name = "oorandom-11.1.3", + srcs = [":oorandom-11.1.3.crate"], + crate = "oorandom", + crate_root = "oorandom-11.1.3.crate/src/lib.rs", + edition = "2018", + visibility = [], +) + alias( name = "open", actual = ":open-5.0.1", @@ -8632,6 +9016,29 @@ cargo.rust_library( visibility = [], ) +http_archive( + name = "parking_lot-0.11.2.crate", + sha256 = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99", + strip_prefix = "parking_lot-0.11.2", + urls = ["https://crates.io/api/v1/crates/parking_lot/0.11.2/download"], + visibility = [], +) + +cargo.rust_library( + name = "parking_lot-0.11.2", + srcs = [":parking_lot-0.11.2.crate"], + crate = "parking_lot", + crate_root = "parking_lot-0.11.2.crate/src/lib.rs", + edition = "2018", + features = ["default"], + visibility = [], + deps = [ + ":instant-0.1.12", + ":lock_api-0.4.11", + ":parking_lot_core-0.8.6", + ], +) + http_archive( name = "parking_lot-0.12.1.crate", sha256 = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f", @@ -8654,6 +9061,48 @@ cargo.rust_library( ], ) +http_archive( + name = "parking_lot_core-0.8.6.crate", + sha256 = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc", + strip_prefix = "parking_lot_core-0.8.6", + urls = ["https://crates.io/api/v1/crates/parking_lot_core/0.8.6/download"], + visibility = [], +) + +cargo.rust_library( + name = "parking_lot_core-0.8.6", + srcs = [":parking_lot_core-0.8.6.crate"], + crate = "parking_lot_core", + crate_root = "parking_lot_core-0.8.6.crate/src/lib.rs", + edition = "2018", + platform = { + "linux-arm64": dict( + deps = [":libc-0.2.153"], + ), + "linux-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "macos-arm64": dict( + deps = [":libc-0.2.153"], + ), + "macos-x86_64": dict( + deps = [":libc-0.2.153"], + ), + "windows-gnu": dict( + deps = [":winapi-0.3.9"], + ), + "windows-msvc": dict( + deps = [":winapi-0.3.9"], + ), + }, + visibility = [], + deps = [ + ":cfg-if-1.0.0", + ":instant-0.1.12", + ":smallvec-1.13.1", + ], +) + http_archive( name = "parking_lot_core-0.9.9.crate", sha256 = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e", @@ -9102,6 +9551,69 @@ cargo.rust_library( visibility = [], ) +http_archive( + name = "plotters-0.3.5.crate", + sha256 = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45", + strip_prefix = "plotters-0.3.5", + urls = ["https://crates.io/api/v1/crates/plotters/0.3.5/download"], + visibility = [], +) + +cargo.rust_library( + name = "plotters-0.3.5", + srcs = [":plotters-0.3.5.crate"], + crate = "plotters", + crate_root = "plotters-0.3.5.crate/src/lib.rs", + edition = "2018", + features = [ + "area_series", + "line_series", + "plotters-svg", + "svg_backend", + ], + visibility = [], + deps = [ + ":num-traits-0.2.18", + ":plotters-backend-0.3.5", + ":plotters-svg-0.3.5", + ], +) + +http_archive( + name = "plotters-backend-0.3.5.crate", + sha256 = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609", + strip_prefix = "plotters-backend-0.3.5", + urls = ["https://crates.io/api/v1/crates/plotters-backend/0.3.5/download"], + visibility = [], +) + +cargo.rust_library( + name = "plotters-backend-0.3.5", + srcs = [":plotters-backend-0.3.5.crate"], + crate = "plotters_backend", + crate_root = "plotters-backend-0.3.5.crate/src/lib.rs", + edition = "2018", + visibility = [], +) + +http_archive( + name = "plotters-svg-0.3.5.crate", + sha256 = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab", + strip_prefix = "plotters-svg-0.3.5", + urls = ["https://crates.io/api/v1/crates/plotters-svg/0.3.5/download"], + visibility = [], +) + +cargo.rust_library( + name = "plotters-svg-0.3.5", + srcs = [":plotters-svg-0.3.5.crate"], + crate = "plotters_svg", + crate_root = "plotters-svg-0.3.5.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [":plotters-backend-0.3.5"], +) + alias( name = "podman-api", actual = ":podman-api-0.10.0", @@ -9690,6 +10202,63 @@ cargo.rust_library( ], ) +http_archive( + name = "quanta-0.12.2.crate", + sha256 = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c", + strip_prefix = "quanta-0.12.2", + urls = ["https://crates.io/api/v1/crates/quanta/0.12.2/download"], + visibility = [], +) + +cargo.rust_library( + name = "quanta-0.12.2", + srcs = [":quanta-0.12.2.crate"], + crate = "quanta", + crate_root = "quanta-0.12.2.crate/src/lib.rs", + edition = "2021", + features = [ + "default", + "flaky_tests", + ], + platform = { + "linux-arm64": dict( + deps = [":libc-0.2.153"], + ), + "linux-x86_64": dict( + deps = [ + ":libc-0.2.153", + ":raw-cpuid-11.0.1", + ], + ), + "macos-arm64": dict( + deps = [":libc-0.2.153"], + ), + "macos-x86_64": dict( + deps = [ + ":libc-0.2.153", + ":raw-cpuid-11.0.1", + ], + ), + "windows-gnu": dict( + deps = [ + ":raw-cpuid-11.0.1", + ":winapi-0.3.9", + ], + ), + "windows-msvc": dict( + deps = [ + ":raw-cpuid-11.0.1", + ":winapi-0.3.9", + ], + ), + }, + visibility = [], + deps = [ + ":crossbeam-utils-0.8.19", + ":once_cell-1.19.0", + ], +) + http_archive( name = "quick-xml-0.30.0.crate", sha256 = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956", @@ -9947,6 +10516,66 @@ cargo.rust_library( deps = [":getrandom-0.2.12"], ) +http_archive( + name = "raw-cpuid-11.0.1.crate", + sha256 = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1", + strip_prefix = "raw-cpuid-11.0.1", + urls = ["https://crates.io/api/v1/crates/raw-cpuid/11.0.1/download"], + visibility = [], +) + +cargo.rust_library( + name = "raw-cpuid-11.0.1", + srcs = [":raw-cpuid-11.0.1.crate"], + crate = "raw_cpuid", + crate_root = "raw-cpuid-11.0.1.crate/src/lib.rs", + edition = "2018", + visibility = [], + deps = [":bitflags-2.4.2"], +) + +http_archive( + name = "rayon-1.9.0.crate", + sha256 = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd", + strip_prefix = "rayon-1.9.0", + urls = ["https://crates.io/api/v1/crates/rayon/1.9.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "rayon-1.9.0", + srcs = [":rayon-1.9.0.crate"], + crate = "rayon", + crate_root = "rayon-1.9.0.crate/src/lib.rs", + edition = "2021", + visibility = [], + deps = [ + ":either-1.10.0", + ":rayon-core-1.12.1", + ], +) + +http_archive( + name = "rayon-core-1.12.1.crate", + sha256 = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2", + strip_prefix = "rayon-core-1.12.1", + urls = ["https://crates.io/api/v1/crates/rayon-core/1.12.1/download"], + visibility = [], +) + +cargo.rust_library( + name = "rayon-core-1.12.1", + srcs = [":rayon-core-1.12.1.crate"], + crate = "rayon_core", + crate_root = "rayon-core-1.12.1.crate/src/lib.rs", + edition = "2021", + visibility = [], + deps = [ + ":crossbeam-deque-0.8.5", + ":crossbeam-utils-0.8.19", + ], +) + alias( name = "refinery", actual = ":refinery-0.8.12", @@ -12235,10 +12864,12 @@ cargo.rust_library( }, features = [ "default", + "serde", "std", ], rustc_flags = ["@$(location :semver-1.0.21-build-script-run[rustc_flags])"], visibility = [], + deps = [":serde-1.0.196"], ) cargo.rust_binary( @@ -12260,6 +12891,7 @@ cargo.rust_binary( }, features = [ "default", + "serde", "std", ], visibility = [], @@ -12271,6 +12903,7 @@ buildscript_run( buildscript_rule = ":semver-1.0.21-build-script-build", features = [ "default", + "serde", "std", ], version = "1.0.21", @@ -12340,6 +12973,31 @@ cargo.rust_library( ], ) +http_archive( + name = "serde_cbor-0.11.2.crate", + sha256 = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5", + strip_prefix = "serde_cbor-0.11.2", + urls = ["https://crates.io/api/v1/crates/serde_cbor/0.11.2/download"], + visibility = [], +) + +cargo.rust_library( + name = "serde_cbor-0.11.2", + srcs = [":serde_cbor-0.11.2.crate"], + crate = "serde_cbor", + crate_root = "serde_cbor-0.11.2.crate/src/lib.rs", + edition = "2018", + features = [ + "default", + "std", + ], + visibility = [], + deps = [ + ":half-1.8.3", + ":serde-1.0.196", + ], +) + http_archive( name = "serde_derive-1.0.196.crate", sha256 = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67", @@ -12391,6 +13049,7 @@ cargo.rust_library( "preserve_order", "raw_value", "std", + "unbounded_depth", ], visibility = [], deps = [ @@ -13003,6 +13662,73 @@ cargo.rust_library( visibility = [], ) +alias( + name = "sled", + actual = ":sled-0.34.7", + visibility = ["PUBLIC"], +) + +http_archive( + name = "sled-0.34.7.crate", + sha256 = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935", + strip_prefix = "sled-0.34.7", + urls = ["https://crates.io/api/v1/crates/sled/0.34.7/download"], + visibility = [], +) + +cargo.rust_library( + name = "sled-0.34.7", + srcs = [":sled-0.34.7.crate"], + crate = "sled", + crate_root = "sled-0.34.7.crate/src/lib.rs", + edition = "2018", + env = { + "CARGO_MANIFEST_DIR": "sled-0.34.7.crate", + "CARGO_PKG_AUTHORS": "Tyler Neely ", + "CARGO_PKG_DESCRIPTION": "Lightweight high-performance pure-rust transactional embedded database.", + "CARGO_PKG_NAME": "sled", + "CARGO_PKG_REPOSITORY": "https://github.com/spacejam/sled", + "CARGO_PKG_VERSION": "0.34.7", + "CARGO_PKG_VERSION_MAJOR": "0", + "CARGO_PKG_VERSION_MINOR": "34", + "CARGO_PKG_VERSION_PATCH": "7", + }, + features = [ + "default", + "no_metrics", + ], + platform = { + "linux-arm64": dict( + deps = [":fs2-0.4.3"], + ), + "linux-x86_64": dict( + deps = [":fs2-0.4.3"], + ), + "macos-arm64": dict( + deps = [":fs2-0.4.3"], + ), + "macos-x86_64": dict( + deps = [":fs2-0.4.3"], + ), + "windows-gnu": dict( + deps = [":fs2-0.4.3"], + ), + "windows-msvc": dict( + deps = [":fs2-0.4.3"], + ), + }, + visibility = [], + deps = [ + ":crc32fast-1.4.0", + ":crossbeam-epoch-0.9.18", + ":crossbeam-utils-0.8.19", + ":fxhash-0.2.1", + ":libc-0.2.153", + ":log-0.4.20", + ":parking_lot-0.11.2", + ], +) + http_archive( name = "smallstr-0.3.0.crate", sha256 = "63b1aefdf380735ff8ded0b15f31aab05daf1f70216c01c02a12926badd1df9d", @@ -13807,6 +14533,23 @@ buildscript_run( version = "0.5.0", ) +http_archive( + name = "tagptr-0.2.0.crate", + sha256 = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417", + strip_prefix = "tagptr-0.2.0", + urls = ["https://crates.io/api/v1/crates/tagptr/0.2.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "tagptr-0.2.0", + srcs = [":tagptr-0.2.0.crate"], + crate = "tagptr", + crate_root = "tagptr-0.2.0.crate/src/lib.rs", + edition = "2018", + visibility = [], +) + alias( name = "tar", actual = ":tar-0.4.40", @@ -14018,6 +14761,24 @@ cargo.rust_library( ], ) +http_archive( + name = "textwrap-0.11.0.crate", + sha256 = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060", + strip_prefix = "textwrap-0.11.0", + urls = ["https://crates.io/api/v1/crates/textwrap/0.11.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "textwrap-0.11.0", + srcs = [":textwrap-0.11.0.crate"], + crate = "textwrap", + crate_root = "textwrap-0.11.0.crate/src/lib.rs", + edition = "2015", + visibility = [], + deps = [":unicode-width-0.1.11"], +) + cargo.rust_binary( name = "third-party-0.0.0-top", srcs = ["top/main.rs"], @@ -14043,6 +14804,7 @@ cargo.rust_binary( ":config-0.13.4", ":console-0.15.8", ":convert_case-0.6.0", + ":criterion-0.3.6", ":crossbeam-channel-0.5.11", ":deadpool-0.10.0", ":deadpool-postgres-0.12.1", @@ -14067,6 +14829,7 @@ cargo.rust_binary( ":itertools-0.12.1", ":jwt-simple-0.12.8", ":lazy_static-1.4.0", + ":moka-0.12.5", ":names-0.14.0", ":nix-0.27.1", ":nkeys-0.4.0", @@ -14105,6 +14868,7 @@ cargo.rust_binary( ":serde_url_params-0.2.1", ":serde_with-3.6.1", ":serde_yaml-0.9.31", + ":sled-0.34.7", ":sodiumoxide-0.2.7", ":stream-cancel-0.8.2", ":strum-0.25.0", @@ -14309,6 +15073,27 @@ cargo.rust_library( deps = [":crunchy-0.2.2"], ) +http_archive( + name = "tinytemplate-1.2.1.crate", + sha256 = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc", + strip_prefix = "tinytemplate-1.2.1", + urls = ["https://crates.io/api/v1/crates/tinytemplate/1.2.1/download"], + visibility = [], +) + +cargo.rust_library( + name = "tinytemplate-1.2.1", + srcs = [":tinytemplate-1.2.1.crate"], + crate = "tinytemplate", + crate_root = "tinytemplate-1.2.1.crate/src/lib.rs", + edition = "2015", + visibility = [], + deps = [ + ":serde-1.0.196", + ":serde_json-1.0.113", + ], +) + http_archive( name = "tinyvec-1.6.0.crate", sha256 = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50", @@ -15495,6 +16280,23 @@ cargo.rust_library( ], ) +http_archive( + name = "triomphe-0.1.11.crate", + sha256 = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3", + strip_prefix = "triomphe-0.1.11", + urls = ["https://crates.io/api/v1/crates/triomphe/0.1.11/download"], + visibility = [], +) + +cargo.rust_library( + name = "triomphe-0.1.11", + srcs = [":triomphe-0.1.11.crate"], + crate = "triomphe", + crate_root = "triomphe-0.1.11.crate/src/lib.rs", + edition = "2015", + visibility = [], +) + http_archive( name = "try-lock-0.2.5.crate", sha256 = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b", @@ -16163,8 +16965,12 @@ cargo.rust_library( "fileapi", "handleapi", "impl-default", + "minwinbase", "minwindef", + "ntstatus", "processenv", + "processthreadsapi", + "profileapi", "std", "synchapi", "sysinfoapi", @@ -16198,8 +17004,12 @@ cargo.rust_binary( "fileapi", "handleapi", "impl-default", + "minwinbase", "minwindef", + "ntstatus", "processenv", + "processthreadsapi", + "profileapi", "std", "synchapi", "sysinfoapi", @@ -16222,8 +17032,12 @@ buildscript_run( "fileapi", "handleapi", "impl-default", + "minwinbase", "minwindef", + "ntstatus", "processenv", + "processthreadsapi", + "profileapi", "std", "synchapi", "sysinfoapi", diff --git a/third-party/rust/Cargo.lock b/third-party/rust/Cargo.lock index 828090c178..9deea0ddf2 100644 --- a/third-party/rust/Cargo.lock +++ b/third-party/rust/Cargo.lock @@ -172,6 +172,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + [[package]] name = "async-nats" version = "0.33.0" @@ -312,6 +321,17 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -657,6 +677,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bytecount" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" + [[package]] name = "byteorder" version = "1.5.0" @@ -678,6 +704,43 @@ dependencies = [ "serde", ] +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.83" @@ -738,7 +801,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", - "half", + "half 2.3.1", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags 1.3.2", + "textwrap", + "unicode-width", ] [[package]] @@ -1026,6 +1100,44 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +dependencies = [ + "atty", + "cast", + "clap 2.34.0", + "criterion-plot", + "csv", + "futures", + "itertools 0.10.5", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "tokio", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +dependencies = [ + "cast", + "itertools 0.10.5", +] + [[package]] name = "critical-section" version = "1.1.2" @@ -1085,7 +1197,7 @@ dependencies = [ "crossterm_winapi", "libc", "mio", - "parking_lot", + "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", "winapi", @@ -1100,7 +1212,7 @@ dependencies = [ "bitflags 2.4.2", "crossterm_winapi", "libc", - "parking_lot", + "parking_lot 0.12.1", "winapi", ] @@ -1141,6 +1253,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + [[package]] name = "ct-codecs" version = "1.1.1" @@ -1613,6 +1746,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "etcetera" version = "0.8.0" @@ -1685,7 +1827,7 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "windows-sys 0.52.0", ] @@ -1737,6 +1879,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "funty" version = "2.0.0" @@ -1793,7 +1945,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.12.1", ] [[package]] @@ -1868,6 +2020,15 @@ dependencies = [ "pin-project 0.4.30", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1960,6 +2121,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "half" version = "2.3.1" @@ -2036,6 +2203,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.6" @@ -2490,7 +2666,7 @@ checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ "bitflags 2.4.2", "libc", - "redox_syscall", + "redox_syscall 0.4.1", ] [[package]] @@ -2648,6 +2824,30 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "moka" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1911e88d5831f748a4097a43862d129e3c6fca831eecac9b8db6d01d93c9de2" +dependencies = [ + "async-lock", + "async-trait", + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "futures-util", + "once_cell", + "parking_lot 0.12.1", + "quanta", + "rustc_version", + "skeptic", + "smallvec", + "tagptr", + "thiserror", + "triomphe", + "uuid", +] + [[package]] name = "multer" version = "2.1.0" @@ -2838,7 +3038,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.6", "libc", ] @@ -2863,6 +3063,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "open" version = "5.0.1" @@ -3092,6 +3298,17 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -3099,7 +3316,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -3110,7 +3341,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -3267,6 +3498,34 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "podman-api" version = "0.10.0" @@ -3505,6 +3764,32 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" +dependencies = [ + "bitflags 2.4.2", + "memchr", + "unicase", +] + +[[package]] +name = "quanta" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + [[package]] name = "quick-xml" version = "0.30.0" @@ -3601,6 +3886,44 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.4.2", +] + +[[package]] +name = "rayon" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -4212,6 +4535,9 @@ name = "semver" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +dependencies = [ + "serde", +] [[package]] name = "serde" @@ -4233,6 +4559,16 @@ dependencies = [ "serde_json", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half 1.8.3", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.196" @@ -4495,6 +4831,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ac45299ccbd390721be55b412d41931911f654fa99e2cb8bfb57184b2061fe" +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.9" @@ -4504,6 +4855,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "sled" +version = "0.34.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +dependencies = [ + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot 0.11.2", +] + [[package]] name = "smallstr" version = "0.3.0" @@ -4944,6 +5311,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tap" version = "1.0.1" @@ -5013,6 +5386,15 @@ dependencies = [ "syn 2.0.49", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "third-party" version = "0.0.0" @@ -5027,13 +5409,14 @@ dependencies = [ "bytes 1.5.0", "chrono", "ciborium", - "clap", + "clap 4.5.1", "color-eyre", "colored", "comfy-table", "config", "console", "convert_case 0.6.0", + "criterion", "crossbeam-channel", "deadpool", "deadpool-postgres", @@ -5058,6 +5441,7 @@ dependencies = [ "itertools 0.12.1", "jwt-simple", "lazy_static", + "moka", "names", "nix 0.27.1", "nkeys 0.4.0", @@ -5096,6 +5480,7 @@ dependencies = [ "serde_url_params", "serde_with 3.6.1", "serde_yaml", + "sled", "sodiumoxide", "stream-cancel", "strum", @@ -5199,6 +5584,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -5225,7 +5620,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", @@ -5267,7 +5662,7 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot", + "parking_lot 0.12.1", "percent-encoding", "phf", "pin-project-lite", @@ -5670,6 +6065,12 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "triomphe" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" + [[package]] name = "try-lock" version = "0.2.5" diff --git a/third-party/rust/Cargo.toml b/third-party/rust/Cargo.toml index 45614abfbd..acaab557b1 100644 --- a/third-party/rust/Cargo.toml +++ b/third-party/rust/Cargo.toml @@ -44,6 +44,7 @@ comfy-table = { version = "7.0.1", features = [ config = { version = "0.13.4", default-features = false, features = ["toml"] } console = "0.15.7" convert_case = "0.6.0" +criterion = { version = "0.3", features = [ "async_tokio" ] } crossbeam-channel = "0.5.8" deadpool = { version = "0.10.0", features = ["rt_tokio_1"] } deadpool-postgres = "0.12.1" @@ -77,6 +78,7 @@ jwt-simple = { version = "0.12.6", default-features = false, features = [ "pure-rust", ] } lazy_static = "1.4.0" +moka = { version = "0.12.5", features = [ "future" ] } names = { version = "0.14.0", default-features = false } nix = { version = "0.27.1", features = ["process", "signal"] } nkeys = "0.4.0" @@ -108,6 +110,7 @@ reqwest = { version = "0.11.17", default-features = false, features = [ "multipart", ] } ring = "=0.17.5" # Upgrading this is possible, but a pain, so we don't want to pick up every new minor version (see: https://github.com/facebook/buck2/commit/91af40b66960d003067c3d241595fb53d1e636c8) +sled = "0.34.7" rustls = { version = "0.22.2" } rustls-pemfile = { version = "2.0.0" } rust-s3 = { version = "0.34.0-rc4", default-features = false, features = [ diff --git a/third-party/rust/fixups/criterion/fixups.toml b/third-party/rust/fixups/criterion/fixups.toml new file mode 100644 index 0000000000..41439d3356 --- /dev/null +++ b/third-party/rust/fixups/criterion/fixups.toml @@ -0,0 +1 @@ +cargo_env = true diff --git a/third-party/rust/fixups/moka/fixups.toml b/third-party/rust/fixups/moka/fixups.toml new file mode 100644 index 0000000000..690b8f3307 --- /dev/null +++ b/third-party/rust/fixups/moka/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +features = ["future"] diff --git a/third-party/rust/fixups/rayon-core/fixups.toml b/third-party/rust/fixups/rayon-core/fixups.toml new file mode 100644 index 0000000000..1e955b033f --- /dev/null +++ b/third-party/rust/fixups/rayon-core/fixups.toml @@ -0,0 +1,10 @@ +omit_targets = [] +extra_srcs = [] +omit_srcs = [] +rustc_flags = [] +cfgs = [] +features = [] +omit_features = [] +extra_deps = [] +omit_deps = [] +cargo_env = false diff --git a/third-party/rust/fixups/sled/fixups.toml b/third-party/rust/fixups/sled/fixups.toml new file mode 100644 index 0000000000..41439d3356 --- /dev/null +++ b/third-party/rust/fixups/sled/fixups.toml @@ -0,0 +1 @@ +cargo_env = true