🏡 index : ~doyle/1p.git

author Jordan Doyle <jordan@doyle.la> 2020-07-07 0:19:36.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2020-07-07 0:25:28.0 +00:00:00
commit
4105f5bd248b9115e9b78c26e5a7ea519e0f98e9 [patch]
tree
7c19c66e77d2323953b347d84c22985b5ef095b8
parent
df71535e9113f0b150b1f7f9ab2ba4f319ebe4cc
download
4105f5bd248b9115e9b78c26e5a7ea519e0f98e9.tar.gz

Make calls to the backend asynchronous



Diff

 Cargo.lock                  | 330 +++++++++++++++++++++++++++++++++++++++++++++-
 onep-backend-api/Cargo.toml |   3 +-
 onep-backend-api/src/lib.rs |  15 +-
 onep-backend-op/Cargo.toml  |   4 +-
 onep-backend-op/src/lib.rs  |  33 ++---
 onep-cli/Cargo.toml         |   2 +-
 onep-cli/src/main.rs        |  23 +--
 7 files changed, 376 insertions(+), 34 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 1214001..bf59fd1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14,6 +14,21 @@ version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "arc-swap"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "async-trait"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -34,6 +49,24 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "bytes"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "loom 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "cc"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "clap"
version = "3.0.0-beta.1"
source = "git+https://github.com/clap-rs/clap#9fc8ec965e42db926ef6aa894810c23600dac49d"
@@ -116,6 +149,37 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "futures-core"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "generator"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cc 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "heck"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -145,6 +209,14 @@ dependencies = [
]

[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -158,6 +230,15 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -168,23 +249,124 @@ version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "log"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "loom"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "generator 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
 "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "memchr"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "mio"
version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "net2 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
 "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "mio-named-pipes"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "miow 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "mio-uds"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "miow"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "net2 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "miow"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "net2"
version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "onep-backend-api"
version = "0.1.0"
dependencies = [
 "async-trait 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "onep-backend-op"
version = "0.1.0"
dependencies = [
 "async-trait 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
 "onep-backend-api 0.1.0",
 "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
 "serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)",
 "serde_with 1.5.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
 "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -199,6 +381,7 @@ dependencies = [
 "onep-backend-op 0.1.0",
 "term-table 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
 "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -207,6 +390,11 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "pin-project-lite"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "proc-macro-error"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -247,6 +435,11 @@ dependencies = [
]

[[package]]
name = "redox_syscall"
version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "regex"
version = "1.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -263,11 +456,37 @@ version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "scoped-tls"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "serde"
version = "1.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -316,6 +535,31 @@ dependencies = [
]

[[package]]
name = "signal-hook-registry"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "arc-swap 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "slab"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "socket2"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "strsim"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -398,6 +642,39 @@ dependencies = [
]

[[package]]
name = "tokio"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bytes 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
 "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)",
 "mio-named-pipes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "mio-uds 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "tokio-macros"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unicode-segmentation"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -424,6 +701,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -432,6 +714,11 @@ dependencies = [
]

