Compare commits

...

6 Commits

Author SHA1 Message Date
R Tyler Croy 603ad5eb4f Add some documentation around the parser service 2020-11-08 15:09:07 -08:00
R Tyler Croy b70cf8c17b Update the object-store to also allow use with catflap 2020-11-08 15:01:06 -08:00
R Tyler Croy 24427fea68 cargo update 2020-11-08 14:53:40 -08:00
R Tyler Croy 649d29f3d2 cargo fmt 2020-11-08 14:50:54 -08:00
R Tyler Croy d5303133e8 Add a simple /health endpoint which all Otto services should have 2020-11-08 14:50:31 -08:00
R Tyler Croy 8be8dc98d7 Start returning a real pipeline object
I need to figure out how tos share this ParsePipelineResponse model with the
models directory which is the real source of truth here
2020-11-08 14:37:33 -08:00
5 changed files with 271 additions and 147 deletions

260
Cargo.lock generated
View File

@ -17,54 +17,54 @@ dependencies = [
[[package]]
name = "aes"
version = "0.4.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5"
checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
dependencies = [
"aes-soft",
"aesni",
"block-cipher",
"cipher",
]
[[package]]
name = "aes-gcm"
version = "0.6.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1"
checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da"
dependencies = [
"aead",
"aes",
"block-cipher",
"cipher",
"ctr",
"ghash",
"subtle",
]
[[package]]
name = "aes-soft"
version = "0.4.0"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7"
checksum = "4e8bdbc97ba3854ecf597a3b69d7bd30a719dee72d22ce6313c84dbf2c8f2694"
dependencies = [
"block-cipher",
"byteorder",
"opaque-debug 0.2.3",
"cipher",
"opaque-debug 0.3.0",
]
[[package]]
name = "aesni"
version = "0.7.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264"
checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
dependencies = [
"block-cipher",
"opaque-debug 0.2.3",
"cipher",
"opaque-debug 0.3.0",
]
[[package]]
name = "aho-corasick"
version = "0.7.14"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [
"memchr",
]
@ -80,9 +80,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.33"
version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c"
checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7"
[[package]]
name = "archive-step"
@ -146,9 +146,9 @@ dependencies = [
[[package]]
name = "async-global-executor"
version = "1.4.2"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "124ac8c265e407641c3362b8f4d39cdb4e243885b71eef087be27199790f5a3a"
checksum = "73079b49cd26b8fd5a15f68fc7707fc78698dc2a3d61430f2a7a9430230dfa04"
dependencies = [
"async-executor",
"async-io",
@ -159,9 +159,9 @@ dependencies = [
[[package]]
name = "async-h1"
version = "2.1.3"
version = "2.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be805a675002e0918f7f85d72add747fcb69132d86b731bcf1f0626a2661241c"
checksum = "3fd9a5f3dbb5065856974e08c2ac24e6f81da6e39d2328de1c03a9a2b34ffb01"
dependencies = [
"async-std",
"byte-pool",
@ -223,11 +223,11 @@ dependencies = [
"anyhow",
"async-std",
"async-trait",
"base64",
"base64 0.12.3",
"bincode",
"blake3",
"chrono",
"hmac",
"hmac 0.8.1",
"kv-log-macro",
"rand",
"serde 1.0.117",
@ -237,9 +237,9 @@ dependencies = [
[[package]]
name = "async-sse"
version = "4.0.1"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a127da64eb321f5b698a43fb9b976d1e5fc1fd3c2f961322d6cc06ce721b47b"
checksum = "53bba003996b8fd22245cd0c59b869ba764188ed435392cf2796d03b805ade10"
dependencies = [
"async-channel",
"async-std",
@ -319,9 +319,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "base-x"
version = "0.2.6"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1"
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"
[[package]]
name = "base64"
@ -329,6 +329,12 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bincode"
version = "1.3.1"
@ -356,7 +362,7 @@ dependencies = [
"cc",
"cfg-if 0.1.10",
"constant_time_eq",
"crypto-mac",
"crypto-mac 0.8.0",
"digest 0.9.0",
]
@ -381,15 +387,6 @@ dependencies = [
"generic-array 0.14.4",
]
[[package]]
name = "block-cipher"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10"
dependencies = [
"generic-array 0.14.4",
]
[[package]]
name = "block-padding"
version = "0.1.5"
@ -455,9 +452,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
[[package]]
name = "cc"
version = "1.0.61"
version = "1.0.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40"
[[package]]
name = "cfg-if"
@ -479,12 +476,21 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
"num-traits 0.2.12",
"num-traits 0.2.14",
"serde 1.0.117",
"time 0.1.44",
"winapi",
]
[[package]]
name = "cipher"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
dependencies = [
"generic-array 0.14.4",
]
[[package]]
name = "clap"
version = "2.33.3"
@ -528,9 +534,9 @@ dependencies = [
[[package]]
name = "const_fn"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2"
checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
[[package]]
name = "constant_time_eq"
@ -540,14 +546,14 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "cookie"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0"
checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f"
dependencies = [
"aes-gcm",
"base64",
"base64 0.12.3",
"hkdf",
"hmac",
"hmac 0.10.1",
"percent-encoding",
"rand",
"sha2",
@ -557,9 +563,9 @@ dependencies = [
[[package]]
name = "core-foundation"
version = "0.7.0"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62"
dependencies = [
"core-foundation-sys",
"libc",
@ -567,9 +573,9 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
version = "0.7.0"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
[[package]]
name = "cpuid-bool"
@ -588,12 +594,12 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.4.4"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [
"crossbeam-utils 0.7.2",
"maybe-uninit",
"cfg-if 1.0.0",
"crossbeam-utils 0.8.0",
]
[[package]]
@ -640,6 +646,25 @@ dependencies = [
"subtle",
]
[[package]]
name = "crypto-mac"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6"
dependencies = [
"generic-array 0.14.4",
"subtle",
]
[[package]]
name = "ctr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
dependencies = [
"cipher",
]
[[package]]
name = "curl"
version = "0.4.34"
@ -673,9 +698,9 @@ dependencies = [
[[package]]
name = "data-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6"
checksum = "993a608597367c6377b258c25d7120740f00ed23a2252b729b1932dd7866f908"
[[package]]
name = "digest"
@ -719,11 +744,11 @@ checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
[[package]]
name = "encoding_rs"
version = "0.8.24"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2"
checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
]
[[package]]
@ -799,11 +824,11 @@ dependencies = [
[[package]]
name = "filetime"
version = "0.2.12"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"winapi",
@ -811,11 +836,11 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee"
checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"crc32fast",
"libc",
"miniz_oxide",
@ -1016,12 +1041,12 @@ dependencies = [
[[package]]
name = "hkdf"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe1149865383e4526a43aee8495f9a325f0b806c63ce6427d06336a590abbbc9"
checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f"
dependencies = [
"digest 0.9.0",
"hmac",
"hmac 0.10.1",
]
[[package]]
@ -1030,7 +1055,17 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
dependencies = [
"crypto-mac",
"crypto-mac 0.8.0",
"digest 0.9.0",
]
[[package]]
name = "hmac"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
dependencies = [
"crypto-mac 0.10.0",
"digest 0.9.0",
]
@ -1047,9 +1082,9 @@ dependencies = [
[[package]]
name = "http-client"
version = "6.1.0"
version = "6.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cc054d9c24096dde2dc73c0d37fa3f9269443dbf4a7ba47598ec9cffe71220e"
checksum = "010092b71b94ee49293995625ce7a607778b8b4099c8088fa84fd66bd3e0f21c"
dependencies = [
"async-h1",
"async-native-tls",
@ -1062,13 +1097,14 @@ dependencies = [
[[package]]
name = "http-types"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bc9a434e0182abff944d7d44190f02d141f269a3f31c45ac5368dc548bb934b"
checksum = "ffa4e35764a650ce8e709c50e985431eb8963eee7fc793d923134d4aa8e530b4"
dependencies = [
"anyhow",
"async-channel",
"async-std",
"base64 0.13.0",
"cookie",
"futures-lite",
"infer",
@ -1124,21 +1160,21 @@ dependencies = [
[[package]]
name = "isahc"
version = "0.9.10"
version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac245314704d62c121785203fb4d6f41f137167fcc91beec0b55bd6c4bb8c800"
checksum = "0cf84ee8215bcaa999a24870485ef49d051cd858985a80d123e56be2d921d811"
dependencies = [
"bytes",
"crossbeam-channel",
"crossbeam-utils 0.7.2",
"crossbeam-utils 0.8.0",
"curl",
"curl-sys",
"futures-channel",
"futures-io",
"futures-util",
"http",
"lazy_static",
"log",
"once_cell",
"slab",
"sluice",
"tracing",
@ -1190,9 +1226,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.79"
version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "libnghttp2-sys"
@ -1261,9 +1297,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memchr"
version = "2.3.3"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]]
name = "mime"
@ -1293,9 +1329,9 @@ dependencies = [
[[package]]
name = "native-tls"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d"
checksum = "1a1cda389c26d6b88f3d2dc38aa1b750fe87d298cc5d795ec9e975f402f00372"
dependencies = [
"lazy_static",
"libc",
@ -1332,12 +1368,12 @@ dependencies = [
[[package]]
name = "num-integer"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
"autocfg",
"num-traits 0.2.12",
"num-traits 0.2.14",
]
[[package]]
@ -1346,14 +1382,14 @@ version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
dependencies = [
"num-traits 0.2.12",
"num-traits 0.2.14",
]
[[package]]
name = "num-traits"
version = "0.2.12"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
@ -1654,9 +1690,9 @@ dependencies = [
[[package]]
name = "ppv-lite86"
version = "0.2.9"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]]
name = "pretty_env_logger"
@ -1681,9 +1717,9 @@ dependencies = [
[[package]]
name = "proc-macro-hack"
version = "0.5.18"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro-nested"
@ -1764,9 +1800,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "regex"
version = "1.4.1"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b"
checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
dependencies = [
"aho-corasick",
"memchr",
@ -1776,9 +1812,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.20"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c"
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
[[package]]
name = "remove_dir_all"
@ -1828,9 +1864,9 @@ dependencies = [
[[package]]
name = "security-framework"
version = "0.4.4"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"
dependencies = [
"bitflags",
"core-foundation",
@ -1841,9 +1877,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "0.4.3"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405"
checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b"
dependencies = [
"core-foundation-sys",
"libc",
@ -1949,9 +1985,9 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.8.13"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae3e2dd40a7cdc18ca80db804b7f461a39bb721160a85c9a1fa30134bf3c02a5"
checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7"
dependencies = [
"dtoa",
"linked-hash-map 0.5.3",
@ -1988,12 +2024,12 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]]
name = "sha2"
version = "0.9.1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8"
dependencies = [
"block-buffer 0.9.0",
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
@ -2190,18 +2226,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.21"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42"
checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.21"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab"
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
dependencies = [
"proc-macro2",
"quote",

View File

@ -2,11 +2,17 @@ use std::path::Path;
#[async_std::main]
async fn main() -> std::io::Result<()> {
pretty_env_logger::init();
use std::{env, net::TcpListener, os::unix::io::FromRawFd};
tide::log::start();
let upload_dir = std::env::var("OTTO_OBJECT_DIR").unwrap_or("tmp".to_string());
otto_objectstore::app(Path::new(&upload_dir).to_path_buf())
.listen("127.0.0.1:7671")
.await?;
let app = otto_objectstore::app(Path::new(&upload_dir).to_path_buf());
if let Some(fd) = env::var("LISTEN_FD").ok().and_then(|fd| fd.parse().ok()) {
app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?;
}
else {
app.listen("http://localhost:7671").await?;
}
Ok(())
}

View File

@ -0,0 +1,32 @@
= Parser service
The Otto Parser service is basically a parser engine that speaks HTTP. In the
`src/` directory you will find the `.pest` grammar definition which outlines
the Otto Pipeline syntax.
The `apispec.yml` is an link:https://en.wikipedia.org/wiki/Open_API[OpenAPI]
specification that describes the public HTTP endpoints that the parser service
provides.
== Development
Unit test and integration tests for the parser service are located in the usual
Rust locations, and can all be run via `cargo test`.
Running the acceptance tests however requires the
link:https://github.com/schemathesis/schemathesis[schemathesis] tool for
automating OpenAPI-based acceptance tests. In order to execute acceptance tests, run the parser service in one termainal: `cargo run -p otto-parser` and then in another:
[source,bash]
----
schemathesis run ./services/parser/apispec.yml --base-url=http://localhost:7672 --checks all
----
The server can be run in an auto-reloading fashion with link:https://github.com/passcod/cargo-watch[cargo-watch] and link:https://github.com/passcod/catflap[catlap] via:
[source,bash]
----
catflap -p 7672 -- cargo watch -x "run -p otto-parser"
----

View File

@ -1,5 +1,5 @@
---
openapi: 3.0.0
openapi: 3.0.3
info:
title: Otto Parser Service
description: |
@ -21,6 +21,18 @@ servers:
- url: 'http://localhost:7672'
description: 'Local dev server'
paths:
'/health':
get:
operationId: GetHealth
description: |
The health endpoint helps indicate whether the service is healthy or not.
Any non-200 response is unhealthy.
responses:
'200':
description: 'A successful healthcheck'
content:
application/json: {}
'/v1/parse':
post:
operationId: ParsePipeline
@ -29,7 +41,7 @@ paths:
Pipeline string and will attempt to parse the pipeline into an intermediate
representation which other parts of Otto can work with.
requestBody:
description: Pipeline syntax
description: 'A string payload in the Otto Pipeline syntax'
required: true
content:
text/plain:
@ -37,7 +49,7 @@ paths:
type: string
examples:
success:
summary: 'Simple Empty Pipeline'
summary: 'Simple Pipeline'
value: |
pipeline {
stages {
@ -52,19 +64,19 @@ paths:
responses:
'200':
description: Successfully parsed
description: 'Successfully parsed'
content:
application/json:
schema:
$ref: '#/components/schemas/ParsePipelineResponse'
'400':
description: Failed to parse the pipeline for some reason
description: 'Failed to parse the pipeline for some reason'
content:
application/json:
schema:
$ref: '#/components/schemas/ParsePipelineFailure'
'422':
description: Unprocessable data, usually non-UTF-6 encoded
description: 'Unprocessable data, usually non-UTF-6 encoded'
components:
schemas:
@ -73,30 +85,46 @@ components:
This response is passed on a successful parse of the provided pipeline
type: object
required:
- meta
example: {}
- uuid
- contexts
- steps
properties:
meta:
type: object
uuid:
type: string
format: uuid
contexts:
type: array
steps:
type: array
example:
summary: 'A simplistic Pipeline'
value:
uuid: '9edc4483-a78a-480f-8e06-2726db1ddf24'
contexts:
- uuid: '8109f601-12e8-4621-96c6-11baff409d93'
properties:
name: 'Build'
steps:
- uuid: '6193b9b1-c6be-4c18-9bb8-1aeead5e7d14'
context: '8109f601-12e8-4621-96c6-11baff409d93'
symbol: 'sh'
parameters:
- 'ls'
ParsePipelineFailure:
type: object
example:
required:
- variant
- location
- line
- column
properties:
variant:
description: Variant of the parser error
type: string
location:
description: The location in the input stream where the error was detected.
description: 'Parser error variant'
type: string
line:
description: The line within the input stream where the error was detected.
description: 'The line within the input stream where the error was detected.'
type: number
column:
description: The column within the line of the error.
description: 'The column within the line of the error.'
type: number

View File

@ -16,45 +16,67 @@ async fn parse(mut req: Request<()>) -> tide::Result {
match parsed {
Err(e) => {
use pest::error::*;
error!("Failed to parse: {:#?}", e);
let variant = match e.variant {
ErrorVariant::CustomError { message } => message,
ErrorVariant::ParsingError {
positives,
negatives,
} => format!("{:?}, {:?}", positives, negatives),
};
let (line, column) = match e.line_col {
LineColLocation::Pos(line_col) => line_col,
LineColLocation::Span(line_col_start, _line_col_end) => line_col_start,
};
return Ok(Response::builder(400)
.body(json!({
"variant" : "",
"location" : "",
"line" : 0,
"column" : 0
"variant" : variant,
"line" : line,
"column" : column
}))
.content_type("application/json")
.build()
);
},
.build());
}
Ok(pipeline) => {
trace!("pipeline: {:#?}", pipeline);
let pipeline = serde_json::to_string(&pipeline)?;
return Ok(Response::builder(200)
.body(json!({"meta": {}}))
.content_type("application/json")
.build());
.body(pipeline)
.content_type("application/json")
.build());
}
}
}
// Setting the content type manually since body_string? won't return one
Ok(Response::builder(422).content_type("application/json").build())
Ok(Response::builder(422)
.content_type("application/json")
.build())
}
async fn healthcheck(_req: Request<()>) -> tide::Result {
Ok(Response::builder(200)
.body("{}")
.content_type("application/json")
.build())
}
#[async_std::main]
async fn main() -> Result<(), std::io::Error> {
use std::{env, net::TcpListener, os::unix::io::FromRawFd};
tide::log::start();
let mut app = tide::new();
app.at("/health").get(healthcheck);
app.at("/v1/parse").post(parse);
if let Some(fd) = env::var("LISTEN_FD").ok().and_then(|fd| fd.parse().ok()) {
app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?;
}
else {
} else {
app.listen("http://localhost:7672").await?;
}
Ok(())
}