From 90f9b80dd9ba12fff4598600a23fa4951e814576 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Fri, 22 Sep 2023 23:43:45 -0400 Subject: [PATCH] Add some tests to verify that a file can be added to the system Still gutting a lot of the old code, but this MR focuses more on ensuring that a file can be added and that the metadata gets saved. --- Cargo.lock | 72 +- file-service/.ignore | 1 + file-service/Cargo.lock | 1404 ------------------ file-service/Cargo.toml | 2 +- file-service/src/lib/fileinfo.rs | 194 --- file-service/src/main.rs | 8 +- file-service/src/pages.rs | 5 +- file-service/src/{lib => store}/file.rs | 95 +- file-service/src/store/fileinfo.rs | 122 ++ file-service/src/{lib => store}/mod.rs | 55 +- file-service/src/{lib => store}/thumbnail.rs | 2 +- file-service/src/{lib => store}/utils.rs | 0 file-service/var/.placeholder | 0 13 files changed, 221 insertions(+), 1739 deletions(-) delete mode 100644 file-service/Cargo.lock delete mode 100644 file-service/src/lib/fileinfo.rs rename file-service/src/{lib => store}/file.rs (78%) create mode 100644 file-service/src/store/fileinfo.rs rename file-service/src/{lib => store}/mod.rs (71%) rename file-service/src/{lib => store}/thumbnail.rs (98%) rename file-service/src/{lib => store}/utils.rs (100%) create mode 100644 file-service/var/.placeholder diff --git a/Cargo.lock b/Cargo.lock index 3955b06..8a792f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,18 +158,6 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -179,15 +167,6 @@ dependencies = [ "generic-array 0.14.7", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "bodyparser" version = "0.8.0" @@ -223,12 +202,6 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "bytemuck" version = "1.13.1" @@ -550,22 +523,13 @@ dependencies = [ "byteorder", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", ] @@ -678,12 +642,6 @@ dependencies = [ "zune-inflate", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fastrand" version = "2.0.0" @@ -1017,15 +975,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2325,12 +2274,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "openssl" version = "0.10.57" @@ -3309,19 +3252,18 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] name = "sha2" -version = "0.8.2" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] diff --git a/file-service/.ignore b/file-service/.ignore index 116caa1..bfd1343 100644 --- a/file-service/.ignore +++ b/file-service/.ignore @@ -1 +1,2 @@ fixtures +var diff --git a/file-service/Cargo.lock b/file-service/Cargo.lock deleted file mode 100644 index 2e99d09..0000000 --- a/file-service/Cargo.lock +++ /dev/null @@ -1,1404 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "adler32" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem 0.3.3", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "bodyparser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f023abfa58aad6f6bc4ae0630799e24d5ee0ab8bb2e49f651d9b1f9aa4f52f30" -dependencies = [ - "iron", - "persistent", - "plugin", - "serde 1.0.110", - "serde_json", -] - -[[package]] -name = "buf_redux" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9279646319ff816b05fb5897883ece50d7d854d12b59992683d4f8a71b0f949" -dependencies = [ - "memchr 1.0.2", - "safemem 0.2.0", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "bytemuck" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "cc" -version = "1.0.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404b1fe4f65288577753b17e3b36a04596ee784493ec249bf81c7f2d2acd751c" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "chrono" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -dependencies = [ - "num-integer", - "num-traits", - "serde 1.0.110", - "time", -] - -[[package]] -name = "clap" -version = "2.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "color_quant" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg 1.0.0", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.0.0", - "cfg-if", - "lazy_static", -] - -[[package]] -name = "deflate" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" -dependencies = [ - "adler32", - "byteorder", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "file-service" -version = "0.1.0" -dependencies = [ - "chrono", - "hex-string", - "image", - "iron", - "logger", - "mime 0.3.16", - "mime_guess 2.0.3", - "mustache", - "orizentic", - "params", - "router", - "serde 1.0.110", - "serde_json", - "sha2", - "thiserror", - "uuid 0.4.0", -] - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - -[[package]] -name = "gif" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" -dependencies = [ - "color_quant", - "lzw", -] - -[[package]] -name = "hermit-abi" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" -dependencies = [ - "libc", -] - -[[package]] -name = "hex-string" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848ec2dd093df965a34b434580d94852197fc83feac5b2c1962399bbf2cb4f0b" - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time", - "traitobject", - "typeable", - "unicase 1.4.2", - "url", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "image" -version = "0.23.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d534e95ad8b9d5aa614322d02352b4f1bf962254adcf02ac6f2def8be18498e8" -dependencies = [ - "bytemuck", - "byteorder", - "gif", - "jpeg-decoder", - "num-iter", - "num-rational 0.2.4", - "num-traits", - "png", - "scoped_threadpool", - "tiff", -] - -[[package]] -name = "iron" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" -dependencies = [ - "hyper", - "log 0.3.9", - "mime_guess 1.8.8", - "modifier", - "num_cpus", - "plugin", - "typemap", - "url", -] - -[[package]] -name = "itertools" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" - -[[package]] -name = "jpeg-decoder" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" -dependencies = [ - "byteorder", - "rayon", -] - -[[package]] -name = "jsonwebtoken" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d438ea707d465c230305963b67f8357a1d56fcfad9434797d7cb1c46c2e41df" -dependencies = [ - "base64", - "chrono", - "ring", - "serde 1.0.110", - "serde_derive", - "serde_json", - "untrusted", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" - -[[package]] -name = "linked-hash-map" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.8", -] - -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "logger" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c9172cb4c2f6c52117e25570983edcbb322f130b1031ae5d5d6b1abe7eeb493" -dependencies = [ - "iron", - "log 0.3.9", - "time", -] - -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -dependencies = [ - "libc", -] - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memoffset" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" -dependencies = [ - "autocfg 1.0.0", -] - -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "mime_guess" -version = "1.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" -dependencies = [ - "mime 0.2.6", - "phf", - "phf_codegen", - "unicase 1.4.2", -] - -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime 0.3.16", - "unicase 2.6.0", -] - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "modifier" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" - -[[package]] -name = "multipart" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92f54eb45230c3aa20864ccf0c277eeaeadcf5e437e91731db498dbf7fbe0ec6" -dependencies = [ - "buf_redux", - "httparse", - "log 0.3.9", - "mime 0.2.6", - "mime_guess 1.8.8", - "rand 0.3.23", - "safemem 0.2.0", - "tempdir", - "twoway", -] - -[[package]] -name = "mustache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" -dependencies = [ - "log 0.3.9", - "serde 1.0.110", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational 0.1.42", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -dependencies = [ - "num-integer", - "num-traits", - "rand 0.4.6", - "rustc-serialize", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -dependencies = [ - "num-traits", - "rustc-serialize", -] - -[[package]] -name = "num-integer" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" -dependencies = [ - "autocfg 1.0.0", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00" -dependencies = [ - "autocfg 1.0.0", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", - "rustc-serialize", -] - -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg 1.0.0", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" -dependencies = [ - "autocfg 1.0.0", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "orizentic" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f4af9d9002d3b129cdad6ebdb5b745b2b7d5e8c1c85c8addd7b447695af6a3" -dependencies = [ - "chrono", - "clap", - "itertools", - "jsonwebtoken", - "serde 1.0.110", - "serde_derive", - "serde_json", - "uuid 0.6.5", - "version_check 0.1.5", - "yaml-rust", -] - -[[package]] -name = "params" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c789fdad2cfdaa551ea0e3a9eadb74c5d634968a9fb3a8c767d89be470d21589" -dependencies = [ - "bodyparser", - "iron", - "multipart", - "num", - "plugin", - "serde_json", - "tempdir", - "urlencoded", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "persistent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8fa0009c4f3d350281309909c618abddf10bb7e3145f28410782f6a5ec74c5" -dependencies = [ - "iron", - "plugin", -] - -[[package]] -name = "phf" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_codegen" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" -dependencies = [ - "phf_shared", - "rand 0.6.5", -] - -[[package]] -name = "phf_shared" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" -dependencies = [ - "siphasher", - "unicase 1.4.2", -] - -[[package]] -name = "plugin" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" -dependencies = [ - "typemap", -] - -[[package]] -name = "png" -version = "0.16.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ccdd66f6fe4b2433b07e4728e9a013e43233120427046e93ceb709c3a439bf" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide", -] - -[[package]] -name = "proc-macro2" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rayon" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" -dependencies = [ - "autocfg 1.0.0", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -dependencies = [ - "winapi", -] - -[[package]] -name = "ring" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" -dependencies = [ - "cc", - "lazy_static", - "libc", - "untrusted", -] - -[[package]] -name = "route-recognizer" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea509065eb0b3c446acdd0102f0d46567dc30902dc0be91d6552035d92b0f4f8" - -[[package]] -name = "router" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc63b6f3b8895b0d04e816b2b1aa58fdba2d5acca3cbb8f0ab8e017347d57397" -dependencies = [ - "iron", - "route-recognizer", - "url", -] - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" - -[[package]] -name = "ryu" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" - -[[package]] -name = "safemem" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" - -[[package]] -name = "serde" -version = "1.0.110" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.110" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" -dependencies = [ - "itoa", - "ryu", - "serde 1.0.110", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" - -[[package]] -name = "smallvec" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "syn" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - -[[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.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tiff" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b8a87c4da944c3f27e5943289171ac71a6150a79ff6bacfff06d159dfff2f" -dependencies = [ - "byteorder", - "lzw", - "miniz_oxide", -] - -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" -dependencies = [ - "memchr 2.3.3", -] - -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - -[[package]] -name = "typemap" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -dependencies = [ - "unsafe-any", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check 0.9.1", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" -dependencies = [ - "smallvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" - -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -dependencies = [ - "traitobject", -] - -[[package]] -name = "untrusted" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "urlencoded" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a52f50139118b60ae91af08bf15ed158817d34b91b9d24c11ffbe21195d33e3" -dependencies = [ - "bodyparser", - "iron", - "plugin", - "url", -] - -[[package]] -name = "uuid" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cfec50b0842181ba6e713151b72f4ec84a6a7e2c9c8a8a3ffc37bb1cd16b231" -dependencies = [ - "rand 0.3.23", - "serde 0.9.15", -] - -[[package]] -name = "uuid" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1436e58182935dcd9ce0add9ea0b558e8a87befe01c1a301e6020aeb0876363" -dependencies = [ - "cfg-if", - "rand 0.4.6", -] - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - -[[package]] -name = "version_check" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" - -[[package]] -name = "winapi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yaml-rust" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" -dependencies = [ - "linked-hash-map", -] diff --git a/file-service/Cargo.toml b/file-service/Cargo.toml index 103fdb6..8452602 100644 --- a/file-service/Cargo.toml +++ b/file-service/Cargo.toml @@ -22,7 +22,7 @@ params = "*" router = "*" serde_json = "*" serde = { version = "1.0", features = ["derive"] } -sha2 = "0.8.2" +sha2 = "0.10" thiserror = "1.0.20" tokio = { version = "1", features = [ "full" ] } uuid = { version = "0.4", features = [ "serde", "v4" ] } diff --git a/file-service/src/lib/fileinfo.rs b/file-service/src/lib/fileinfo.rs deleted file mode 100644 index 5ddf3dc..0000000 --- a/file-service/src/lib/fileinfo.rs +++ /dev/null @@ -1,194 +0,0 @@ -use chrono::prelude::*; -use hex_string::HexString; -use serde::{Deserialize, Serialize}; -use serde_json; -use sha2::{Digest, Sha256}; -use std::fs::remove_file; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; - -use super::{FileId, FileRoot, PathResolver, ReadFileError}; -use crate::append_extension; - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct FileInfo { - pub id: String, - pub size: u64, - pub created: DateTime, - pub file_type: String, - pub hash: String, - - #[serde(skip)] - pub root: PathBuf, -} - -impl FileInfo { - pub fn load(id: FileId, context: CTX) -> Result { - let mut content: Vec = Vec::new(); - let mut file = std::fs::File::open(Self::path(id, context))?; - file.read_to_end(&mut content)?; - let js = serde_json::from_slice(&content)?; - - Ok(js) - } - - pub fn path(id: FileId, context: CTX) -> PathBuf { - let mut path = context.root(); - path.push((*id).to_owned()); - path.set_extension("json"); - path - } - - pub fn save(&self, root: &PathResolver) -> Result<(), ReadFileError> { - let ser = serde_json::to_string(self).unwrap(); - std::fs::File::create(root.metadata_path()) - .and_then(|mut stream| stream.write(ser.as_bytes()).map(|_| (()))) - .map_err(ReadFileError::from) - } - - /* - pub fn open(id: &str, root: &Path) -> Result { - let mut buf = Vec::new(); - - let md_path = FileInfo::metadata_path(id, root); - std::fs::File::open(md_path.clone()) - .and_then(|mut stream| stream.read_to_end(&mut buf)) - .map_err(move |err| match err.kind() { - std::io::ErrorKind::NotFound => FileError::FileNotFound(md_path), - _ => FileError::IOError(err), - })?; - - let str_repr = std::str::from_utf8(&buf)?; - - serde_json::from_str(&str_repr).map_err(FileError::from) - } - */ - - pub fn from_path(path: &Path) -> Result { - match (path.is_file(), path.is_dir()) { - (false, false) => Err(ReadFileError::FileNotFound), - (false, true) => Err(ReadFileError::NotAFile), - (true, _) => Ok(()), - }?; - - let metadata = path.metadata().map_err(ReadFileError::IOError)?; - let id = path - .file_name() - .map(|s| String::from(s.to_string_lossy())) - .ok_or(ReadFileError::NotAFile)?; - let created = metadata - .created() - .map(|m| DateTime::from(m)) - .map_err(|err| ReadFileError::IOError(err))?; - let file_type = String::from( - mime_guess::from_path(path) - .first_or_octet_stream() - .essence_str(), - ); - let hash = FileInfo::hash_file(path)?; - Ok(FileInfo { - id, - size: metadata.len(), - created, - file_type, - hash: hash.as_string(), - root: PathBuf::from(path.parent().unwrap()), - }) - } - - fn hash_file(path: &Path) -> Result { - let mut buf = Vec::new(); - let mut file = std::fs::File::open(path).map_err(ReadFileError::from)?; - - file.read_to_end(&mut buf).map_err(ReadFileError::from)?; - let mut vec = Vec::new(); - vec.extend_from_slice(Sha256::digest(&buf).as_slice()); - Ok(HexString::from_bytes(&vec)) - } - - /* - fn metadata_path(id: &str, root: &Path) -> PathBuf { - let mut path = PathBuf::from(root); - path.push(".metadata"); - path.push(id.clone()); - append_extension(&path, "json") - } - - pub fn delete(&self) -> Result<(), FileError> { - let path = FileInfo::metadata_path(&self.id, &self.root); - remove_file(path).map_err(FileError::from) - } - */ -} - -#[cfg(test)] -mod test { - use super::*; - use crate::lib::utils::FileCleanup; - - struct FileContext(PathBuf); - - impl FileRoot for FileContext { - fn root(&self) -> PathBuf { - self.0.clone() - } - } - - /* - #[test] - fn it_generates_information_from_file_path() { - let path = Path::new("fixtures/rawr.png"); - match FileInfo::from_path(&path) { - Ok(FileInfo { - id, - size, - file_type, - hash, - .. - }) => { - assert_eq!(id, "rawr.png"); - assert_eq!(size, 23777); - assert_eq!(file_type, "image/png"); - assert_eq!( - hash, - "b6cd35e113b95d62f53d9cbd27ccefef47d3e324aef01a2db6c0c6d3a43c89ee" - ); - } - Err(err) => { - println!("error loading file path: {}", err); - assert!(false); - } - } - } - */ - - #[test] - fn it_saves_and_loads_metadata() { - let path = Path::new("fixtures/rawr.png"); - let _ = FileCleanup(append_extension(path, "json")); - let info = FileInfo::from_path(&path).unwrap(); - info.save(&PathResolver(PathBuf::from("fixtures/rawr.png"))) - .unwrap(); - - assert!(Path::new("fixtures/.metadata/rawr.png.json").is_file()); - - let info_ = FileInfo::load( - FileId::from("rawr.png"), - FileContext(PathBuf::from("fixtures")), - ) - .unwrap(); - assert_eq!(info_.id, "rawr.png"); - assert_eq!(info_.size, 23777); - assert_eq!(info_.created, info.created); - assert_eq!(info_.file_type, "image/png"); - assert_eq!(info_.hash, info.hash); - } - - #[test] - fn it_extends_a_file_extension() { - assert_eq!( - append_extension(Path::new("fixtures/rawr.png"), "json"), - Path::new("fixtures/rawr.png.json") - ); - } -} diff --git a/file-service/src/main.rs b/file-service/src/main.rs index 11ba5ec..22586f6 100644 --- a/file-service/src/main.rs +++ b/file-service/src/main.rs @@ -19,18 +19,18 @@ use std::{ collections::HashMap, io::Read, net::{IpAddr, Ipv4Addr, SocketAddr}, - path::Path, + path::PathBuf, sync::{Arc, RwLock}, }; use warp::{filters::multipart::Part, Filter}; mod cookies; mod html; -mod lib; mod middleware; mod pages; +mod store; -use lib::{utils::append_extension, App, File, FileInfo}; +pub use store::{FileInfo, Store}; /* fn is_admin(resource: &ResourceName, permissions: &Permissions) -> bool { @@ -320,7 +320,7 @@ pub async fn main() { pretty_env_logger::init(); - let app = Arc::new(RwLock::new(App::new(Path::new( + let app = Arc::new(RwLock::new(Store::new(PathBuf::from( &std::env::var("FILE_SHARE_DIR").unwrap(), )))); diff --git a/file-service/src/pages.rs b/file-service/src/pages.rs index 7058f65..8fac465 100644 --- a/file-service/src/pages.rs +++ b/file-service/src/pages.rs @@ -1,4 +1,7 @@ -use crate::{html::*, lib::ReadFileError, File}; +use crate::{ + html::*, + store::{File, ReadFileError}, +}; use build_html::{self, Container, ContainerType, Html, HtmlContainer}; pub fn index(files: Vec>) -> build_html::HtmlPage { diff --git a/file-service/src/lib/file.rs b/file-service/src/store/file.rs similarity index 78% rename from file-service/src/lib/file.rs rename to file-service/src/store/file.rs index 9a78543..b81d56b 100644 --- a/file-service/src/lib/file.rs +++ b/file-service/src/store/file.rs @@ -3,51 +3,21 @@ use super::{ WriteFileError, }; use chrono::prelude::*; +use hex_string::HexString; +use sha2::{Digest, Sha256}; use std::{ - fs::{copy, read_dir, remove_file}, io::{Read, Write}, path::{Path, PathBuf}, }; -use thiserror::Error; use uuid::Uuid; -/* -#[derive(Error, Debug)] -pub enum FileError { - #[error("not implemented")] - NotImplemented, - - #[error("file not found: `{0}`")] - FileNotFound(PathBuf), - - #[error("file is not an image: `{0}`")] - NotAnImage(PathBuf), - - #[error("path is not a file: `{0}`")] - NotAFile(PathBuf), - - #[error("Image loading error")] - ImageError(#[from] image::ImageError), - - #[error("IO error")] - IOError(#[from] std::io::Error), - - #[error("JSON error")] - JSONError(#[from] serde_json::error::Error), - - #[error("UTF8 Error")] - UTF8Error(#[from] std::str::Utf8Error), -} -*/ - /// One file in the database, complete with the path of the file and information about the /// thumbnail of the file. #[derive(Debug)] pub struct File { pub id: FileId, - path: PathResolver, + pub path: PathResolver, pub info: FileInfo, - tn: Option, } impl File { @@ -65,41 +35,44 @@ impl File { .to_owned(); let info = FileInfo { - id: (*id).to_owned(), size: 0, created: Utc::now(), file_type, hash: "".to_owned(), - root: context.root().to_owned(), }; let mut md_file = std::fs::File::create(path.metadata_path())?; md_file.write(&serde_json::to_vec(&info)?)?; - Ok(Self { - id, - path, - info, - tn: None, - }) + Ok(Self { id, path, info }) } - pub fn load(id: FileId, context: CTX) -> Result { - let mut path = context.root(); - path.push((*id).to_owned()); - let path = PathResolver(path); - + pub fn load(resolver: PathResolver) -> Result { + /* Ok(Self { - id: id.clone(), - path, - info: FileInfo::load(id, context)?, - tn: None, + id: FileId::from( + resolver + .file_path() + .file_stem() + .unwrap() + .to_string_lossy() + .to_owned(), + ), + path: resolver, + info: FileInfo::load(resolver.metadata_path())?, }) + */ + unimplemented!() } - pub fn set_content(&self, content: Vec) -> Result<(), WriteFileError> { + pub fn set_content(&mut self, content: Vec) -> Result<(), WriteFileError> { let mut content_file = std::fs::File::create(self.path.file_path())?; - content_file.write(&content)?; + let byte_count = content_file.write(&content)?; + self.info.size = byte_count; + + let mut md_file = std::fs::File::create(self.path.metadata_path())?; + md_file.write(&serde_json::to_vec(&self.info)?)?; + Ok(()) } @@ -107,6 +80,14 @@ impl File { unimplemented!() } + pub fn hash_content(&self) -> Result { + let mut buf = Vec::new(); + let mut file = std::fs::File::open(self.path.file_path())?; + file.read_to_end(&mut buf).map_err(ReadFileError::from)?; + + Ok(HexString::from_bytes(&Sha256::digest(&buf).to_vec())) + } + /* pub fn new( id: &str, @@ -208,8 +189,8 @@ impl File { #[cfg(test)] mod test { use super::*; - use crate::lib::utils::FileCleanup; - use std::path::{Path, PathBuf}; + use crate::store::utils::FileCleanup; + use std::path::PathBuf; struct FileContext(PathBuf); @@ -261,10 +242,8 @@ mod test { #[test] fn it_raises_an_error_when_file_not_found() { - match File::load( - FileId::from("rawr.png"), - FileContext(PathBuf::from("fixtures/")), - ) { + let resolver = PathResolver(PathBuf::from("fixtures/rawr.png")); + match File::load(resolver) { Err(ReadFileError::FileNotFound) => assert!(true), _ => assert!(false), } diff --git a/file-service/src/store/fileinfo.rs b/file-service/src/store/fileinfo.rs new file mode 100644 index 0000000..ad8f778 --- /dev/null +++ b/file-service/src/store/fileinfo.rs @@ -0,0 +1,122 @@ +use chrono::prelude::*; +use serde::{Deserialize, Serialize}; +use serde_json; +use std::io::{Read, Write}; +use std::path::PathBuf; + +use super::{ReadFileError, WriteFileError}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct FileInfo { + pub size: usize, + pub created: DateTime, + pub file_type: String, + pub hash: String, +} + +impl FileInfo { + pub fn load(path: PathBuf) -> Result { + let mut content: Vec = Vec::new(); + let mut file = std::fs::File::open(path)?; + file.read_to_end(&mut content)?; + let js = serde_json::from_slice(&content)?; + + Ok(js) + } + + pub fn save(&self, path: PathBuf) -> Result<(), WriteFileError> { + let ser = serde_json::to_string(self).unwrap(); + let mut file = std::fs::File::create(path)?; + file.write(ser.as_bytes())?; + Ok(()) + } + + /* + pub fn from_path(path: &Path) -> Result { + match (path.is_file(), path.is_dir()) { + (false, false) => Err(ReadFileError::FileNotFound), + (false, true) => Err(ReadFileError::NotAFile), + (true, _) => Ok(()), + }?; + + let metadata = path.metadata().map_err(ReadFileError::IOError)?; + let id = path + .file_name() + .map(|s| String::from(s.to_string_lossy())) + .ok_or(ReadFileError::NotAFile)?; + let created = metadata + .created() + .map(|m| DateTime::from(m)) + .map_err(|err| ReadFileError::IOError(err))?; + let file_type = String::from( + mime_guess::from_path(path) + .first_or_octet_stream() + .essence_str(), + ); + let hash = FileInfo::hash_file(path)?; + Ok(FileInfo { + id, + size: metadata.len(), + created, + file_type, + hash: hash.as_string(), + root: PathBuf::from(path.parent().unwrap()), + }) + } + */ + + /* + fn hash_file(path: &Path) -> Result { + let mut buf = Vec::new(); + let mut file = std::fs::File::open(path).map_err(ReadFileError::from)?; + + file.read_to_end(&mut buf).map_err(ReadFileError::from)?; + let mut vec = Vec::new(); + vec.extend_from_slice(Sha256::digest(&buf).as_slice()); + Ok(HexString::from_bytes(&vec)) + } + */ + + /* + fn metadata_path(id: &str, root: &Path) -> PathBuf { + let mut path = PathBuf::from(root); + path.push(".metadata"); + path.push(id.clone()); + append_extension(&path, "json") + } + + pub fn delete(&self) -> Result<(), FileError> { + let path = FileInfo::metadata_path(&self.id, &self.root); + remove_file(path).map_err(FileError::from) + } + */ +} + +#[cfg(test)] +mod test { + use super::*; + use crate::store::utils::FileCleanup; + use crate::store::PathResolver; + + #[test] + fn it_saves_and_loads_metadata() { + let resolver = PathResolver::from("fixtures/1617654d-a588-4714-b4fa-e00ed0a8a607"); + let _cleanup = FileCleanup(resolver.metadata_path()); + + let created = Utc::now(); + + let info = FileInfo { + size: 23777, + created, + file_type: "image/png".to_owned(), + hash: "abcdefg".to_owned(), + }; + info.save(resolver.metadata_path()).unwrap(); + + let info_ = FileInfo::load(resolver.metadata_path()).unwrap(); + assert_eq!(info_.size, 23777); + assert_eq!(info_.created, info.created); + assert_eq!(info_.file_type, "image/png"); + assert_eq!(info_.hash, info.hash); + } +} diff --git a/file-service/src/lib/mod.rs b/file-service/src/store/mod.rs similarity index 71% rename from file-service/src/lib/mod.rs rename to file-service/src/store/mod.rs index 8bcd48a..1e732a3 100644 --- a/file-service/src/lib/mod.rs +++ b/file-service/src/store/mod.rs @@ -114,15 +114,13 @@ impl FileRoot for Context { } } -pub struct App { +pub struct Store { files_root: PathBuf, } -impl App { - pub fn new(files_root: &Path) -> App { - App { - files_root: PathBuf::from(files_root), - } +impl Store { + pub fn new(files_root: PathBuf) -> Self { + Self { files_root } } pub fn list_files(&self) -> Vec> { @@ -136,16 +134,18 @@ impl App { Ok(file) } - /* - pub fn delete_file(&mut self, id: String) -> Result<(), FileError> { + pub fn delete_file(&mut self, id: String) -> Result<(), WriteFileError> { + /* let f = File::open(&id, &self.files_root)?; f.delete() + */ + unimplemented!() } - pub fn get_metadata(&self, id: String) -> Result { - FileInfo::open(&id, &self.files_root) + pub fn get_metadata(&self, id: String) -> Result { + // FileInfo::open(&id, &self.files_root) + unimplemented!() } - */ pub fn get_file(&self, id: &str) -> Result<(FileInfo, std::fs::File), ReadFileError> { /* @@ -169,7 +169,10 @@ impl App { #[cfg(test)] mod test { + use crate::store::utils::FileCleanup; + use super::*; + use std::io::Read; #[test] fn paths() { @@ -187,4 +190,34 @@ mod test { PathBuf::from("path/82420255-d3c8-4d90-a582-f94be588c70c.tn") ); } + + #[test] + fn adds_files() { + let mut buf = Vec::new(); + let mut file = std::fs::File::open("fixtures/rawr.png").unwrap(); + file.read_to_end(&mut buf).unwrap(); + + let mut store = Store::new(PathBuf::from("var/")); + let file_record = store.add_file("rawr.png".to_owned(), buf).unwrap(); + + let _file = FileCleanup(PathBuf::from(format!("var/{}", *file_record.id))); + let _md = FileCleanup(PathBuf::from(format!("var/{}.json", *file_record.id))); + let _tn = FileCleanup(PathBuf::from(format!("var/{}.tn", *file_record.id))); + + assert!(PathBuf::from(format!("var/{}", *file_record.id)).exists()); + assert!(PathBuf::from(format!("var/{}.json", *file_record.id)).exists()); + assert!(PathBuf::from(format!("var/{}.tn", *file_record.id)).exists()); + } + + #[test] + fn sets_up_metadata_for_file() {} + + #[test] + fn sets_up_thumbnail_for_file() {} + + #[test] + fn deletes_associated_files() {} + + #[test] + fn lists_files_in_the_db() {} } diff --git a/file-service/src/lib/thumbnail.rs b/file-service/src/store/thumbnail.rs similarity index 98% rename from file-service/src/lib/thumbnail.rs rename to file-service/src/store/thumbnail.rs index 5bdbd36..99ddd4d 100644 --- a/file-service/src/lib/thumbnail.rs +++ b/file-service/src/store/thumbnail.rs @@ -75,7 +75,7 @@ impl Thumbnail { #[cfg(test)] mod test { use super::*; - use crate::lib::utils::FileCleanup; + use crate::store::utils::FileCleanup; #[test] fn it_creates_a_thumbnail_if_one_does_not_exist() { diff --git a/file-service/src/lib/utils.rs b/file-service/src/store/utils.rs similarity index 100% rename from file-service/src/lib/utils.rs rename to file-service/src/store/utils.rs diff --git a/file-service/var/.placeholder b/file-service/var/.placeholder new file mode 100644 index 0000000..e69de29