[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -449,12 +736,26 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[metadata]
"checksum aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)" = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
"checksum anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
"checksum arc-swap 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
"checksum async-trait 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bytes 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b"
"checksum cc 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)" = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum clap 3.0.0-beta.1 (git+https://github.com/clap-rs/clap)" = "<none>"
"checksum clap_derive 3.0.0-beta.1 (git+https://github.com/clap-rs/clap)" = "<none>"
"checksum colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
@@ -463,28 +764,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum darling_macro 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
"checksum generator 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
"checksum ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
"checksum indexmap 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
"checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum loom 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7"
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
"checksum mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
"checksum mio-named-pipes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
"checksum mio-uds 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum miow 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
"checksum net2 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
"checksum os_str_bytes 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "06de47b848347d8c4c94219ad8ecd35eb90231704b067e67e6ae2e36ee023510"
"checksum pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
"checksum proc-macro-error 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
"checksum proc-macro-error-attr 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50"
"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)" = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
"checksum serde_derive 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)" = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
"checksum serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)" = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3"
"checksum serde_with 1.5.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14922cc3f5279e98d5790b4607854a129749aecccfffc75dc794fbfaba85209e"
"checksum serde_with_macros 1.2.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "460c3cc47cbbfdf107ae7c1e68022ad57b3f3f63d998255c155a54514a3e3f2e"
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
"checksum strsim 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
"checksum strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
"checksum syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
@@ -495,12 +820,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
"checksum thiserror-impl 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
"checksum tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58"
"checksum tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
diff --git a/onep-backend-api/Cargo.toml b/onep-backend-api/Cargo.toml
index bc6ab17..8e901f0 100644
--- a/onep-backend-api/Cargo.toml
+++ b/onep-backend-api/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
\ No newline at end of file
[dependencies]
async-trait = "0.1"
\ No newline at end of file
diff --git a/onep-backend-api/src/lib.rs b/onep-backend-api/src/lib.rs
index 2c95300..b29ce7b 100644
--- a/onep-backend-api/src/lib.rs
+++ b/onep-backend-api/src/lib.rs
@@ -1,6 +1,8 @@
#![deny(clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]

use async_trait::async_trait;

#[derive(Debug)]
pub struct AccountMetadata {
    pub name: String,
@@ -40,15 +42,16 @@ pub struct ItemSection {
    pub fields: Vec<ItemField>,
}

#[async_trait]
pub trait Backend {
    type Error;

    fn totp(&self, uuid: &str) -> Result<String, Self::Error>;
    fn account(&self) -> Result<AccountMetadata, Self::Error>;
    fn vaults(&self) -> Result<Vec<VaultMetadata>, Self::Error>;
    fn search(&self, terms: Option<&str>) -> Result<Vec<ItemMetadata>, Self::Error>;
    fn get(&self, uuid: &str) -> Result<Option<Item>, Self::Error>;
    fn generate(
    async fn totp(&self, uuid: &str) -> Result<String, Self::Error>;
    async fn account(&self) -> Result<AccountMetadata, Self::Error>;
    async fn vaults(&self) -> Result<Vec<VaultMetadata>, Self::Error>;
    async fn search(&self, terms: Option<&str>) -> Result<Vec<ItemMetadata>, Self::Error>;
    async fn get(&self, uuid: &str) -> Result<Option<Item>, Self::Error>;
    async fn generate(
        &self,
        name: &str,
        username: Option<&str>,
diff --git a/onep-backend-op/Cargo.toml b/onep-backend-op/Cargo.toml
index b47a10d..e96716f 100644
--- a/onep-backend-op/Cargo.toml
+++ b/onep-backend-op/Cargo.toml
@@ -11,4 +11,6 @@ onep-backend-api = { path = "../onep-backend-api" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_with = "1.5.0-alpha.1"
thiserror = "1.0"
\ No newline at end of file
thiserror = "1.0"
async-trait = "0.1"
tokio = { version = "0.2", features = ["process"] }
\ No newline at end of file
diff --git a/onep-backend-op/src/lib.rs b/onep-backend-op/src/lib.rs
index 2e9b29a..2be98a2 100644
--- a/onep-backend-op/src/lib.rs
+++ b/onep-backend-op/src/lib.rs
@@ -7,11 +7,12 @@

#![deny(clippy::pedantic)]

use async_trait::async_trait;
use onep_backend_api as api;
use serde::Deserialize;
use serde_json::Value;
use std::borrow::Cow;
use std::process::Command;
use tokio::process::Command;

#[derive(thiserror::Error, Debug)]
pub enum Error {
@@ -206,7 +207,7 @@ struct CreateItem {

pub struct OpBackend {}

fn exec<I, S>(args: I) -> Result<Vec<u8>, Error>
async fn exec<I, S>(args: I) -> Result<Vec<u8>, Error>
where
    I: IntoIterator<Item = S>,
    S: AsRef<std::ffi::OsStr>,
@@ -214,6 +215,7 @@ where
    let cmd = Command::new("op")
        .args(args)
        .output()
        .await
        .map_err(Error::Exec)?;

    if cmd.status.success() {
@@ -225,28 +227,29 @@ where
    }
}

#[async_trait]
impl api::Backend for OpBackend {
    type Error = Error;

    fn totp(&self, uuid: &str) -> Result<String, Self::Error> {
        Ok(std::str::from_utf8(&exec(&["get", "totp", uuid])?)?.to_string())
    async fn totp(&self, uuid: &str) -> Result<String, Self::Error> {
        Ok(std::str::from_utf8(&exec(&["get", "totp", uuid]).await?)?.to_string())
    }

    fn account(&self) -> Result<api::AccountMetadata, Self::Error> {
        let ret: GetAccount = serde_json::from_slice(&exec(&["get", "account"])?)?;
    async fn account(&self) -> Result<api::AccountMetadata, Self::Error> {
        let ret: GetAccount = serde_json::from_slice(&exec(&["get", "account"]).await?)?;

        Ok(ret.into())
    }

    fn vaults(&self) -> Result<Vec<api::VaultMetadata>, Self::Error> {
        let ret: Vec<ListVault> = serde_json::from_slice(&exec(&["list", "vaults"])?)?;
    async fn vaults(&self) -> Result<Vec<api::VaultMetadata>, Self::Error> {
        let ret: Vec<ListVault> = serde_json::from_slice(&exec(&["list", "vaults"]).await?)?;

        Ok(ret.into_iter().map(|v| v.into()).collect())
    }

    #[allow(clippy::filter_map)]
    fn search(&self, terms: Option<&str>) -> Result<Vec<api::ItemMetadata>, Self::Error> {
        let ret: Vec<ListItem> = serde_json::from_slice(&exec(&["list", "items"])?)?;
    async fn search(&self, terms: Option<&str>) -> Result<Vec<api::ItemMetadata>, Self::Error> {
        let ret: Vec<ListItem> = serde_json::from_slice(&exec(&["list", "items"]).await?)?;

        Ok(ret
            .into_iter()
@@ -266,13 +269,13 @@ impl api::Backend for OpBackend {
            .collect())
    }

    fn get(&self, uuid: &str) -> Result<Option<api::Item>, Self::Error> {
        let ret: GetItem = serde_json::from_slice(&exec(&["get", "item", uuid])?)?;
    async fn get(&self, uuid: &str) -> Result<Option<api::Item>, Self::Error> {
        let ret: GetItem = serde_json::from_slice(&exec(&["get", "item", uuid]).await?)?;

        Ok(Some(ret.into()))
    }

    fn generate(
    async fn generate(
        &self,
        name: &str,
        username: Option<&str>,
@@ -302,8 +305,8 @@ impl api::Backend for OpBackend {
            args.push(Cow::Owned(format!("username={}", username)));
        }

        let ret: CreateItem = serde_json::from_slice(&exec(args.iter().map(Cow::as_ref))?)?;
        let ret: CreateItem = serde_json::from_slice(&exec(args.iter().map(Cow::as_ref)).await?)?;

        Ok(self.get(&ret.uuid)?.unwrap_or_else(|| unreachable!()))
        Ok(self.get(&ret.uuid).await?.unwrap_or_else(|| unreachable!()))
    }
}
diff --git a/onep-cli/Cargo.toml b/onep-cli/Cargo.toml
index 9546bce..87afece 100644
--- a/onep-cli/Cargo.toml
+++ b/onep-cli/Cargo.toml
@@ -14,6 +14,8 @@ path = "src/main.rs"
onep-backend-api = { path = "../onep-backend-api" }
onep-backend-op = { path = "../onep-backend-op" }

tokio = { version = "0.2", features = ["full"] }

clap = { git = "https://github.com/clap-rs/clap" }
term-table = "1.3"
itertools = "0.9"
diff --git a/onep-cli/src/main.rs b/onep-cli/src/main.rs
index c809d75..2ec0ca9 100644
--- a/onep-cli/src/main.rs
+++ b/onep-cli/src/main.rs
@@ -53,15 +53,16 @@ enum Opt {
    },
}

fn main() {
    if let Err(e) = run(&backend::OpBackend {}) {
#[tokio::main(core_threads = 1)]
async fn main() {
    if let Err(e) = run(&backend::OpBackend {}).await {
        eprintln!("{}", e);
        std::process::exit(1);
    }
}

#[allow(clippy::non_ascii_literal)]
fn run<T: api::Backend>(imp: &T) -> anyhow::Result<()>
async fn run<T: api::Backend>(imp: &T) -> anyhow::Result<()>
where
    T::Error: 'static + std::error::Error + Send + Sync,
{
@@ -70,9 +71,8 @@ where
            show_uuids,
            show_account_names,
        } => {
            let account = imp.account()?;
            let vaults = imp.vaults()?;
            let results = imp.search(None)?;
            let (account, vaults, results) =
                tokio::try_join!(imp.account(), imp.vaults(), imp.search(None),)?;

            let mut results_grouped: Vec<(_, Vec<_>)> = Vec::new();
            for (key, group) in &results.into_iter().group_by(|v| v.vault_uuid.clone()) {
@@ -140,9 +140,9 @@ where
                }
            }
        }
        Opt::Totp { uuid } => println!("{}", imp.totp(&uuid)?.trim()),
        Opt::Totp { uuid } => println!("{}", imp.totp(&uuid).await?.trim()),
        Opt::Search { terms } => {
            for result in imp.search(Some(&terms))? {
            for result in imp.search(Some(&terms)).await? {
                println!("[{}]", result.title.green());
                println!("{}", result.account_info);
                println!("{}", result.uuid);
@@ -150,7 +150,7 @@ where
            }
        }
        Opt::Show { uuid } => {
            let result = imp.get(&uuid)?.ok_or(Error::NotFound)?;
            let result = imp.get(&uuid).await?.ok_or(Error::NotFound)?;
            show(result);
        }
        Opt::Generate {
@@ -159,8 +159,9 @@ where
            url,
            tags,
        } => {
            let result =
                imp.generate(&name, username.as_deref(), url.as_deref(), tags.as_deref())?;
            let result = imp
                .generate(&name, username.as_deref(), url.as_deref(), tags.as_deref())
                .await?;
            show(result);
        }
    }