From 577d210fa32d03a54051b544acde94b93857bcca Mon Sep 17 00:00:00 2001 From: Josh Comer Date: Thu, 19 Jan 2023 15:52:15 -0400 Subject: [PATCH 1/2] Caching Improvements --- Cargo.lock | 477 +++++++++++++++------------ Cargo.toml | 21 +- src/app/config.rs | 6 +- src/app/mod.rs | 3 +- src/app/server.rs | 272 +++++++++------ src/git.rs | 2 +- src/main.rs | 3 + src/storage/cache.rs | 108 ++++++ src/storage/lru.rs | 120 +++++++ src/storage/mod.rs | 3 + src/{app/db.rs => storage/sqlite.rs} | 150 +++------ 11 files changed, 736 insertions(+), 429 deletions(-) create mode 100644 src/storage/cache.rs create mode 100644 src/storage/lru.rs create mode 100644 src/storage/mod.rs rename src/{app/db.rs => storage/sqlite.rs} (67%) diff --git a/Cargo.lock b/Cargo.lock index 8fb1b21..a99b43f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,9 +21,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.2.2" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724" +checksum = "0070905b2c4a98d184c4e81025253cb192aa8a73827553f38e9410801ceb35bb" dependencies = [ "actix-codec", "actix-rt", @@ -52,8 +52,10 @@ dependencies = [ "rand 0.8.5", "sha1", "smallvec", + "tokio", + "tokio-util", "tracing", - "zstd", + "zstd 0.12.2+zstd.1.5.2", ] [[package]] @@ -62,8 +64,8 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" dependencies = [ - "quote 1.0.21", - "syn 1.0.103", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -75,15 +77,15 @@ dependencies = [ "bytestring", "http", "regex", - "serde 1.0.147", + "serde 1.0.152", "tracing", ] [[package]] name = "actix-rt" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" +checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" dependencies = [ "futures-core", "tokio", @@ -91,9 +93,9 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" +checksum = "3e8613a75dd50cc45f473cee3c34d59ed677c0f7b44480ce3b8247d7dc519327" dependencies = [ "actix-rt", "actix-service", @@ -130,9 +132,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.2.1" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9" +checksum = "464e0fddc668ede5f26ec1f9557a8d44eda948732f40c6b0ad79126930eb775f" dependencies = [ "actix-codec", "actix-http", @@ -160,7 +162,7 @@ dependencies = [ "once_cell", "pin-project-lite", "regex", - "serde 1.0.147", + "serde 1.0.152", "serde_json", "serde_urlencoded", "smallvec", @@ -176,9 +178,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa9362663c8643d67b2d5eafba49e4cb2c8a053a29ed00a0bea121f17c76b13" dependencies = [ "actix-router", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -219,6 +221,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -263,15 +276,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "arc-swap" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "arrayvec" @@ -281,9 +294,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "assert_cmd" -version = "2.0.6" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba45b8163c49ab5f972e59a8a5a03b6d2972619d486e19ec9fe744f7c2753d3c" +checksum = "9834fcc22e0874394a010230586367d4a3e9f11b560f469262678547e1d2575e" dependencies = [ "bstr", "doc-comment", @@ -299,7 +312,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -312,9 +325,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" [[package]] name = "base64ct" @@ -328,7 +341,7 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "serde 1.0.147", + "serde 1.0.152", ] [[package]] @@ -359,9 +372,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.2" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -369,21 +382,21 @@ dependencies = [ [[package]] name = "bstr" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca0852af221f458706eb0725c03e4ed6c46af9ac98e6a689d5e634215d594dd" +checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" dependencies = [ "memchr", "once_cell", "regex-automata", - "serde 1.0.147", + "serde 1.0.152", ] [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byteorder" @@ -408,9 +421,9 @@ dependencies = [ [[package]] name = "bzip2" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" dependencies = [ "bzip2-sys", "libc", @@ -429,9 +442,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" dependencies = [ "jobserver", ] @@ -458,7 +471,7 @@ dependencies = [ "js-sys", "num-integer", "num-traits 0.2.15", - "time 0.1.44", + "time 0.1.45", "wasm-bindgen", "winapi", ] @@ -518,7 +531,7 @@ dependencies = [ "lazy_static", "nom", "rust-ini", - "serde 1.0.147", + "serde 1.0.152", "serde-hjson", "serde_json", "toml", @@ -561,9 +574,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cookie" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", "time 0.3.17", @@ -621,9 +634,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e" dependencies = [ "cc", "cxxbridge-flags", @@ -633,34 +646,34 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200" dependencies = [ "cc", "codespan-reporting", "once_cell", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.50", + "quote 1.0.23", "scratch", - "syn 1.0.103", + "syn 1.0.107", ] [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -681,10 +694,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.50", + "quote 1.0.23", "rustc_version", - "syn 1.0.103", + "syn 1.0.107", ] [[package]] @@ -741,9 +754,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dogstatsd" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3092ac5a2890a957ce721898ac43515817ffc69070f548b3141cc5ba346c08d3" +checksum = "2cbc754e9edf0fa60081cf73d35302d5da70ea093577de2169d82aff6e25f93d" dependencies = [ "chrono", ] @@ -786,9 +799,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "miniz_oxide", @@ -879,9 +892,9 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -948,9 +961,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" +checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" dependencies = [ "bitflags", "libc", @@ -982,14 +995,14 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.5" +version = "4.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd" +checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a" dependencies = [ "log", "pest", "pest_derive", - "serde 1.0.147", + "serde 1.0.152", "serde_json", "thiserror", ] @@ -1003,13 +1016,22 @@ dependencies = [ "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] + [[package]] name = "hashlink" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1030,6 +1052,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hmac" version = "0.12.1" @@ -1041,7 +1072,7 @@ dependencies = [ [[package]] name = "hogan" -version = "0.14.0" +version = "0.15.0" dependencies = [ "actix-web", "anyhow", @@ -1058,14 +1089,14 @@ dependencies = [ "json-patch", "lazy_static", "log", - "lru_time_cache", + "lru", "parking_lot", "predicates", "regex", "riker", "riker-patterns", "rusqlite", - "serde 1.0.147", + "serde 1.0.152", "serde_derive", "serde_json", "shellexpand", @@ -1076,7 +1107,6 @@ dependencies = [ "url", "uuid 1.2.2", "walkdir", - "which", "zip", ] @@ -1144,7 +1174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1167,9 +1197,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -1191,12 +1221,13 @@ dependencies = [ [[package]] name = "json-patch" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f995a3c8f2bc3dd52a18a583e90f9ec109c047fa1603a853e46bcda14d2e279d" +checksum = "e712e62827c382a77b87f590532febb1f8b2fdbc3eefa1ee37fe7281687075ef" dependencies = [ - "serde 1.0.147", + "serde 1.0.152", "serde_json", + "thiserror", "treediff", ] @@ -1227,15 +1258,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libgit2-sys" -version = "0.14.0+1.5.0" +version = "0.14.2+1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a00859c70c8a4f7218e6d1cc32875c4b55f6799445b842b0d8ed5e4c3d959b" +checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4" dependencies = [ "cc", "libc", @@ -1284,9 +1315,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -1345,10 +1376,13 @@ dependencies = [ ] [[package]] -name = "lru_time_cache" -version = "0.11.11" +name = "lru" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9106e1d747ffd48e6be5bb2d97fa706ed25b144fbee4d5c02eae110cd8d6badd" +checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" +dependencies = [ + "hashbrown 0.13.2", +] [[package]] name = "memchr" @@ -1364,9 +1398,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -1430,19 +1464,19 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "opaque-debug" @@ -1467,9 +1501,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -1491,9 +1525,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1515,9 +1549,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -1539,9 +1573,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" +checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" dependencies = [ "thiserror", "ucd-trie", @@ -1549,9 +1583,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.4.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f" +checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea" dependencies = [ "pest", "pest_generator", @@ -1559,26 +1593,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.4.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4" +checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] name = "pest_meta" -version = "2.4.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe" +checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d" dependencies = [ "once_cell", "pest", - "sha1", + "sha2", ] [[package]] @@ -1607,9 +1641,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" -version = "2.1.3" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6bd09a7f7e68f3f0bf710fb7ab9c4615a488b58b5f653382a687701e458c92" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", @@ -1642,9 +1676,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", "version_check", ] @@ -1654,16 +1688,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.50", + "quote 1.0.23", "version_check", ] [[package]] name = "proc-macro-hack" -version = "0.5.19" +version = "0.5.20+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" @@ -1676,9 +1710,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] @@ -1694,11 +1728,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.50", ] [[package]] @@ -1794,9 +1828,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -1897,9 +1931,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "same-file" @@ -1918,15 +1952,15 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" @@ -1936,9 +1970,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -1958,24 +1992,24 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", - "serde 1.0.147", + "serde 1.0.152", ] [[package]] @@ -1996,7 +2030,7 @@ dependencies = [ "form_urlencoded", "itoa", "ryu", - "serde 1.0.147", + "serde 1.0.152", ] [[package]] @@ -2023,9 +2057,9 @@ dependencies = [ [[package]] name = "shellexpand" -version = "2.1.2" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +checksum = "dd1c7ddea665294d484c39fd0c0d2b7e35bbfe10035c5fe1854741a57f6880e1" dependencies = [ "dirs", ] @@ -2136,9 +2170,9 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -2160,12 +2194,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.103" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.50", + "quote 1.0.23", "unicode-ident", ] @@ -2209,22 +2243,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", ] [[package]] @@ -2238,9 +2272,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -2254,7 +2288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa", - "serde 1.0.147", + "serde 1.0.152", "time-core", "time-macros", ] @@ -2300,9 +2334,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" dependencies = [ "autocfg", "bytes", @@ -2313,7 +2347,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2", - "winapi", + "windows-sys", ] [[package]] @@ -2332,11 +2366,11 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "serde 1.0.147", + "serde 1.0.152", ] [[package]] @@ -2362,18 +2396,18 @@ dependencies = [ [[package]] name = "treediff" -version = "3.0.2" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761e8d5ad7ce14bb82b7e61ccc0ca961005a275a060b9644a2431aa11553c2ff" +checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" dependencies = [ "serde_json", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" @@ -2383,15 +2417,15 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -2524,9 +2558,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", "wasm-bindgen-shared", ] @@ -2536,7 +2570,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ - "quote 1.0.21", + "quote 1.0.23", "wasm-bindgen-macro-support", ] @@ -2546,9 +2580,9 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", + "proc-macro2 1.0.50", + "quote 1.0.23", + "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2559,17 +2593,6 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" -[[package]] -name = "which" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" -dependencies = [ - "either", - "libc", - "once_cell", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2618,45 +2641,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "yaml-rust" @@ -2684,7 +2707,7 @@ dependencies = [ "pbkdf2", "sha1", "time 0.3.17", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] @@ -2693,7 +2716,16 @@ version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "zstd-safe", + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9262a83dc741c0b0ffec209881b45dbc232c21b02a2b9cb1adb93266e41303d" +dependencies = [ + "zstd-safe 6.0.2+zstd.1.5.2", ] [[package]] @@ -2706,12 +2738,23 @@ dependencies = [ "zstd-sys", ] +[[package]] +name = "zstd-safe" +version = "6.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cf39f730b440bab43da8fb5faf5f254574462f73f260f85f7987f32154ff17" +dependencies = [ + "libc", + "zstd-sys", +] + [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.5+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 7640c80..b91987e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ doc = false [package] name = 'hogan' -version = '0.14.0' +version = '0.15.0' authors = [ 'Jonathan Morley ', 'Josh Comer ', @@ -13,31 +13,30 @@ authors = [ edition = '2021' [dependencies] -actix-web = '4.0' +actix-web = '4.3' anyhow = '1.0' bincode = '1.3' compression = '0.1' -dogstatsd = '0.6' +dogstatsd = '0.7' futures = '0.3' -handlebars = '4.1' +handlebars = '4.3' itertools = '0.10' -json-patch = '0.2' +json-patch = '0.3' lazy_static = '1' log = '0.4' -lru_time_cache = '0.11' +lru = '0.9' parking_lot = '0.12' riker = '0.4' riker-patterns = '0.4' serde_derive = '1.0' serde_json = '1.0' -shellexpand = '2.1' +shellexpand = '3.0' stderrlog = '0.5' structopt = '0.3' tempfile = '3' thiserror = '1.0' url = '2' walkdir = '2' -which = '4.0' zip = '0.6' [dependencies.rusqlite] @@ -45,11 +44,11 @@ version = '0.28' features = ['bundled'] [dependencies.git2] -version = '0.15' +version = '0.16' features = ['vendored-openssl'] [dependencies.regex] -version = '1' +version = '1.7' default-features = false [dependencies.serde] @@ -57,7 +56,7 @@ version = '1.0' features = ['rc'] [dependencies.uuid] -version = '1.1' +version = '1.2' features = ['v4'] [dev-dependencies] diff --git a/src/app/config.rs b/src/app/config.rs index 095b504..fa0d155 100644 --- a/src/app/config.rs +++ b/src/app/config.rs @@ -78,7 +78,7 @@ pub enum AppCommand { )] address: String, - /// Set the oldest age of items to keep in the DB at startup in days + /// Set the oldest age of items to keep in the caches (in days) #[structopt( long = "db-age", default_value = "120", @@ -86,6 +86,10 @@ pub enum AppCommand { )] db_max_age: usize, + /// Set the size of the in memory cache + #[structopt(long = "cache-size", default_value = "64", value_name = "CACHE_SIZE")] + cache_size: usize, + /// Filter environments to render templates for #[structopt( short = "e", diff --git a/src/app/mod.rs b/src/app/mod.rs index c69a826..c7a3780 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,7 +1,6 @@ pub mod cli; pub mod config; -mod datadogstatsd; -mod db; +pub mod datadogstatsd; mod fetch_actor; mod head_actor; pub mod server; diff --git a/src/app/server.rs b/src/app/server.rs index 4be4ae1..79d31cc 100644 --- a/src/app/server.rs +++ b/src/app/server.rs @@ -1,8 +1,11 @@ use crate::app::config::AppCommon; use crate::app::datadogstatsd::{CustomMetrics, DdMetrics}; -use crate::app::db; use crate::app::fetch_actor; use crate::app::head_actor; +use crate::storage::cache::Cache; +use crate::storage::cache::CleanupActor; +use crate::storage::lru::LruEnvCache; +use crate::storage::sqlite::SqliteCache; use actix_web::dev::Service; use actix_web::middleware::Logger; use actix_web::{get, middleware, post, web, HttpResponse, HttpServer}; @@ -27,7 +30,7 @@ struct ServerState { allow_fetch: bool, dd_metrics: Arc, environment_pattern: String, - db_path: String, + caches: Vec>>, actor_system: ActorSystem, head_request_actor: head_actor::HeadRequestActor, } @@ -91,13 +94,22 @@ pub fn start_up_server( datadog: bool, environment_pattern: String, db_path: String, + cache_size: usize, fetch_poller: u64, allow_fetch: bool, db_max_age: usize, ) -> Result<()> { - if let Err(e) = db::clean_db(&db_path, db_max_age) { - warn!("Unable to clean db on startup: {:?}", e); - }; + let caches: Vec>> = vec![ + Arc::new(Box::new(LruEnvCache::new("lru", cache_size)?)), + Arc::new(Box::new(SqliteCache::new(&db_path))), + ]; + + for cache in caches.iter() { + if let Err(e) = cache.clean(db_max_age) { + warn!("Unable to clean {} cache on startup: {:?}", cache.id(), e); + }; + } + info!("datadog monitoring is setting: {}", datadog); let dd_metrics = Arc::new(DdMetrics::new(datadog)); let config_dir = Arc::new(ConfigDir::new( @@ -119,7 +131,7 @@ pub fn start_up_server( fetch_poller, ); - db::init_db_cleanup_system(&actor_system, &db_path, db_max_age, dd_metrics.clone()); + CleanupActor::init_db_cleanup_system(&actor_system, &caches, db_max_age, dd_metrics.clone()); let write_lock = Mutex::new(0); @@ -132,7 +144,7 @@ pub fn start_up_server( strict: common.strict, dd_metrics, environment_pattern, - db_path, + caches, actor_system, head_request_actor, allow_fetch, @@ -481,93 +493,153 @@ async fn transform_branch_head( } } -fn register_cache_hit(state: &ServerState, key: &str) { - debug!("Cache Hit {}", key); +fn register_cache_hit(state: &ServerState) { state.dd_metrics.incr( CustomMetrics::Cache.into(), Some(vec!["action:hit".to_string()]), ); } -fn register_cache_miss(state: &ServerState, key: &str) { - debug!("Cache Miss {}", key); +fn register_cache_miss(state: &ServerState) { state.dd_metrics.incr( CustomMetrics::Cache.into(), Some(vec!["action:miss".to_string()]), ); } +fn check_caches_env( + caches: &[Arc>], + env: &str, + sha: &str, +) -> Option> { + for (index, cache) in caches.iter().enumerate() { + if let Some(environment) = cache.read_env(env, sha).unwrap_or(None) { + debug!("Found env in {} cache. Env {} Sha {}", cache.id(), env, sha); + if index > 0 { + //Fill in the caches which are missing the data + for missing_cache in caches.iter().take(index) { + debug!( + "Writing env to {} cache. Env {} Sha {}", + missing_cache.id(), + env, + sha + ); + if let Err(e) = missing_cache.write_env(env, sha, environment.as_ref()) { + error!( + "Unable to write sha {} env {} to {} cache: {:?}", + sha, + env, + missing_cache.id(), + e + ) + } + } + } + return Some(environment); + } + } + None +} + fn get_env( state: &ServerState, remote: Option<&str>, sha: &str, env: &str, ) -> Result> { - let key = db::gen_env_key(sha, env); + let caches = &state.caches; - //Check embedded db before git repo - if let Some(environment) = db::read_sql_env(&state.db_path, env, sha).unwrap_or(None) { - debug!("Found environment in the db {} {}", env, sha); - register_cache_hit(state, &key); - Ok(Arc::new(environment)) - } else { - // This locks mutating the git repo - let _write_lock = match state.write_lock.try_lock_for(Duration::from_secs(20)) { - Some(lock) => lock, - None => { - warn!( - "Unable to acquire write lock in a timely manner: {} {}", - sha, env - ); - return Err(HoganError::InternalTimeout.into()); - } - }; + //Check caches before git repo + if let Some(environment) = check_caches_env(caches, env, sha) { + register_cache_hit(state); + return Ok(environment); + } - //Since waiting for the lock may take unknown time double check if the cache now contains the env we are looking for - if let Some(environment) = db::read_sql_env(&state.db_path, env, sha).unwrap_or(None) { - register_cache_hit(state, &key); - debug!("Avoided git lock for config lookup: {}", key); - return Ok(Arc::new(environment)); + // This locks mutating the git repo + let _write_lock = match state.write_lock.try_lock_for(Duration::from_secs(20)) { + Some(lock) => lock, + None => { + warn!( + "Unable to acquire write lock in a timely manner: {} {}", + sha, env + ); + return Err(HoganError::InternalTimeout.into()); } + }; - register_cache_miss(state, &key); + //Since waiting for the lock may take unknown time double check if the cache now contains the env we are looking for + if let Some(environment) = check_caches_env(caches, env, sha) { + register_cache_hit(state); + return Ok(environment); + } - let sha = state - .config_dir - .refresh(remote, Some(sha), state.allow_fetch)?; + register_cache_miss(state); - let filter = match hogan::config::build_env_regex(env, Some(&state.environment_pattern)) { - Ok(filter) => filter, - Err(e) => { - warn!("Incompatible env name: {} {:?}", env, e); - //In an error scenario we'll still try and match against all configs - state.environments_regex.clone() - } - }; - if let Some(environment) = state - .config_dir - .find(filter) - .iter() - .find(|e| e.environment == env) - { - if let Err(e) = db::write_sql_env(&state.db_path, env, &sha, environment) { - warn!( - "Unable to write env {} {} to db {:?}", - key, - db::gen_env_key(&sha, env), + let sha = state + .config_dir + .refresh(remote, Some(sha), state.allow_fetch)?; + + let filter = match hogan::config::build_env_regex(env, Some(&state.environment_pattern)) { + Ok(filter) => filter, + Err(e) => { + warn!("Incompatible env name: {} {:?}", env, e); + //In an error scenario we'll still try and match against all configs + state.environments_regex.clone() + } + }; + if let Some(environment) = state + .config_dir + .find(filter) + .iter() + .find(|e| e.environment == env) + { + for cache in caches { + if let Err(e) = cache.write_env(env, &sha, environment) { + error!( + "Unable to write sha {} env {} to {} cache: {:?}", + sha, + env, + cache.id(), e - ); - }; - Ok(Arc::new(environment.clone())) - } else { - debug!("Unable to find the env {} in {}", env, sha); - Err(HoganError::UnknownEnvironment { - sha, - env: env.to_owned(), + ) + } + } + Ok(Arc::new(environment.clone())) + } else { + debug!("Unable to find the env {} in {}", env, sha); + Err(HoganError::UnknownEnvironment { + sha, + env: env.to_owned(), + } + .into()) + } +} + +fn check_caches_env_listing( + caches: &[Arc>], + sha: &str, +) -> Option>> { + for (index, cache) in caches.iter().enumerate() { + if let Some(environment_description) = cache.read_env_listing(sha).unwrap_or(None) { + if index > 0 { + //Fill in the caches which are missing the data + for missing_cache in caches.iter().take(index) { + if let Err(e) = + missing_cache.write_env_listing(sha, environment_description.as_ref()) + { + log::error!( + "Unable to write env listings to {} cache {} {:?}", + missing_cache.id(), + sha, + e + ); + } + } } - .into()) + return Some(environment_description); } } + None } fn get_env_listing( @@ -575,43 +647,53 @@ fn get_env_listing( remote: Option<&str>, sha: &str, ) -> Result>> { - if let Ok(Some(env)) = db::read_sql_env_listing(&state.db_path, sha) { - register_cache_hit(state, sha); + let caches = &state.caches; + + if let Some(env) = check_caches_env_listing(caches, sha) { + register_cache_hit(state); return Ok(Arc::new(env.iter().map(|x| x.into()).collect())); - } else { - let _write_lock = match state.write_lock.try_lock_for(Duration::from_secs(20)) { - Some(l) => l, - None => { - log::warn!( - "Unable to acquire write lock for env listing in a timely manner {}", - sha - ); - return Err(HoganError::InternalTimeout.into()); - } - }; + } - if let Ok(Some(env)) = db::read_sql_env_listing(&state.db_path, sha) { - register_cache_hit(state, sha); - return Ok(Arc::new(env.iter().map(|x| x.into()).collect())); + let _write_lock = match state.write_lock.try_lock_for(Duration::from_secs(20)) { + Some(l) => l, + None => { + log::warn!( + "Unable to acquire write lock for env listing in a timely manner {}", + sha + ); + return Err(HoganError::InternalTimeout.into()); } + }; - register_cache_miss(state, sha); + if let Some(env) = check_caches_env_listing(caches, sha) { + register_cache_hit(state); + return Ok(Arc::new(env.iter().map(|x| x.into()).collect())); + } - let sha = state - .config_dir - .refresh(remote, Some(sha), state.allow_fetch)?; + register_cache_miss(state); - let envs = format_envs(&state.config_dir.find(state.environments_regex.clone())); - let to_cache_envs = envs - .iter() - .map(|x| x.into()) - .collect::>(); - if let Err(e) = db::write_sql_env_listing(&state.db_path, &sha, &to_cache_envs) { - log::error!("Unable to write env listings to db {} {:?}", sha, e); - } + let sha = state + .config_dir + .refresh(remote, Some(sha), state.allow_fetch)?; + + let envs = format_envs(&state.config_dir.find(state.environments_regex.clone())); + let to_cache_envs = envs + .iter() + .map(|x| x.into()) + .collect::>(); - Ok(Arc::new(envs)) + for cache in caches { + if let Err(e) = cache.write_env_listing(&sha, &to_cache_envs) { + log::error!( + "Unable to write env listings to {} cache {} {:?}", + cache.id(), + sha, + e + ); + } } + + Ok(Arc::new(envs)) } fn format_envs(envs: &[hogan::config::Environment]) -> Vec { diff --git a/src/git.rs b/src/git.rs index 7d6ffbd..c4dbd33 100644 --- a/src/git.rs +++ b/src/git.rs @@ -124,7 +124,7 @@ fn detach_head(repo: &Repository, sha: &str) -> Result<()> { } pub fn ext_fetch(path: &Path, remote: &str) -> Result<()> { - info!("Fetching {}", remote); + debug!("Fetching {}", remote); let mut fetch_cmd = Command::new("git") .current_dir(path.to_str().unwrap()) .args(["fetch", "--prune", remote]) diff --git a/src/main.rs b/src/main.rs index 195924a..bea3066 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ use anyhow::{Context, Result}; use structopt::StructOpt; mod app; +mod storage; fn main() -> Result<()> { let opt = App::from_args(); @@ -49,6 +50,7 @@ fn main() -> Result<()> { fetch_poller, allow_fetch, db_max_age, + cache_size, } => { server::start_up_server( common, @@ -58,6 +60,7 @@ fn main() -> Result<()> { datadog, environment_pattern, db_path, + cache_size, fetch_poller, allow_fetch, db_max_age, diff --git a/src/storage/cache.rs b/src/storage/cache.rs new file mode 100644 index 0000000..533bbe2 --- /dev/null +++ b/src/storage/cache.rs @@ -0,0 +1,108 @@ +use crate::app::datadogstatsd::CustomMetrics; +use crate::app::datadogstatsd::DdMetrics; +use anyhow::Result; +use hogan::config::Environment; +use hogan::config::EnvironmentDescription; +use riker::actors::*; +use std::sync::Arc; +use std::time::{Duration, SystemTime}; + +pub trait Cache { + fn id(&self) -> &str; + fn clean(&self, max_age: usize) -> Result<()>; + fn read_env(&self, env: &str, sha: &str) -> Result>>; + fn write_env(&self, env: &str, sha: &str, data: &Environment) -> Result<()>; + fn read_env_listing(&self, sha: &str) -> Result>>>; + fn write_env_listing(&self, sha: &str, data: &[EnvironmentDescription]) -> Result<()>; +} + +#[derive(Debug, Clone)] +struct ExecuteCleanup {} + +type CacheBox = Arc>; + +#[actor(ExecuteCleanup)] +pub struct CleanupActor { + caches: Vec, + max_age: usize, + metrics: Arc, +} + +impl ActorFactoryArgs<(Vec, usize, Arc)> for CleanupActor { + fn create_args((caches, max_age, metrics): (Vec, usize, Arc)) -> Self { + CleanupActor { + caches, + max_age, + metrics, + } + } +} + +impl Actor for CleanupActor { + type Msg = CleanupActorMsg; + + fn recv(&mut self, ctx: &Context, msg: Self::Msg, sender: Sender) { + self.receive(ctx, msg, sender); + } +} + +impl Receive for CleanupActor { + type Msg = CleanupActorMsg; + + fn receive(&mut self, _ctx: &Context, _msg: ExecuteCleanup, _sender: Sender) { + let now = SystemTime::now(); + for cache in self.caches.iter() { + match cache.clean(self.max_age) { + Ok(()) => { + let duration = now.elapsed().unwrap_or(Duration::from_millis(0)); + info!( + "Cleaned entries from the {} cache older than {} days. Time {} ms", + cache.id(), + self.max_age, + duration.as_millis() + ); + self.metrics.time( + CustomMetrics::DbCleanup.into(), + None, + duration.as_millis() as i64, + ); + } + Err(err) => { + error!("Unable to clean the {} cache: {:?}", cache.id(), err); + } + } + } + } +} + +impl CleanupActor { + pub fn init_db_cleanup_system( + system: &ActorSystem, + caches: &[CacheBox], + max_age: usize, + metrics: Arc, + ) { + let cleanup_poller_delay = 24 * 60 * 60; //1 day + let worker = system + .actor_of_args::( + "db-cleanup-worker", + (caches.to_owned(), max_age, metrics), + ) + .unwrap(); + + system.schedule( + Duration::from_secs(cleanup_poller_delay), + Duration::from_secs(cleanup_poller_delay), + worker.clone(), + None, + ExecuteCleanup {}, + ); + + info!( + "Scheduled db cleanup poller for every {} s", + cleanup_poller_delay + ); + + worker.tell(ExecuteCleanup {}, None); + } +} diff --git a/src/storage/lru.rs b/src/storage/lru.rs new file mode 100644 index 0000000..3415c41 --- /dev/null +++ b/src/storage/lru.rs @@ -0,0 +1,120 @@ +use crate::storage::cache::Cache; +use anyhow::{anyhow, Result}; +use hogan::config::Environment; +use hogan::config::EnvironmentDescription; +use lru::LruCache; +use parking_lot::Mutex; +use regex::Regex; +use std::num::NonZeroUsize; +use std::sync::Arc; +use std::time::Duration; + +pub struct LruEnvCache { + env_lru: Mutex>>, + env_listing_lru: Mutex>>>, + name: String, +} + +impl LruEnvCache { + pub fn new(id: &str, cache_size: usize) -> Result { + let size = match NonZeroUsize::new(cache_size) { + Some(s) => s, + None => { + return Err(anyhow!( + "Cache size must be positive. Passed {}", + cache_size + )) + } + }; + + Ok(LruEnvCache { + name: id.to_string(), + env_lru: Mutex::new(LruCache::new(size)), + env_listing_lru: Mutex::new(LruCache::new(size)), + }) + } +} + +impl Cache for LruEnvCache { + fn id(&self) -> &str { + &self.name + } + + fn clean(&self, _max_age: usize) -> anyhow::Result<()> { + Ok(()) + } + + fn read_env(&self, env: &str, sha: &str) -> Result>> { + if let Some(mut cache) = self.env_lru.try_lock_for(Duration::from_secs(15)) { + let key_regex = gen_env_regex(env, sha); + if let Some(key) = cache + .iter() + .filter_map(|(k, _)| if key_regex.is_match(k) { Some(k) } else { None }) + .next() + .cloned() + { + //We have to explicitly get the key out of the may for the LRU to work + Ok(cache.get(&key).cloned()) + } else { + Ok(None) + } + } else { + Err(anyhow!("Unable to acquire Env lock")) + } + } + + fn write_env(&self, env: &str, sha: &str, data: &Environment) -> anyhow::Result<()> { + if let Some(mut cache) = self.env_lru.try_lock_for(Duration::from_secs(15)) { + let key = gen_env_key(env, sha); + cache.put(key, Arc::new(data.clone())); + Ok(()) + } else { + Err(anyhow!("Unable to acquire Env lock")) + } + } + + fn read_env_listing(&self, sha: &str) -> Result>>> { + if let Some(mut cache) = self.env_listing_lru.try_lock_for(Duration::from_secs(15)) { + let key_regex = gen_env_listing_regex(sha); + if let Some(key) = cache + .iter() + .filter_map(|(k, _)| if key_regex.is_match(k) { Some(k) } else { None }) + .next() + .cloned() + { + //We have to explicitly get the key out of the may for the LRU to work + Ok(cache.get(&key).cloned()) + } else { + Ok(None) + } + } else { + Err(anyhow!("Unable to acquire Env Listing lock")) + } + } + + fn write_env_listing(&self, sha: &str, data: &[EnvironmentDescription]) -> Result<()> { + if let Some(mut cache) = self.env_listing_lru.try_lock_for(Duration::from_secs(15)) { + let key = gen_env_listing_key(sha); + cache.put(key, Arc::new(data.to_vec())); + Ok(()) + } else { + Err(anyhow!("Unable to acquire Env Listing lock")) + } + } +} + +fn gen_env_key(env: &str, sha: &str) -> String { + format!("{}::{}", sha, env) +} + +fn gen_env_regex(env: &str, sha: &str) -> Regex { + Regex::new(&format!("^{}.*::{}$", sha, env)).unwrap() +} + +fn gen_env_listing_key(sha: &str) -> String { + sha.to_string() +} + +fn gen_env_listing_regex(sha: &str) -> Regex { + Regex::new(&format!("^{}.*$", sha)).unwrap() +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs new file mode 100644 index 0000000..f68f1fc --- /dev/null +++ b/src/storage/mod.rs @@ -0,0 +1,3 @@ +pub mod cache; +pub mod lru; +pub mod sqlite; diff --git a/src/app/db.rs b/src/storage/sqlite.rs similarity index 67% rename from src/app/db.rs rename to src/storage/sqlite.rs index 08342d4..f9a1b4c 100644 --- a/src/app/db.rs +++ b/src/storage/sqlite.rs @@ -1,20 +1,52 @@ #![allow(clippy::from_over_into)] - +use crate::storage::cache::Cache; use anyhow::Result; use compression::prelude::*; use hogan::config::Environment; use hogan::config::EnvironmentDescription; -use riker::actors::*; use rusqlite::{params, Connection, OpenFlags}; use serde::Deserialize; use serde::Serialize; use std::sync::Arc; -use std::time::Duration; -use std::time::SystemTime; -use crate::app::datadogstatsd::CustomMetrics; +#[derive(Debug, Clone)] +pub struct SqliteCache { + db_path: String, +} -use super::datadogstatsd::DdMetrics; +impl SqliteCache { + pub fn new(db_path: &str) -> Self { + SqliteCache { + db_path: db_path.to_string(), + } + } +} + +impl Cache for SqliteCache { + fn id(&self) -> &str { + &self.db_path + } + + fn clean(&self, max_age: usize) -> Result<()> { + clean_db(&self.db_path, max_age).map(|_| ()) + } + + fn read_env(&self, env: &str, sha: &str) -> Result>> { + read_sql_env(&self.db_path, env, sha) + } + + fn write_env(&self, env: &str, sha: &str, data: &Environment) -> Result<()> { + write_sql_env(&self.db_path, env, sha, data).map(|_| ()) + } + + fn read_env_listing(&self, sha: &str) -> Result>>> { + read_sql_env_listing(&self.db_path, sha) + } + + fn write_env_listing(&self, sha: &str, data: &[EnvironmentDescription]) -> Result<()> { + write_sql_env_listing(&self.db_path, sha, data).map(|_| ()) + } +} fn open_sql_db(db_path: &str, read_only: bool) -> Result { let read_flag = if read_only { @@ -40,7 +72,7 @@ fn open_sql_db(db_path: &str, read_only: bool) -> Result { Ok(conn) } -pub fn clean_db(db_path: &str, db_max_age: usize) -> Result { +fn clean_db(db_path: &str, db_max_age: usize) -> Result { info!( "Clearing db {} of all items older than {} days", db_path, db_max_age @@ -53,7 +85,7 @@ pub fn clean_db(db_path: &str, db_max_age: usize) -> Result { Ok(data) } -pub fn read_sql_env(db_path: &str, env: &str, sha: &str) -> Result> { +fn read_sql_env(db_path: &str, env: &str, sha: &str) -> Result>> { let conn = open_sql_db(db_path, true)?; let mut query = conn.prepare("SELECT data FROM hogan WHERE key LIKE ? || '%' LIMIT 1")?; let key = gen_env_key(sha, env); @@ -71,14 +103,14 @@ pub fn read_sql_env(db_path: &str, env: &str, sha: &str) -> Result Result { +fn write_sql_env(db_path: &str, env: &str, sha: &str, data: &Environment) -> Result { let conn = open_sql_db(db_path, false)?; let key = gen_env_key(sha, env); let env_data: WritableEnvironment = data.into(); @@ -103,11 +135,11 @@ pub fn write_sql_env(db_path: &str, env: &str, sha: &str, data: &Environment) -> .map_err(|e| e.into()) } -pub fn gen_env_key(sha: &str, env: &str) -> String { +fn gen_env_key(sha: &str, env: &str) -> String { format!("{}::{}", env, sha) } -pub fn gen_env_listing_key(sha: &str) -> String { +fn gen_env_listing_key(sha: &str) -> String { format!("!listing::{}", sha) } @@ -151,7 +183,7 @@ impl From<&[EnvironmentDescription]> for WritableEnvironmentListing { } } -pub fn write_sql_env_listing( +fn write_sql_env_listing( db_path: &str, sha: &str, data: &[EnvironmentDescription], @@ -180,10 +212,10 @@ pub fn write_sql_env_listing( .map_err(|e| e.into()) } -pub fn read_sql_env_listing( +fn read_sql_env_listing( db_path: &str, sha: &str, -) -> Result>> { +) -> Result>>> { let conn = open_sql_db(db_path, true)?; let mut query = conn.prepare("SELECT data FROM hogan WHERE key LIKE ? || '%' LIMIT 1")?; let key = gen_env_listing_key(sha); @@ -201,95 +233,9 @@ pub fn read_sql_env_listing( return Err(e.into()); } }; - Ok(Some(decoded.environments)) + Ok(Some(Arc::new(decoded.environments))) } else { debug!("Unable to find {} in sqlite db", key); Ok(None) } } - -#[derive(Debug, Clone)] -pub struct ExecuteCleanup {} - -#[actor(ExecuteCleanup)] -#[derive(Debug)] -struct CleanupActor { - db_path: String, - max_age: usize, - metrics: Arc, -} - -impl ActorFactoryArgs<(String, usize, Arc)> for CleanupActor { - fn create_args((db_path, max_age, metrics): (String, usize, Arc)) -> Self { - CleanupActor { - db_path, - max_age, - metrics, - } - } -} - -impl Actor for CleanupActor { - type Msg = CleanupActorMsg; - - fn recv(&mut self, ctx: &Context, msg: Self::Msg, sender: Sender) { - self.receive(ctx, msg, sender); - } -} - -impl Receive for CleanupActor { - type Msg = CleanupActorMsg; - - fn receive(&mut self, _ctx: &Context, _msg: ExecuteCleanup, _sender: Sender) { - let now = SystemTime::now(); - match clean_db(&self.db_path, self.max_age) { - Ok(rows) => { - let duration = now.elapsed().unwrap_or(Duration::from_millis(0)); - info!( - "Cleaned {} rows from the database older than {} days. Time {} ms", - rows, - self.max_age, - duration.as_millis() - ); - self.metrics.time( - CustomMetrics::DbCleanup.into(), - None, - duration.as_millis() as i64, - ); - } - Err(err) => { - error!("Unable to clean the db {:?}", err); - } - } - } -} - -pub fn init_db_cleanup_system( - system: &ActorSystem, - db_path: &str, - max_age: usize, - metrics: Arc, -) { - let cleanup_poller_delay = 24 * 60 * 60; //1 day - let worker = system - .actor_of_args::( - "db-cleanup-worker", - (db_path.to_owned(), max_age, metrics), - ) - .unwrap(); - - system.schedule( - Duration::from_secs(cleanup_poller_delay), - Duration::from_secs(cleanup_poller_delay), - worker.clone(), - None, - ExecuteCleanup {}, - ); - - info!( - "Scheduled db cleanup poller for every {} s", - cleanup_poller_delay - ); - - worker.tell(ExecuteCleanup {}, None); -} From e5aa71d701940e4a003dc5399a13b9ca7b20fcb8 Mon Sep 17 00:00:00 2001 From: Josh Comer Date: Wed, 25 Jan 2023 09:42:38 -0400 Subject: [PATCH 2/2] Cleanup warning --- src/storage/cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/cache.rs b/src/storage/cache.rs index 533bbe2..8ab3c13 100644 --- a/src/storage/cache.rs +++ b/src/storage/cache.rs @@ -17,7 +17,7 @@ pub trait Cache { } #[derive(Debug, Clone)] -struct ExecuteCleanup {} +pub struct ExecuteCleanup {} type CacheBox = Arc>;