diff --git a/.gitignore b/.gitignore index 89cf118..3acc581 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ Cargo.lock # Doc Graphviz cargo-count.dot rainbow-graph.png + +# Cmake +cmake-build-*/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3fb2be8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/libcouchbase"] + path = external/libcouchbase + url = https://github.com/couchbase/libcouchbase diff --git a/.travis.yml b/.travis.yml index 3556ca9..7f82e90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ sudo: true rust: - stable - - beta - nightly env: @@ -24,7 +23,7 @@ addons: matrix: allow_failures: - - rust: nightly + - rust: stable before_script: - export PATH=$PATH:/home/travis/.cargo/bin diff --git a/Cargo.lock b/Cargo.lock index b8050c6..9e5c5e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,26 +1,9 @@ -[root] -name = "gauc" -version = "0.4.0" -dependencies = [ - "clap 2.22.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ctrlc 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)", - "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", - "urlencoded 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -30,17 +13,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "atty" -version = "0.2.2" +version = "0.2.3" 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)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -55,19 +53,49 @@ dependencies = [ "serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bodyparser" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "persistent 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "buf_redux" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "byteorder" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "clap" -version = "2.22.1" +version = "2.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -75,16 +103,16 @@ name = "conduit-mime-types" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ctrlc" -version = "3.0.1" +version = "3.0.3" 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)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -94,12 +122,17 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "env_logger" +name = "dtoa" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "env_logger" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -111,38 +144,71 @@ dependencies = [ "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fuchsia-zircon" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gauc" +version = "0.8.1" +dependencies = [ + "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctrlc 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", + "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "params 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "httparse" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.10.5" +version = "0.10.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "idna" -version = "0.1.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-bidi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -152,14 +218,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -167,6 +233,11 @@ name = "itoa" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "itoa" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -183,38 +254,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.21" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "matches" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "1.0.1" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mime" -version = "0.2.3" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime_guess" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -222,19 +320,127 @@ name = "modifier" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "multipart" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "buf_redux 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 1.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "twoway 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-complex" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.3.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "params" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bodyparser 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "multipart 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "urlencoded 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "persistent" version = "0.3.0" @@ -244,6 +450,41 @@ dependencies = [ "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "plugin" version = "0.2.6" @@ -252,31 +493,48 @@ dependencies = [ "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" -version = "0.1.17" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "route-recognizer" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -285,26 +543,23 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "route-recognizer 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc_version" -version = "0.1.7" +name = "safemem" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "semver" -version = "0.1.20" +name = "safemem" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -314,7 +569,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "0.9.12" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -324,51 +584,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_json" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "siphasher" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "strsim" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "term_size" -version = "0.2.3" +name = "tempdir" +version = "0.3.5" 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)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "thread-id" -version = "3.0.0" +name = "termion" +version = "1.5.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)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.36" +version = "0.1.38" 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)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -377,6 +671,14 @@ name = "traitobject" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "twoway" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typeable" version = "0.1.2" @@ -387,33 +689,28 @@ name = "typemap" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unsafe-any 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicase" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-bidi" -version = "0.2.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-normalization" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.1.0" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -423,7 +720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unreachable" -version = "0.1.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -431,7 +728,7 @@ dependencies = [ [[package]] name = "unsafe-any" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -439,11 +736,12 @@ dependencies = [ [[package]] name = "url" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -454,7 +752,7 @@ dependencies = [ "bodyparser 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -464,7 +762,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vec_map" -version = "0.7.0" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -485,63 +788,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" -"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" -"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" +"checksum atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21e50800ec991574876040fff8ee46b136a53e985286fbe6a3bdfe6421b78860" +"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bodyparser 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6928e817538b74a73d1dd6e9a942a2a35c632a597b6bb14fd009480f859a6bf5" -"checksum clap 2.22.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e17a4a72ffea176f77d6e2db609c6c919ef221f23862c9915e687fb54d833485" +"checksum bodyparser 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afa8a0260bb79363b68e8bfbc6e2a2d1be61f5a086aab8d9fe7d0a304a34f6a9" +"checksum buf_redux 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1497634c131ba13483b6e8123f69e219253b018bb32949eefd55c6b5051585d" +"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" +"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" +"checksum clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180" "checksum conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8" -"checksum ctrlc 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f26287fa3893461876a4851d1bee53b82f04954f85e2d7cd30ae053d0edefd72" +"checksum ctrlc 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df391ea008fca636e41e40863a0b39a850e2ab26b0cdeed0c3657fd05a66d44c" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" -"checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" +"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" +"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc" -"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d" -"checksum hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)" = "43a15e3273b2133aaac0150478ab443fb89f15c3de41d8d93d8f3bb14bf560f6" -"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" +"checksum fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159" +"checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82" +"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07" +"checksum hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2" +"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2440ae846e7a8c7f9b401db8f6e31b4ea5e7d3688b91761337da7e054520c75b" "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" +"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4732c563b9a21a406565c4747daa7b46742f082911ae4753f390dc9ec7ee1a97" -"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135" -"checksum log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad" -"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" -"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" -"checksum mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5514f038123342d01ee5f95129e4ef1e0470c93bc29edf058a46f9ee3ba6737e" +"checksum lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9e5e58fa1a4c3b915a561a78a22ee0cac6ab97dca2504428bc1cb074375f8d5" +"checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" +"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" +"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e01e64d9017d18e7fc09d8e4fe0e28ff6931019e979fb8019319db7ca827f8a6" +"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +"checksum mime_guess 1.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bbee1a836f344ac39d4a59bfe7be2bd3150353ff71678afb740216f8270b333e" "checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" -"checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99" -"checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2" +"checksum multipart 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "65ea55ea673966fa285eadafb6e7fb03c7328c7bbad60bea23a483e374eeccb3" +"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" +"checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525" +"checksum num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd0f8dbb4c0960998958a796281d88c16fbe68d87b1baa6f31e2979e81fd0bd" +"checksum num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "503e668405c5492d67cf662a81e05be40efe2e6bcf10f7794a07bd9865e704e6" +"checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" +"checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" +"checksum num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "288629c76fac4b33556f4b7ab57ba21ae202da65ba8b77466e6d598e31990790" +"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" +"checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d" +"checksum params 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3d1f23242b7dd59ee598fb12a03821d89cdc1059e419b995f224dc7819c22a0" +"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" "checksum persistent 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c9c94f2ef72dc272c6bcc8157ccf2bc7da14f4c58c69059ac2fc48492d6916" +"checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" +"checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" +"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" +"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" "checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" -"checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b" -"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" -"checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" -"checksum route-recognizer 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4f0a750d020adb1978f5964ea7bca830585899b09da7cbb3f04961fc2400122d" +"checksum rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "61efcbcd9fa8d8fbb07c84e34a8af18a1ff177b449689ad38a6e9457ecc7b2ae" +"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" +"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" +"checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256" "checksum router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9b1797ff166029cb632237bb5542696e54961b4cf75a324c6f05c9cf0584e4e" -"checksum rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "684ce48436d6465300c9ea783b6b14c4361d6b8dcbb1375b486a69cc19e2dfb0" -"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" -"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum safemem 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "725b3bf47ae40b4abcd27b5f0a9540369426a29f7b905649b3e1468e13e22009" +"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" -"checksum serde 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f023838e7e1878c679322dc7f66c3648bd33763a215fad752f378a623856898d" +"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" +"checksum serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "395993cac4e3599c7c1b70a6a92d3b3f55f4443df9f0b5294e362285ad7c9ecb" "checksum serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "67f7d2e9edc3523a9c8ec8cd6ec481b3a27810aafee3e625d311febd3e656b4c" +"checksum serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1" +"checksum serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1e67ce320daa7e494c578e34d4b00689f23bb94512fe0ca0dfaf02ea53fb67" +"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" -"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a" -"checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" -"checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7" -"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade" +"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" +"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" +"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" +"checksum twoway 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "316040e0ac00cf50ab656c9061ddcc20a57bb87ecb32a10c9a7cadd70d373871" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764" -"checksum unicode-bidi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a078ebdd62c0e71a709c3d53d2af693fe09fe93fbff8344aebe289b78f9032" -"checksum unicode-normalization 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e28fa37426fceeb5cf8f41ee273faa7c82c47dc8fba5853402841e665fcd86ff" -"checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3" +"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" -"checksum unsafe-any 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b351086021ebc264aea3ab4f94d61d889d98e5e9ec2d985d993f50133537fd3a" -"checksum url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5ba8a749fb4479b043733416c244fa9d1d3af3d7c23804944651c8a448cb87e" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" +"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2" "checksum urlencoded 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c28708636d6f7298a53b1cdb6af40f1ab523209a7cb83cf4d41b3ebc671d319" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8cdc8b93bd0198ed872357fb2e667f7125646b1762f16d60b2c96350d361897" +"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c" +"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/Cargo.toml b/Cargo.toml index 3108cd9..32f9281 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gauc" -version = "0.4.0" +version = "0.8.1" authors = ["Tomas Korcak "] description = "Couchbase Rust Adapter / CLI" @@ -21,18 +21,18 @@ keywords = ["couchbase", "database"] license = "MIT" [dependencies] -clap = ">= 2.18.0" -ctrlc = ">= 2.0.1" -env_logger = ">= 0.3.5" -hyper = "= 0.10.5" -iron = ">= 0.5.1" -libc = ">= 0.2.16" -log = ">= 0.3.6" -router = ">= 0.4.0" -# rust-crypto = "0.2.36" -serde = "0.9.12" -serde_json = "0.8" -urlencoded = "0.5.0" +clap = "2.27" +ctrlc = "3.0" +env_logger = "0.4" +hyper = "0.10" +iron = "0.5" +lazy_static = "0.2" +libc = "0.2" +log = "0.3" +params = "0.7" +router = "0.5" +serde = "1.0" +serde_json = "1.0" [lib] name = "gauc" diff --git a/bin/gauc b/bin/gauc deleted file mode 120000 index 01de477..0000000 --- a/bin/gauc +++ /dev/null @@ -1 +0,0 @@ -../target/release/gauc \ No newline at end of file diff --git a/examples/couchbase.rs b/examples/couchbase.rs index 0db2428..a8f733d 100644 --- a/examples/couchbase.rs +++ b/examples/couchbase.rs @@ -10,10 +10,10 @@ use std::ffi::CString; fn main() { let connstr = CString::new("couchbase://localhost/default").unwrap(); - let mut cropts = CreateSt::default(); + let mut cropts = CreateSt::new(); cropts.v3.connstr = connstr.as_ptr(); - let mut instance: Instance = Instance::default(); + let mut instance: Instance = Instance::new(); unsafe { let res = lcb_create(&mut instance as *mut Instance, &cropts as *const CreateSt); println!("Create Res: {:?}", res); diff --git a/examples/hello_world.rs b/examples/hello_world.rs index fc3d376..e5fb358 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -8,7 +8,7 @@ fn main() { const NUM_ITERATIONS: i32 = 100; - if let Ok(mut client) = Client::connect("couchbase://korczis.com/default") { + if let Ok(mut client) = Client::connect("couchbase://localhost/default", None) { for i in 0..NUM_ITERATIONS { println!("Iteration #{}", i); @@ -20,7 +20,7 @@ fn main() { }); // Get data - client.get(&format!("foo{}", i), 0, |res| { + client.get(&format!("foo{}", i), |res| { if let Ok(response) = res { println!("Got response: {} - {}", response.key.unwrap(), response.value.unwrap()) } diff --git a/examples/hello_world_upsert_sync.rs b/examples/hello_world_upsert_sync.rs index 060073b..b95b6ec 100644 --- a/examples/hello_world_upsert_sync.rs +++ b/examples/hello_world_upsert_sync.rs @@ -6,11 +6,11 @@ use gauc::client::*; fn main() { env_logger::init().unwrap(); - if let Ok(mut client) = Client::connect("couchbase://korczis.com/default") { + if let Ok(mut client) = Client::connect("couchbase://localhost/default", None) { let res = client.upsert_sync("hello_world_upsert_sync", "{{\"msg\": \"This is sync upsert!\"}}", 0, 0); println!("{:?}", res); - let res = client.get_sync("hello_world_upsert_sync", 0); + let res = client.get_sync("hello_world_upsert_sync"); println!("{:?}", res); } } diff --git a/external/libcouchbase b/external/libcouchbase new file mode 160000 index 0000000..a1e02d5 --- /dev/null +++ b/external/libcouchbase @@ -0,0 +1 @@ +Subproject commit a1e02d50bc3824b14d1f670591f41b7286fc48c0 diff --git a/src/cli/cmd/get.rs b/src/cli/cmd/get.rs index 84c7177..d5fed5b 100644 --- a/src/cli/cmd/get.rs +++ b/src/cli/cmd/get.rs @@ -6,7 +6,7 @@ pub fn cmd_get(client: &mut Client, parts: &[&str]) -> bool { match parts.len() { 2 => { // TODO: Add support for cas option - client.get(parts[1], 0, get_callback); + client.get(parts[1], get_callback); }, _ => println!("Wrong number of arguments, expect exactly one argument.") } diff --git a/src/cli/cmd/remove.rs b/src/cli/cmd/remove.rs index ec8eb53..d678aab 100644 --- a/src/cli/cmd/remove.rs +++ b/src/cli/cmd/remove.rs @@ -6,7 +6,7 @@ pub fn cmd_remove(client: &mut Client, parts: &[&str]) -> bool { match parts.len() { 2 => { // TODO: Add support for cas option - client.get(parts[1], 0, get_callback); + client.get(parts[1], get_callback); }, _ => println!("Wrong number of arguments, expect exactly one argument.") } diff --git a/src/cli/cmd/upsert.rs b/src/cli/cmd/upsert.rs index 161c16d..574c5ba 100644 --- a/src/cli/cmd/upsert.rs +++ b/src/cli/cmd/upsert.rs @@ -8,7 +8,9 @@ pub fn cmd_upsert(client: &mut Client, parts: &[&str]) -> bool { _ => { // TODO: Add support for cas option // TODO: Add support for exptime option - client.upsert(parts[1], &format!("{}", parts[2..].join(" "))[..], 0, 0, store_callback); + let res = client.upsert(parts[1], &format!("{}", parts[2..].join(" "))[..], 0, 0, store_callback); + + println!("{:?}", &res); } } diff --git a/src/client/mod.rs b/src/client/mod.rs index 29bae65..4299cbd 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -36,28 +36,55 @@ pub type OperationResultViewQueryInternal<'a> = Result<&'a response::ViewQueryIn pub type OperationResultViewQueryInternalCallback = Box>; pub type OperationResultViewQueryInternalRowCallback = Box>; +pub use super::couchbase::auth_type::{AuthFlags, AuthType}; + +#[derive(Debug, Clone)] +pub struct Authenticator { + pub auth_type: auth_type::AuthType, + pub passwords: Vec<(String, String, auth_type::AuthFlags)> +} + +impl Authenticator { + pub fn new(auth_type: auth_type::AuthType) -> Authenticator { + Authenticator { + auth_type: auth_type, + passwords: Vec::new() + } + } + + pub fn add_password(&mut self, username: String, password: String, flags: auth_type::AuthFlags) { + self.passwords.push((username, password, flags)); + } +} + #[derive(Debug)] pub struct Client { pub opts: CreateSt, pub instance: Instance, + pub authenticator: Option, pub uri: String } impl Clone for Client { fn clone(&self) -> Client { let uri = &self.uri.clone()[..]; - Client::connect(uri).unwrap() + let authenticator = self.authenticator.clone(); + + Client::connect(uri, authenticator).unwrap() } } impl Client { - pub fn connect(uri: &str) -> result::Result { + pub fn connect(uri: &str, authenticator: Option) -> result::Result { let connstr = CString::new(uri).unwrap(); - let mut opts = CreateSt::default(); + let mut opts = CreateSt::new(); opts.v3.connstr = connstr.as_ptr(); - let mut instance: Instance = Instance::default(); + // opts.v3.username = CString::new("Administrator").unwrap().as_ptr(); + // opts.v3.passwd = CString::new("Administrator").unwrap().as_ptr(); + + let mut instance: Instance = Instance::new(); unsafe { let res = lcb_create(&mut instance as *mut Instance, &opts as *const CreateSt); @@ -66,6 +93,29 @@ impl Client { return Err(format!("lcb_create() - {}", &str)); } + let cloned_authenticator = authenticator.clone(); + + match authenticator { + Some(auth) => { + let mut res = lcbauth_new(); + lcbauth_set_mode(res, auth.auth_type); + + + for cred in auth.passwords.iter() { + lcbauth_add_pass( + res, + CString::new(&cred.0[..]).unwrap().as_ptr(), + CString::new(&cred.1[..]).unwrap().as_ptr(), + cred.2 + ); + } + + lcb_set_auth(instance, res); + lcbauth_unref(res); + }, + None => {} + }; + info!("Connecting to {}", uri); let res = lcb_connect(instance); @@ -102,6 +152,7 @@ impl Client { Ok(Client { opts, instance, + authenticator: cloned_authenticator, uri: uri.to_string() }) } @@ -132,13 +183,12 @@ impl Client { } /// Get document from database - pub fn get<'a, F>(&'a mut self, key: &str, cas: u64, callback: F) -> &Client + pub fn get<'a, F>(&'a mut self, key: &str, callback: F) -> &Client where F: Fn(OperationResultGet) + 'static { let key = key.to_owned(); let mut gcmd = cmd::Get::default(); - gcmd.cas = cas; gcmd.key._type = KvBufferType::Copy; gcmd.key.contig.bytes = key.as_ptr() as *const libc::c_void; gcmd.key.contig.nbytes = key.len() as u64; @@ -162,7 +212,7 @@ impl Client { let res = lcb_get3(self.instance, user_data, &gcmd as *const cmd::Get); if res != ErrorType::Success { error!("lcb_get3() failed"); - // callback(Err((None, format_error(self.instance, &res)))); + // callback(Err((None, res))); } else if lcb_wait(self.instance) != ErrorType::Success { error!("lcb_wait() failed"); // callback(Err((None, format_error(self.instance, &res)))) @@ -174,10 +224,10 @@ impl Client { self } - pub fn get_sync(&mut self, key: &str, cas: u64) -> OperationResultGet + pub fn get_sync(&mut self, key: &str) -> OperationResultGet { let (tx, rx): (Sender, Receiver) = mpsc::channel(); - self.get(key, cas, move |result: OperationResultGet| { + self.get(key, move |result: OperationResultGet| { let _ = tx.send(result); }); @@ -339,14 +389,17 @@ impl Client { self.store_sync(key, value, Operation::Upsert, cas, exptime) } - /// Store document in database - pub fn view_query<'a, F>(&'a mut self, ddoc: &str, view: &str, callback: F) -> &Client + /// Query view + pub fn query_view<'a, F>(&'a mut self, ddoc: &str, view: &str, callback: F) -> &Client where F: Fn(OperationResultViewQuery) + 'static { unsafe { extern "C" fn callback_helper(_instance: *mut Instance, _cbtype: CallbackType, raw_row: *const response::ViewQueryInternal) { let row = unsafe { &(*raw_row) }; - if row.rflags == 1 { + + println!("query_view.callback_helper() - {:?}", &row); + + if row.rflags == 1 || row.rc != ErrorType::Success { unsafe { let cb: Box> = Box::from_raw(row.cookie as *mut Box); (*cb)(row); @@ -355,17 +408,23 @@ impl Client { } let mut gcmd = cmd::ViewQuery::default(); - gcmd.cmdflags |= 1 << 16; // LCB_CMDVIEWQUERY_F_INCLUDE_DOCS; + gcmd.cmdflags = (1 << 16); // LCB_CMDVIEWQUERY_F_INCLUDE_DOCS; gcmd.ddoc = ddoc.as_bytes().as_ptr() as *const libc::c_void; gcmd.nddoc = ddoc.len() as u64; gcmd.view = view.as_bytes().as_ptr() as *const libc::c_void; gcmd.nview = view.len() as u64; gcmd.callback = callback_helper as *mut libc::c_void; +// let opts = "limit=10&descending=true"; +// gcmd.optstr = opts.as_bytes().as_ptr() as *const libc::c_void; +// gcmd.noptstr = opts.len() as u64; + let boxed: OperationResultViewQueryInternalCallback = Box::new(Box::new(move |result: &response::ViewQueryInternal| { + println!("query_view.boxed() - {:?}", &result); + match result.rc { ErrorType::Success => { - debug!("{:?}", result); + println!("{:?}", result); callback(Ok(response::ViewQuery::new(result))); }, e => { @@ -378,21 +437,24 @@ impl Client { let res = lcb_view_query(self.instance, user_data, &gcmd as *const cmd::ViewQuery); if res != ErrorType::Success { - error!("lcb_view_query() failed"); + println!("lcb_view_query() failed"); // callback(Err((None, format_error(self.instance, &res)))) } else if lcb_wait(self.instance) != ErrorType::Success { - error!("lcb_wait() failed") + println!("lcb_wait() failed"); // callback(Err((None, format_error(self.instance, &res)))) } } + forget(ddoc); + forget(view); + self } - pub fn view_query_sync(&mut self, ddoc: &str, view: &str) -> OperationResultViewQuery + pub fn query_view_sync(&mut self, ddoc: &str, view: &str) -> OperationResultViewQuery { let (tx, rx): (Sender, Receiver) = mpsc::channel(); - self.view_query(ddoc, view, move |result: OperationResultViewQuery| { + self.query_view(ddoc, view, move |result: OperationResultViewQuery| { let _ = tx.send(result); }); @@ -440,3 +502,53 @@ unsafe extern "C" fn op_callback(_instance: Instance, cbtype: CallbackType, resp _ => error!("! Unknown Callback...") }; } + +#[cfg(test)] +mod tests { + use super::*; + use test::*; + + #[test] + fn connect() { + let mut authenticator = self::Authenticator::new(AuthType::Rbac); + + authenticator.add_password( + String::from("Administrator"), + String::from("Administrator"), + AuthFlags::Bucket + ); + + match Client::connect("couchbase://localhost/default", Some(authenticator)) { + Ok(mut client) => { + assert_eq!(client.opts.version(), 3); + client.upsert_sync("test", "{}", 0, 0); + }, + Err(err) => { + println!("{:?}", &err); + } + } + } + +// #[test] +// fn query_view_sync() { +// let mut authenticator = self::Authenticator::new(AuthType::Rbac); +// +// authenticator.add_password( +// String::from("Administrator"), +// String::from("Administrator"), +// AuthFlags::Bucket +// ); +// +// match Client::connect("couchbase://localhost/default", Some(authenticator)) { +// Ok(mut client) => { +// assert_eq!(client.opts.version(), 3); +// +// let res = client.query_view_sync("capa", "all"); +// println!("{:?}", &res); +// }, +// Err(err) => { +// println!("{:?}", &err); +// } +// } +// } +} diff --git a/src/couchbase/funcs.rs b/src/couchbase/funcs.rs index 762cac6..92536ee 100644 --- a/src/couchbase/funcs.rs +++ b/src/couchbase/funcs.rs @@ -1,5 +1,7 @@ use libc::{c_char, c_void}; +use super::types::authenticator::Authenticator; +use super::types::auth_type::{AuthType, AuthFlags}; use super::types::callback_type::CallbackType; use super::types::cmd; use super::types::create_st::CreateSt; @@ -11,6 +13,12 @@ pub type ResponseCallback = unsafe extern "C" fn(instance: Instance, cbtype: Cal #[link(name = "couchbase")] extern { + pub fn lcbauth_add_pass(authenticator: Authenticator, user: *const c_char, pass: *const c_char, flags: AuthFlags) -> ErrorType; + pub fn lcbauth_new() -> Authenticator; + pub fn lcb_set_auth(instance: Instance, authenticator: Authenticator); + pub fn lcbauth_set_mode(authenticator: Authenticator, auth_type: AuthType) -> ErrorType; + pub fn lcbauth_unref(authenticator: Authenticator); + pub fn lcb_connect(instance: Instance) -> ErrorType; pub fn lcb_cntl_string(instance: Instance, key: *const c_char, value: *const c_char) -> ErrorType; pub fn lcb_create(instance: *mut Instance, options: *const CreateSt) -> ErrorType; diff --git a/src/couchbase/types/auth_type.rs b/src/couchbase/types/auth_type.rs new file mode 100644 index 0000000..4ca2f5e --- /dev/null +++ b/src/couchbase/types/auth_type.rs @@ -0,0 +1,15 @@ +#[repr(u32)] +#[derive(Debug, Clone, Copy)] +pub enum AuthType { + Classic = 0, + Rbac = 1, + Dynamic = 2 +} + +#[repr(u32)] +#[derive(Debug, Clone, Copy)] +pub enum AuthFlags { + Cluster = 1, + Bucket = 2, + Both = 3 +} diff --git a/src/couchbase/types/authenticator.rs b/src/couchbase/types/authenticator.rs new file mode 100644 index 0000000..d180d17 --- /dev/null +++ b/src/couchbase/types/authenticator.rs @@ -0,0 +1,41 @@ +#[derive(Debug, Clone, Copy)] +pub enum AuthenticatorInternal {} + +unsafe impl Send for AuthenticatorInternal {} +unsafe impl Sync for AuthenticatorInternal {} + +use super::AuthType; +use super::super::funcs::lcbauth_set_mode; + +#[derive(Debug, Clone, Copy)] +#[repr(C)] +pub struct AuthenticatorPtr { + ptr: *mut AuthenticatorInternal +} + + +impl AuthenticatorPtr { + pub fn new() -> AuthenticatorPtr { + unsafe { + AuthenticatorPtr { + ptr: ::std::mem::zeroed() + } + } + } + + /* + pub fn set_mode(&mut self, auth_type: AuthType) { + unsafe { + lcbauth_set_mode(self as *mut Authenticator, auth_type); + } + } + + pub fn add_pass(&mut self, username: &String, password: &String) { + + } + */ +} +unsafe impl Send for AuthenticatorPtr {} +unsafe impl Sync for AuthenticatorPtr {} + +pub type Authenticator = AuthenticatorPtr; diff --git a/src/couchbase/types/create_st.rs b/src/couchbase/types/create_st.rs index 6e51588..8571862 100644 --- a/src/couchbase/types/create_st.rs +++ b/src/couchbase/types/create_st.rs @@ -12,11 +12,11 @@ pub struct CreateSt { unsafe impl Send for CreateSt {} unsafe impl Sync for CreateSt {} -impl Default for CreateSt { - fn default() -> Self { +impl CreateSt { + pub fn new() -> CreateSt { CreateSt { version: 3, - v3: CreateSt3::default() + v3: CreateSt3::new() } } } diff --git a/src/couchbase/types/create_st3.rs b/src/couchbase/types/create_st3.rs index 87ac5bc..5b55d78 100644 --- a/src/couchbase/types/create_st3.rs +++ b/src/couchbase/types/create_st3.rs @@ -16,8 +16,17 @@ pub struct CreateSt3 { unsafe impl Send for CreateSt3 {} unsafe impl Sync for CreateSt3 {} -impl Default for CreateSt3 { - fn default() -> Self { - unsafe { ::std::mem::zeroed() } +impl CreateSt3 { + pub fn new() -> CreateSt3 { + unsafe { + CreateSt3 { + connstr: ::std::mem::zeroed(), + username: ::std::mem::zeroed(), + passwd: ::std::mem::zeroed(), + pad_bucket: ::std::mem::zeroed(), + io: ::std::mem::zeroed(), + _type: ::std::mem::zeroed() + } + } } } diff --git a/src/couchbase/types/error_type.rs b/src/couchbase/types/error_type.rs index fd5e716..05b19db 100644 --- a/src/couchbase/types/error_type.rs +++ b/src/couchbase/types/error_type.rs @@ -93,7 +93,7 @@ pub enum ErrorType { impl fmt::Display for ErrorType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let description = unsafe { - CStr::from_ptr(lcb_strerror(Instance::default(), *self)).to_str().unwrap() + CStr::from_ptr(lcb_strerror(Instance::new(), *self)).to_str().unwrap() }; write!(f,"{} ({:?})", description, self) } diff --git a/src/couchbase/types/instance.rs b/src/couchbase/types/instance.rs index 2a7c08b..57eeb66 100644 --- a/src/couchbase/types/instance.rs +++ b/src/couchbase/types/instance.rs @@ -11,9 +11,13 @@ pub struct InstancePtr { } -impl Default for InstancePtr { - fn default() -> Self { - unsafe { ::std::mem::zeroed() } +impl InstancePtr { + pub fn new() -> InstancePtr { + unsafe { + InstancePtr { + ptr: ::std::mem::zeroed() + } + } } } unsafe impl Send for InstancePtr {} diff --git a/src/couchbase/types/mod.rs b/src/couchbase/types/mod.rs index 4c60034..0163774 100644 --- a/src/couchbase/types/mod.rs +++ b/src/couchbase/types/mod.rs @@ -1,3 +1,5 @@ +pub mod authenticator; +pub mod auth_type; pub mod callback_type; pub mod cmd; pub mod contiguous_buffer; @@ -11,6 +13,8 @@ pub mod kv_buffer_type; pub mod operation; pub mod response; +// pub use self::authenticator::Authenticator; +pub use self::auth_type::AuthType; pub use self::callback_type::CallbackType; pub use self::contiguous_buffer::ContiguousBuffer; pub use self::create_st::CreateSt; diff --git a/src/lib.rs b/src/lib.rs index 2f7a4b9..093410c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![feature(test)] +extern crate test; #[macro_use] extern crate log; @@ -5,11 +7,18 @@ extern crate env_logger; extern crate hyper; extern crate iron; + +#[macro_use] +extern crate lazy_static; + extern crate libc; +extern crate params; extern crate router; extern crate serde; + +#[macro_use] extern crate serde_json; -extern crate urlencoded; + pub mod cli; pub mod client; diff --git a/src/main.rs b/src/main.rs index ddce700..303dc92 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,6 @@ extern crate clap; extern crate ctrlc; extern crate gauc; extern crate iron; -extern crate urlencoded; use clap::{App, Arg}; @@ -18,7 +17,8 @@ use std::process::exit; use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicBool, Ordering}; -const DESCRIPTION: &'static str = "Couchbase Rust Adapter / CLI / REST Interface"; +const AUTHORS: &'static str = env!("CARGO_PKG_AUTHORS"); +const DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION"); const VERSION: &'static str = env!("CARGO_PKG_VERSION"); //const DEFAULT_HOST: &'static str = "localhost"; @@ -52,7 +52,7 @@ fn main() { // Specify program options let matches = App::new(DESCRIPTION) .version(VERSION) - .author("Tomas Korcak ") + .author(AUTHORS) .arg(Arg::with_name("interactive") .help("Interactive mode") .short("i") @@ -93,14 +93,14 @@ fn main() { env_logger::init().unwrap(); if matches.is_present("interactive") { - if let Ok(mut client) = Client::connect(matches.value_of("url").unwrap()) { + if let Ok(mut client) = Client::connect(matches.value_of("url").unwrap(), None) { cli::main(&matches, &mut client); } } let port: u16 = matches.value_of("rest-port").unwrap().to_string().parse::().unwrap(); if matches.is_present("rest") { - if let Ok(client) = Client::connect(matches.value_of("url").unwrap()) { + if let Ok(client) = Client::connect(matches.value_of("url").unwrap(), None) { web::start_web(&Arc::new(Mutex::new(client)), port); } } diff --git a/src/web/mod.rs b/src/web/mod.rs index 22f8975..23a6a94 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -1,22 +1,26 @@ extern crate clap; extern crate hyper; extern crate iron; +extern crate params; extern crate router; extern crate serde; extern crate serde_json; -extern crate urlencoded; use hyper::header::{ContentType, Headers, ETag, EntityTag}; use hyper::mime::{Attr, Mime, TopLevel, SubLevel, Value}; use iron::prelude::*; +use iron::request::Request; +use iron::response::Response; use iron::status; +// use iron::Handler; +use iron::IronResult; + use router::Router; use serde_json::Map; use std::io::Read; use std::sync::{Arc, Mutex}; -use urlencoded::UrlEncodedQuery; use super::client::Client; use super::couchbase::types::error_type; @@ -39,13 +43,11 @@ use super::couchbase::types::operation::Operation; // POST /bucket//doc//set - set * // POST /bucket//doc//upsert - upsert (explitcit) * -pub fn get_meta(cas: &str, version: u16) -> Map { - let mut res: Map = Map::new(); - - res.insert("cas".to_string(), serde_json::value::Value::String(cas.to_string())); - res.insert("version".to_string(), serde_json::value::Value::U64(u64::from(version))); - - res +pub fn get_meta(cas: &str, version: u16) -> serde_json::Value { + json!({ + "cas": cas.to_string(), + "version": u64::from(version) + }) } pub fn get_error(client: instance::InstancePtr, rc: &error_type::ErrorType) -> Map { @@ -57,22 +59,15 @@ pub fn get_error(client: instance::InstancePtr, rc: &error_type::ErrorType) -> M res } -pub fn handler_get(safe_client: &Arc>, req: &mut Request) -> IronResult { - let mut cas: u64 = 0; +pub fn handler_get(safe_client: &Arc>, req: &mut iron::request::Request) -> IronResult { + println!("{:?}", &req); - if let Ok(hashmap) = req.get_ref::() { - if hashmap.contains_key("cas") { - let tmp = hashmap.get("cas").unwrap().last().unwrap(); - if let Ok(val) = tmp.parse::() { - cas = val; - } - } - }; + // let params = req.get_ref::().unwrap(); let docid = req.extensions.get::().unwrap().find("docid").unwrap_or(""); let mut client = safe_client.lock().unwrap(); - let response = client.get_sync(docid, cas); + let response = client.get_sync(docid); match response { Ok(result) => { let cas = result.cas.to_string(); @@ -82,17 +77,17 @@ pub fn handler_get(safe_client: &Arc>, req: &mut Request) -> IronR headers.set(ContentType(Mime(TopLevel::Application, SubLevel::Json, vec![(Attr::Charset, Value::Utf8)]))); headers.set(ETag(EntityTag::new(false, cas.to_owned()))); - let mut map = Map::new(); - map.insert("meta".to_string(), get_meta(&cas, result.version)); - - let doc: Map = serde_json::from_str(&value).unwrap(); - map.insert("doc".to_string(), doc); + let doc: serde_json::Value = match serde_json::from_str(&value[..]) { + Ok(value) => value, + Err(_e) => json!(value) + }; + let json = json!({ + "meta": get_meta(&cas, result.version), + "doc": doc + }); - // TODO: Handle non-json documents - let json = serde_json::to_string(&map).unwrap(); - - let mut response = Response::with((status::Ok, json)); + let mut response = Response::with((status::Ok, json.to_string())); response.headers = headers; Ok(response) }, @@ -161,23 +156,24 @@ pub fn handler_store(safe_client: &Arc>, operation: Operation, req let mut cas: u64 = 0; let mut exptime: u32 = 0; - if let Ok(hashmap) = req.get_ref::() { - if hashmap.contains_key("cas") { - let tmp = hashmap.get("cas").unwrap().last().unwrap(); - cas = match tmp.parse::() { - Ok(val) => val, - _ => 0 - }; - } - - if hashmap.contains_key("exptime") { - let tmp = hashmap.get("exptime").unwrap().last().unwrap(); - exptime = match tmp.parse::() { - Ok(val) => val, - _ => 0 - }; - } - }; +// TODO: Port this! +// if let Ok(hashmap) = req.get_ref::() { +// if hashmap.contains_key("cas") { +// let tmp = hashmap.get("cas").unwrap(); +// cas = match tmp.parse::() { +// Ok(val) => val, +// _ => 0 +// }; +// } +// +// if hashmap.contains_key("exptime") { +// let tmp = hashmap.get("exptime").unwrap(); +// exptime = match tmp.parse::() { +// Ok(val) => val, +// _ => 0 +// }; +// } +// }; let docid = req.extensions.get::().unwrap().find("docid").unwrap_or(""); let mut client = safe_client.lock().unwrap(); @@ -221,12 +217,12 @@ pub fn handler_store(safe_client: &Arc>, operation: Operation, req } } -pub fn handler_view_query(safe_client: &Arc>, req: &mut Request) -> IronResult { +pub fn handler_query_view(safe_client: &Arc>, req: &mut Request) -> IronResult { let ddoc = req.extensions.get::().unwrap().find("ddoc").unwrap_or(""); let view = req.extensions.get::().unwrap().find("view").unwrap_or(""); let mut client = safe_client.lock().unwrap(); - let response = client.view_query_sync(ddoc, view); + let response = client.query_view_sync(ddoc, view); match response { Err(res) => { let mut headers = Headers::new(); @@ -251,11 +247,10 @@ pub fn handler_view_query(safe_client: &Arc>, req: &mut Request) - headers.set(ContentType(Mime(TopLevel::Application, SubLevel::Json, vec![(Attr::Charset, Value::Utf8)]))); headers.set(ETag(EntityTag::new(false, cas.to_owned()))); - let mut map = Map::new(); -// map.insert("meta".to_string(), get_meta(&cas, result.version)); - - let doc: Map = serde_json::from_str(&value).unwrap(); - map.insert("doc".to_string(), doc); + let map = json!({ + "meta": get_meta(&cas, res.version), + "doc": &value + }); // TODO: Handle non-json documents let json = serde_json::to_string(&map).unwrap(); @@ -331,8 +326,8 @@ pub fn start_web(c: &Arc>, port: u16) { // View query handler let handler_client = Arc::new(Mutex::new(c.lock().unwrap().clone())); - let view_query_handler = move |req: &mut Request| -> IronResult { - handler_view_query(&handler_client, req) + let query_view_handler = move |req: &mut Request| -> IronResult { + handler_query_view(&handler_client, req) }; // Docs @@ -347,7 +342,7 @@ pub fn start_web(c: &Arc>, port: u16) { router.post("/bucket/:bucketid/doc/:docid/upsert", upsert_handler, "doc_upsert"); // Views - router.get("/bucket/:bucketid/view/:ddoc/:view", view_query_handler, "view_query"); + router.get("/bucket/:bucketid/view/:ddoc/:view", query_view_handler, "query_view"); let address = format!("0.0.0.0:{}", port); match Iron::new(router).http(&address[..]) { diff --git a/tests/client_test.rs b/tests/client_test.rs deleted file mode 100644 index 7c6d486..0000000 --- a/tests/client_test.rs +++ /dev/null @@ -1,27 +0,0 @@ -extern crate gauc; - -use gauc::client::*; -//use gauc::couchbase::types::error_type::ErrorType; -//use gauc::couchbase::types::operation::Operation; - -const DEFAULT_CONNECTION_STRING: &'static str = "couchbase://localhost/default"; - -#[test] -fn it_connects() { - if let Ok(client) = Client::connect(DEFAULT_CONNECTION_STRING) { - assert_eq!(client.opts.version(), 3); - } -} - -//#[test] -//fn it_stores_document() { -// if let Ok(mut client) = Client::connect(DEFAULT_CONNECTION_STRING) { -// // Store some data -// client.store("foo", "{\"msg\": \"This is test!\"}", Operation::Upsert, 0, 0, |res| { -// if let Ok(response) = res { -// assert_eq!(response.rc, ErrorType::Success); -// println!("Created new document, CAS: {}", response.cas) -// } -// }); -// } -//} diff --git a/watch.sh b/watch.sh new file mode 100755 index 0000000..cc649dd --- /dev/null +++ b/watch.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +cargo watch -x 'build' \ + -x 'test --all' \ + -x 'doc --all' \ + -x 'bench --all'