messing around more
This commit is contained in:
parent
d06f6f4991
commit
05faa56297
7 changed files with 681 additions and 44 deletions
544
Cargo.lock
generated
544
Cargo.lock
generated
|
@ -79,7 +79,7 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -89,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -101,6 +101,78 @@ dependencies = [
|
|||
"backtrace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"itoa",
|
||||
"matchit",
|
||||
"memchr",
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"mime",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"sync_wrapper",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
|
@ -143,6 +215,12 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
|
||||
[[package]]
|
||||
name = "canonical_json"
|
||||
version = "0.5.0"
|
||||
|
@ -216,6 +294,7 @@ name = "cli"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
"clap",
|
||||
"dag-resolve",
|
||||
"dag-resolve-impls",
|
||||
|
@ -353,6 +432,12 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.3.0"
|
||||
|
@ -371,6 +456,60 @@ version = "0.2.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
|
@ -398,6 +537,25 @@ version = "0.28.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
|
@ -429,6 +587,97 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.10"
|
||||
|
@ -452,12 +701,30 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.2"
|
||||
|
@ -467,6 +734,17 @@ dependencies = [
|
|||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
|
@ -482,6 +760,44 @@ version = "1.19.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
|
@ -616,6 +932,12 @@ dependencies = [
|
|||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.16"
|
||||
|
@ -659,6 +981,28 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_path_to_error"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.8"
|
||||
|
@ -679,12 +1023,31 @@ dependencies = [
|
|||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.7.3"
|
||||
|
@ -718,6 +1081,12 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.57"
|
||||
|
@ -738,6 +1107,95 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
|
@ -774,13 +1232,37 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -789,51 +1271,93 @@ version = "0.52.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_gnullvm 0.52.0",
|
||||
"windows_aarch64_msvc 0.52.0",
|
||||
"windows_i686_gnu 0.52.0",
|
||||
"windows_i686_msvc 0.52.0",
|
||||
"windows_x86_64_gnu 0.52.0",
|
||||
"windows_x86_64_gnullvm 0.52.0",
|
||||
"windows_x86_64_msvc 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
|
|
|
@ -8,6 +8,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.79", features = ["backtrace"] }
|
||||
axum = "0.7.4"
|
||||
clap = { version = "4.5.0", features = ["derive"] }
|
||||
dag-resolve = { version = "0.1.0", path = "../proto" }
|
||||
dag-resolve-impls = { version = "0.1.0", path = "../impls" }
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
use std::{
|
||||
fmt::Debug, path::{Path, PathBuf}, rc::Rc
|
||||
fmt::Debug,
|
||||
path::{Path, PathBuf},
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
mod server;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use dag_resolve::{
|
||||
actor::{ActorId, ActorSecret},
|
||||
event::{CoreContent, Event, HashType, SignatureType},
|
||||
event::{CoreContent, Event, EventId, HashType, SignatureType},
|
||||
resolver::Resolver,
|
||||
room::Room,
|
||||
Error,
|
||||
};
|
||||
use dag_resolve_impls::{resolvers::{forum::ForumResolver, kv::KVResolver}, stores::sqlite::Database};
|
||||
use dag_resolve_impls::{
|
||||
resolvers::{forum::ForumResolver, kv::KVResolver},
|
||||
stores::sqlite::Database,
|
||||
};
|
||||
use rusqlite::Connection;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(version, about)]
|
||||
enum Cli {
|
||||
/// Initialize a new repository
|
||||
Init {
|
||||
repo: PathBuf,
|
||||
resolver: String,
|
||||
},
|
||||
Init { repo: PathBuf, resolver: String },
|
||||
|
||||
/// Send arbitrary event data to a room
|
||||
Send {
|
||||
repo: PathBuf,
|
||||
|
||||
|
||||
/// the json as a string
|
||||
data: String,
|
||||
},
|
||||
|
@ -36,6 +40,9 @@ enum Cli {
|
|||
|
||||
/// Synchronize two repositories
|
||||
Sync { repo: PathBuf, other: PathBuf },
|
||||
|
||||
/// Serve a repository over http
|
||||
Serve { repo: PathBuf },
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -48,7 +55,10 @@ struct State<R: Resolver> {
|
|||
|
||||
impl<R: Resolver> State<R> {
|
||||
fn create_event(&mut self, content: CoreContent<R::EventType>) -> Result<()> {
|
||||
match self.room.create_event(&mut *self.store, content, &self.secret) {
|
||||
match self
|
||||
.room
|
||||
.create_event(&mut *self.store, content, &self.secret)
|
||||
{
|
||||
Ok(event) => {
|
||||
self.db.execute(
|
||||
"INSERT INTO _events (id, json) VALUES (?, ?)",
|
||||
|
@ -113,7 +123,8 @@ impl<R: Resolver> State<R> {
|
|||
)?;
|
||||
}
|
||||
let db = Rc::new(db);
|
||||
let store = Database::from_conn(db.clone()).init()?;
|
||||
let mut store = Database::from_conn(db.clone()).init()?;
|
||||
room.resolve_state(&mut *store);
|
||||
Ok(State {
|
||||
db,
|
||||
room,
|
||||
|
@ -126,10 +137,11 @@ impl<R: Resolver> State<R> {
|
|||
fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
||||
// restore repo
|
||||
let db = rusqlite::Connection::open(path)?;
|
||||
let _actor: ActorId =
|
||||
db.query_row("SELECT value FROM _config WHERE key='actor_id'", [], |row| {
|
||||
row.get(0).map(|s: String| s.parse())
|
||||
})??;
|
||||
let _actor: ActorId = db.query_row(
|
||||
"SELECT value FROM _config WHERE key='actor_id'",
|
||||
[],
|
||||
|row| row.get(0).map(|s: String| s.parse()),
|
||||
)??;
|
||||
let secret: ActorSecret = db.query_row(
|
||||
"SELECT value FROM _config WHERE key='actor_secret'",
|
||||
[],
|
||||
|
@ -138,7 +150,10 @@ fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
|||
let mut q = db.prepare("SELECT json FROM _events")?;
|
||||
let mut rows = q.query([])?;
|
||||
|
||||
let event_json: String = rows.next()?.expect("there's always one root event").get(0)?;
|
||||
let event_json: String = rows
|
||||
.next()?
|
||||
.expect("there's always one root event")
|
||||
.get(0)?;
|
||||
let event: Event<()> = serde_json::from_str(&event_json)?;
|
||||
match event.content() {
|
||||
CoreContent::Create(c) => match c.resolver.as_str() {
|
||||
|
@ -155,8 +170,10 @@ fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
|||
drop(q);
|
||||
let db = Rc::new(db);
|
||||
let mut store = Database::from_conn(db.clone()).init()?;
|
||||
room.resolve_state(&mut *store);
|
||||
for event in events {
|
||||
room.append_event(&mut *store, event)?;
|
||||
room.resolve_state(&mut *store);
|
||||
}
|
||||
Ok(Opened::Kv(State {
|
||||
db,
|
||||
|
@ -164,7 +181,7 @@ fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
|||
secret,
|
||||
store,
|
||||
}))
|
||||
},
|
||||
}
|
||||
"forum-v0" => {
|
||||
let mut room = Room::from_root(ForumResolver, serde_json::from_str(&event_json)?)?;
|
||||
let mut events = vec![];
|
||||
|
@ -178,8 +195,10 @@ fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
|||
drop(q);
|
||||
let db = Rc::new(db);
|
||||
let mut store = Database::from_conn(db.clone()).init()?;
|
||||
room.resolve_state(&mut *store);
|
||||
for event in events {
|
||||
room.append_event(&mut *store, event)?;
|
||||
room.resolve_state(&mut *store);
|
||||
}
|
||||
Ok(Opened::Forum(State {
|
||||
db,
|
||||
|
@ -187,7 +206,7 @@ fn open(path: impl AsRef<Path>) -> Result<Opened> {
|
|||
secret,
|
||||
store,
|
||||
}))
|
||||
},
|
||||
}
|
||||
_ => unimplemented!("unknown resolver"),
|
||||
},
|
||||
_ => panic!("tried to start with non-create event"),
|
||||
|
@ -216,16 +235,48 @@ fn startup(path: impl AsRef<Path>, create: Option<&str>) -> Result<Opened> {
|
|||
}
|
||||
}
|
||||
|
||||
fn sync_state<R: Resolver + Debug>(from: &mut State<R>, to: &mut State<R>) -> Result<()> {
|
||||
// fn sync_state_v1<R: Resolver + Debug>(from: &mut State<R>, to: &mut State<R>) -> Result<()> {
|
||||
// if from.room.get_root() != to.room.get_root() {
|
||||
// panic!("cannot sync events from two different rooms");
|
||||
// }
|
||||
// for event in &from.room.events {
|
||||
// to.append_event(event.clone())?;
|
||||
// }
|
||||
// for event in &to.room.events {
|
||||
// from.append_event(event.clone())?;
|
||||
// }
|
||||
// from.room.resolve_state(&mut *from.store);
|
||||
// to.room.resolve_state(&mut *to.store);
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
fn sync_state_v2<R: Resolver>(from: &mut State<R>, to: &mut State<R>) -> Result<()> {
|
||||
if from.room.get_root() != to.room.get_root() {
|
||||
panic!("cannot sync events from two different rooms");
|
||||
}
|
||||
for event in &from.room.events {
|
||||
to.append_event(event.clone())?;
|
||||
}
|
||||
for event in &to.room.events {
|
||||
from.append_event(event.clone())?;
|
||||
|
||||
// a list of event ids would either be cached or easily queryable
|
||||
let our_ids: Vec<_> = to.room.events.iter().map(|ev| ev.id()).cloned().collect();
|
||||
let mut missing_ids: Vec<EventId> = from.room.get_heads().into_iter().cloned().collect();
|
||||
|
||||
// this would be batched, to find multiple missing events at once
|
||||
while let Some(next) = missing_ids.pop() {
|
||||
if our_ids.contains(&next) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// getting an event from its id would be cached or easily queryable
|
||||
let event = from
|
||||
.room
|
||||
.events
|
||||
.iter()
|
||||
.rev()
|
||||
.find(|ev| ev.id() == &next)
|
||||
.expect("`from` sent the id but doesn't have the event?")
|
||||
.clone();
|
||||
to.append_event(event)?;
|
||||
}
|
||||
|
||||
from.room.resolve_state(&mut *from.store);
|
||||
to.room.resolve_state(&mut *to.store);
|
||||
Ok(())
|
||||
|
@ -238,8 +289,12 @@ fn send_event<R: Resolver + Debug>(state: &mut State<R>, data: &str) -> Result<(
|
|||
}
|
||||
|
||||
fn print_info<R: Resolver + Debug>(state: State<R>) -> Result<()> {
|
||||
let event_count: u64 = state.db.query_row("SELECT count(*) FROM _events", [], |r| r.get(0))?;
|
||||
let row_count: u64 = state.db.query_row("SELECT count(*) FROM data", [], |r| r.get(0))?;
|
||||
let event_count: u64 = state
|
||||
.db
|
||||
.query_row("SELECT count(*) FROM _events", [], |r| r.get(0))?;
|
||||
let row_count: u64 = state
|
||||
.db
|
||||
.query_row("SELECT count(*) FROM data", [], |r| r.get(0))?;
|
||||
println!("room type: {}", state.room.get_resolver().name());
|
||||
println!("room events: {}", event_count);
|
||||
println!("room db records: {}", row_count);
|
||||
|
@ -268,26 +323,29 @@ fn main() -> Result<()> {
|
|||
let cli = Cli::parse();
|
||||
let opened = match &cli {
|
||||
Cli::Init { repo, resolver } => startup(repo, Some(resolver))?,
|
||||
Cli::Send { repo, .. } | Cli::Info { repo, .. } | Cli::Sync { repo, .. } => startup(repo, None)?,
|
||||
Cli::Send { repo, .. }
|
||||
| Cli::Info { repo, .. }
|
||||
| Cli::Sync { repo, .. }
|
||||
| Cli::Serve { repo } => startup(repo, None)?,
|
||||
};
|
||||
match (cli, opened) {
|
||||
(Cli::Init { .. }, _) => {},
|
||||
(Cli::Init { .. }, _) => {}
|
||||
(Cli::Send { repo: _, data }, Opened::Kv(mut state)) => send_event(&mut state, &data)?,
|
||||
(Cli::Send { repo: _, data }, Opened::Forum(mut state)) => send_event(&mut state, &data)?,
|
||||
(Cli::Info { repo: _ }, Opened::Kv(state)) => print_info(state)?,
|
||||
(Cli::Info { repo: _ }, Opened::Forum(state)) => print_info(state)?,
|
||||
(Cli::Sync { repo: _, other }, Opened::Kv(mut our_state)) => {
|
||||
match startup(other, None)? {
|
||||
Opened::Kv(mut their_state) => sync_state(&mut our_state, &mut their_state)?,
|
||||
_ => panic!("cannot sync different room types"),
|
||||
}
|
||||
(Cli::Sync { repo: _, other }, Opened::Kv(mut our_state)) => match startup(other, None)? {
|
||||
Opened::Kv(mut their_state) => sync_state_v2(&mut our_state, &mut their_state)?,
|
||||
_ => panic!("cannot sync different room types"),
|
||||
},
|
||||
(Cli::Sync { repo: _, other }, Opened::Forum(mut our_state)) => {
|
||||
match startup(other, None)? {
|
||||
Opened::Forum(mut their_state) => sync_state(&mut our_state, &mut their_state)?,
|
||||
Opened::Forum(mut their_state) => sync_state_v2(&mut our_state, &mut their_state)?,
|
||||
_ => panic!("cannot sync different room types"),
|
||||
}
|
||||
},
|
||||
}
|
||||
(Cli::Serve { repo: _ }, Opened::Kv(_)) => todo!(),
|
||||
(Cli::Serve { repo: _ }, Opened::Forum(_)) => todo!(),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
1
crates/cli/src/server.rs
Normal file
1
crates/cli/src/server.rs
Normal file
|
@ -0,0 +1 @@
|
|||
// todo
|
|
@ -1,2 +1,4 @@
|
|||
pub mod node;
|
||||
pub mod resolvers;
|
||||
pub mod stores;
|
||||
pub use node::Node;
|
||||
|
|
47
crates/impls/src/node/mod.rs
Normal file
47
crates/impls/src/node/mod.rs
Normal file
|
@ -0,0 +1,47 @@
|
|||
// should this be in impls?
|
||||
|
||||
use dag_resolve::{
|
||||
actor::ActorSecret,
|
||||
event::{CoreContent, Event, EventId},
|
||||
proto::table::Database,
|
||||
resolver::Resolver,
|
||||
room::Room,
|
||||
};
|
||||
|
||||
pub struct Node<R: Resolver, D: Database> {
|
||||
room: Room<R>,
|
||||
db: D,
|
||||
secret: ActorSecret,
|
||||
}
|
||||
|
||||
/// Messages that can be exchanged between peers
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Message<T> {
|
||||
/// A node is trying to send another a set of events
|
||||
Send(Vec<Event<T>>),
|
||||
|
||||
/// A node is telling another the latest events it has
|
||||
Heads(Vec<EventId>),
|
||||
}
|
||||
|
||||
impl<R: Resolver, D: Database> Node<R, D> {
|
||||
pub fn new(room: Room<R>, db: D, secret: ActorSecret) -> Self {
|
||||
Self { room, db, secret }
|
||||
}
|
||||
|
||||
pub fn send(&mut self, data: R::EventType) -> &Event<R::EventType> {
|
||||
let event = self
|
||||
.room
|
||||
.create_event(&mut self.db, CoreContent::Custom(data), &self.secret)
|
||||
.unwrap();
|
||||
event
|
||||
}
|
||||
|
||||
pub fn resolve(&mut self) {
|
||||
self.room.resolve_state(&mut self.db);
|
||||
}
|
||||
|
||||
pub fn room(&self) -> &Room<R> {
|
||||
&self.room
|
||||
}
|
||||
}
|
|
@ -112,6 +112,10 @@ impl<R: Resolver> Room<R> {
|
|||
self.heads.push(event_ref.id().clone());
|
||||
Ok(event_ref)
|
||||
}
|
||||
|
||||
pub fn get_heads(&self) -> &[EventId] {
|
||||
&self.heads
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RoomBuilder<R: Resolver> {
|
||||
|
|
Loading…
Reference in a new issue