Compare commits
2 Commits
777d57512e
...
f761e3b36d
Author | SHA1 | Date |
---|---|---|
Jef Roosens | f761e3b36d | |
Jef Roosens | 4225ce3471 |
|
@ -132,6 +132,154 @@ version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-attributes"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-channel"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
|
||||||
|
dependencies = [
|
||||||
|
"concurrent-queue",
|
||||||
|
"event-listener 2.5.3",
|
||||||
|
"futures-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-channel"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
|
||||||
|
dependencies = [
|
||||||
|
"concurrent-queue",
|
||||||
|
"event-listener-strategy",
|
||||||
|
"futures-core",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-executor"
|
||||||
|
version = "1.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0"
|
||||||
|
dependencies = [
|
||||||
|
"async-task",
|
||||||
|
"concurrent-queue",
|
||||||
|
"fastrand 2.1.0",
|
||||||
|
"futures-lite 2.3.0",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-global-executor"
|
||||||
|
version = "2.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c"
|
||||||
|
dependencies = [
|
||||||
|
"async-channel 2.3.1",
|
||||||
|
"async-executor",
|
||||||
|
"async-io 2.3.3",
|
||||||
|
"async-lock 3.4.0",
|
||||||
|
"blocking",
|
||||||
|
"futures-lite 2.3.0",
|
||||||
|
"once_cell",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-io"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
|
||||||
|
dependencies = [
|
||||||
|
"async-lock 2.8.0",
|
||||||
|
"autocfg",
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"futures-lite 1.13.0",
|
||||||
|
"log",
|
||||||
|
"parking",
|
||||||
|
"polling 2.8.0",
|
||||||
|
"rustix 0.37.27",
|
||||||
|
"slab",
|
||||||
|
"socket2 0.4.10",
|
||||||
|
"waker-fn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-io"
|
||||||
|
version = "2.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964"
|
||||||
|
dependencies = [
|
||||||
|
"async-lock 3.4.0",
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"futures-io",
|
||||||
|
"futures-lite 2.3.0",
|
||||||
|
"parking",
|
||||||
|
"polling 3.7.2",
|
||||||
|
"rustix 0.38.34",
|
||||||
|
"slab",
|
||||||
|
"tracing",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-lock"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener 2.5.3",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-lock"
|
||||||
|
version = "3.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener 5.3.1",
|
||||||
|
"event-listener-strategy",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-std"
|
||||||
|
version = "1.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d"
|
||||||
|
dependencies = [
|
||||||
|
"async-attributes",
|
||||||
|
"async-channel 1.9.0",
|
||||||
|
"async-global-executor",
|
||||||
|
"async-io 1.13.0",
|
||||||
|
"async-lock 2.8.0",
|
||||||
|
"crossbeam-utils",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"futures-lite 1.13.0",
|
||||||
|
"gloo-timers",
|
||||||
|
"kv-log-macro",
|
||||||
|
"log",
|
||||||
|
"memchr",
|
||||||
|
"once_cell",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
"slab",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-stream"
|
name = "async-stream"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
|
@ -154,6 +302,12 @@ dependencies = [
|
||||||
"syn 2.0.66",
|
"syn 2.0.66",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-task"
|
||||||
|
version = "4.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.80"
|
version = "0.1.80"
|
||||||
|
@ -337,6 +491,19 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blocking"
|
||||||
|
version = "1.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
|
||||||
|
dependencies = [
|
||||||
|
"async-channel 2.3.1",
|
||||||
|
"async-task",
|
||||||
|
"futures-io",
|
||||||
|
"futures-lite 2.3.0",
|
||||||
|
"piper",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "borsh"
|
name = "borsh"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
|
@ -486,6 +653,15 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "concurrent-queue"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const-oid"
|
name = "const-oid"
|
||||||
version = "0.9.6"
|
version = "0.9.6"
|
||||||
|
@ -606,6 +782,14 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "entity"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"sea-orm",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -639,6 +823,36 @@ version = "2.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "event-listener"
|
||||||
|
version = "5.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba"
|
||||||
|
dependencies = [
|
||||||
|
"concurrent-queue",
|
||||||
|
"parking",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "event-listener-strategy"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener 5.3.1",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
|
||||||
|
dependencies = [
|
||||||
|
"instant",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
|
@ -750,6 +964,34 @@ version = "0.3.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-lite"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
|
||||||
|
dependencies = [
|
||||||
|
"fastrand 1.9.0",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"memchr",
|
||||||
|
"parking",
|
||||||
|
"pin-project-lite",
|
||||||
|
"waker-fn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-lite"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5"
|
||||||
|
dependencies = [
|
||||||
|
"fastrand 2.1.0",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"parking",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-macro"
|
name = "futures-macro"
|
||||||
version = "0.3.30"
|
version = "0.3.30"
|
||||||
|
@ -824,6 +1066,18 @@ version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-timers"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.5"
|
version = "0.4.5"
|
||||||
|
@ -892,6 +1146,12 @@ version = "0.3.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex"
|
name = "hex"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
|
@ -1072,6 +1332,26 @@ version = "0.1.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
|
checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "instant"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "io-lifetimes"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi 0.3.9",
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.0"
|
version = "1.70.0"
|
||||||
|
@ -1102,6 +1382,15 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kv-log-macro"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
|
@ -1150,6 +1439,12 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.4.14"
|
version = "0.4.14"
|
||||||
|
@ -1171,6 +1466,9 @@ name = "log"
|
||||||
version = "0.4.21"
|
version = "0.4.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||||
|
dependencies = [
|
||||||
|
"value-bag",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
|
@ -1203,6 +1501,14 @@ version = "2.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "migration"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"async-std",
|
||||||
|
"sea-orm-migration",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.17"
|
version = "0.3.17"
|
||||||
|
@ -1334,7 +1640,7 @@ version = "1.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi 0.3.9",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1392,6 +1698,12 @@ version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking"
|
||||||
|
version = "2.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.12.3"
|
version = "0.12.3"
|
||||||
|
@ -1491,6 +1803,17 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "piper"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391"
|
||||||
|
dependencies = [
|
||||||
|
"atomic-waker",
|
||||||
|
"fastrand 2.1.0",
|
||||||
|
"futures-io",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkcs1"
|
name = "pkcs1"
|
||||||
version = "0.7.5"
|
version = "0.7.5"
|
||||||
|
@ -1518,6 +1841,37 @@ version = "0.3.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "polling"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"pin-project-lite",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "polling"
|
||||||
|
version = "3.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"hermit-abi 0.4.0",
|
||||||
|
"pin-project-lite",
|
||||||
|
"rustix 0.38.34",
|
||||||
|
"tracing",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "powerfmt"
|
name = "powerfmt"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -1728,13 +2082,14 @@ dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
"entity",
|
||||||
"figment",
|
"figment",
|
||||||
"futures",
|
"futures",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"libarchive",
|
"libarchive",
|
||||||
|
"migration",
|
||||||
"regex",
|
"regex",
|
||||||
"sea-orm",
|
"sea-orm",
|
||||||
"sea-orm-migration",
|
|
||||||
"sea-query",
|
"sea-query",
|
||||||
"serde",
|
"serde",
|
||||||
"sha256",
|
"sha256",
|
||||||
|
@ -1833,6 +2188,20 @@ version = "0.1.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.37.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"errno",
|
||||||
|
"io-lifetimes",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys 0.3.8",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.38.34"
|
version = "0.38.34"
|
||||||
|
@ -1842,7 +2211,7 @@ dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys 0.4.14",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2071,18 +2440,18 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.203"
|
version = "1.0.204"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.203"
|
version = "1.0.204"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2215,6 +2584,16 @@ version = "1.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.4.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.5.7"
|
version = "0.5.7"
|
||||||
|
@ -2289,7 +2668,7 @@ dependencies = [
|
||||||
"crc",
|
"crc",
|
||||||
"crossbeam-queue",
|
"crossbeam-queue",
|
||||||
"either",
|
"either",
|
||||||
"event-listener",
|
"event-listener 2.5.3",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-intrusive",
|
"futures-intrusive",
|
||||||
|
@ -2571,8 +2950,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"fastrand",
|
"fastrand 2.1.0",
|
||||||
"rustix",
|
"rustix 0.38.34",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2666,7 +3045,7 @@ dependencies = [
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2 0.5.7",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
@ -2975,6 +3354,12 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "value-bag"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -2987,6 +3372,12 @@ version = "0.9.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "waker-fn"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
@ -3024,6 +3415,18 @@ dependencies = [
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-futures"
|
||||||
|
version = "0.4.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.92"
|
version = "0.2.92"
|
||||||
|
@ -3053,6 +3456,16 @@ version = "0.2.92"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.69"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webpki-roots"
|
name = "webpki-roots"
|
||||||
version = "0.25.4"
|
version = "0.25.4"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
|
'migration',
|
||||||
'server',
|
'server',
|
||||||
'libarchive',
|
'libarchive',
|
||||||
'libarchive3-sys'
|
'libarchive3-sys'
|
||||||
]
|
, "entity"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "fat"
|
lto = "fat"
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "entity"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
sea-orm = "0.12.15"
|
||||||
|
serde = { version = "1.0.204", features = ["derive"] }
|
|
@ -8,6 +8,7 @@ use serde::{Deserialize, Serialize};
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
#[sea_orm(primary_key)]
|
#[sea_orm(primary_key)]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
#[sea_orm(unique)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
}
|
}
|
|
@ -1,11 +1,8 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||||
|
|
||||||
use chrono::NaiveDateTime;
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::db::PackageState;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||||
#[sea_orm(table_name = "package")]
|
#[sea_orm(table_name = "package")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
|
@ -20,14 +17,13 @@ pub struct Model {
|
||||||
pub c_size: i64,
|
pub c_size: i64,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
pub build_date: NaiveDateTime,
|
pub build_date: DateTime,
|
||||||
pub packager: Option<String>,
|
pub packager: Option<String>,
|
||||||
pub pgp_sig: Option<String>,
|
pub pgp_sig: Option<String>,
|
||||||
pub pgp_sig_size: Option<i64>,
|
pub pgp_sig_size: Option<i64>,
|
||||||
pub sha256_sum: String,
|
pub sha256_sum: String,
|
||||||
pub compression: String,
|
pub compression: String,
|
||||||
#[serde(skip_serializing)]
|
pub state: crate::PackageState,
|
||||||
pub state: PackageState,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
@ -3,15 +3,13 @@
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::db::PackageRelatedEnum;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||||
#[sea_orm(table_name = "package_related")]
|
#[sea_orm(table_name = "package_related")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
pub package_id: i32,
|
pub package_id: i32,
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
pub r#type: PackageRelatedEnum,
|
pub r#type: crate::PackageRelatedEnum,
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ pub struct Model {
|
||||||
#[sea_orm(primary_key)]
|
#[sea_orm(primary_key)]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub distro_id: i32,
|
pub distro_id: i32,
|
||||||
|
#[sea_orm(unique)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
}
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
pub mod entity;
|
||||||
|
pub use entity::prelude::*;
|
||||||
|
pub use entity::*;
|
||||||
|
|
||||||
|
use sea_orm::{DeriveActiveEnum, EnumIter};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(EnumIter, DeriveActiveEnum, Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
||||||
|
#[sea_orm(rs_type = "i32", db_type = "Integer")]
|
||||||
|
#[serde(rename_all = "lowercase")]
|
||||||
|
pub enum PackageRelatedEnum {
|
||||||
|
#[sea_orm(num_value = 0)]
|
||||||
|
Conflicts,
|
||||||
|
#[sea_orm(num_value = 1)]
|
||||||
|
Replaces,
|
||||||
|
#[sea_orm(num_value = 2)]
|
||||||
|
Provides,
|
||||||
|
#[sea_orm(num_value = 3)]
|
||||||
|
Depend,
|
||||||
|
#[sea_orm(num_value = 4)]
|
||||||
|
Makedepend,
|
||||||
|
#[sea_orm(num_value = 5)]
|
||||||
|
Checkdepend,
|
||||||
|
#[sea_orm(num_value = 6)]
|
||||||
|
Optdepend,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(EnumIter, DeriveActiveEnum, Deserialize, Serialize, PartialEq, Eq, Clone, Debug)]
|
||||||
|
#[sea_orm(rs_type = "i32", db_type = "Integer")]
|
||||||
|
pub enum PackageState {
|
||||||
|
#[sea_orm(num_value = 0)]
|
||||||
|
PendingCommit,
|
||||||
|
#[sea_orm(num_value = 1)]
|
||||||
|
Committed,
|
||||||
|
#[sea_orm(num_value = 2)]
|
||||||
|
PendingDeletion,
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
[package]
|
||||||
|
name = "migration"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "migration"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||||
|
|
||||||
|
[dependencies.sea-orm-migration]
|
||||||
|
version = "0.12.0"
|
||||||
|
features = [
|
||||||
|
"sqlx-postgres",
|
||||||
|
"sqlx-sqlite",
|
||||||
|
"runtime-tokio-rustls",
|
||||||
|
]
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Running Migrator CLI
|
||||||
|
|
||||||
|
- Generate a new migration file
|
||||||
|
```sh
|
||||||
|
cargo run -- generate MIGRATION_NAME
|
||||||
|
```
|
||||||
|
- Apply all pending migrations
|
||||||
|
```sh
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
```sh
|
||||||
|
cargo run -- up
|
||||||
|
```
|
||||||
|
- Apply first 10 pending migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- up -n 10
|
||||||
|
```
|
||||||
|
- Rollback last applied migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- down
|
||||||
|
```
|
||||||
|
- Rollback last 10 applied migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- down -n 10
|
||||||
|
```
|
||||||
|
- Drop all tables from the database, then reapply all migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- fresh
|
||||||
|
```
|
||||||
|
- Rollback all applied migrations, then reapply all migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- refresh
|
||||||
|
```
|
||||||
|
- Rollback all applied migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- reset
|
||||||
|
```
|
||||||
|
- Check the status of all migrations
|
||||||
|
```sh
|
||||||
|
cargo run -- status
|
||||||
|
```
|
|
@ -1,9 +1,9 @@
|
||||||
use sea_orm_migration::prelude::*;
|
pub use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
pub struct Migrator;
|
|
||||||
|
|
||||||
mod m20230730_000001_create_repo_tables;
|
mod m20230730_000001_create_repo_tables;
|
||||||
|
|
||||||
|
pub struct Migrator;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl MigratorTrait for Migrator {
|
impl MigratorTrait for Migrator {
|
||||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
|
@ -0,0 +1,6 @@
|
||||||
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
|
#[async_std::main]
|
||||||
|
async fn main() {
|
||||||
|
cli::run_cli(migration::Migrator).await;
|
||||||
|
}
|
|
@ -15,7 +15,6 @@ futures = "0.3.28"
|
||||||
http-body-util = "0.1.1"
|
http-body-util = "0.1.1"
|
||||||
libarchive = { path = "../libarchive" }
|
libarchive = { path = "../libarchive" }
|
||||||
regex = "1.10.5"
|
regex = "1.10.5"
|
||||||
sea-orm-migration = "0.12.1"
|
|
||||||
sea-query = { version = "0.30.7", features = ["backend-postgres", "backend-sqlite"] }
|
sea-query = { version = "0.30.7", features = ["backend-postgres", "backend-sqlite"] }
|
||||||
serde = { version = "1.0.178", features = ["derive"] }
|
serde = { version = "1.0.178", features = ["derive"] }
|
||||||
sha256 = "1.1.4"
|
sha256 = "1.1.4"
|
||||||
|
@ -26,6 +25,8 @@ tower-http = { version = "0.5.2", features = ["fs", "trace", "auth"] }
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||||
uuid = { version = "1.4.0", features = ["v4"] }
|
uuid = { version = "1.4.0", features = ["v4"] }
|
||||||
|
migration = { path = "../migration" }
|
||||||
|
entity = { path = "../entity" }
|
||||||
|
|
||||||
[dependencies.sea-orm]
|
[dependencies.sea-orm]
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
|
|
@ -1,55 +1,19 @@
|
||||||
pub mod entities;
|
|
||||||
mod migrator;
|
|
||||||
pub mod query;
|
pub mod query;
|
||||||
|
|
||||||
use crate::config::DbConfig;
|
use crate::config::DbConfig;
|
||||||
|
|
||||||
pub use entities::{prelude::*, *};
|
use sea_orm::{ConnectionTrait, Database, DbConn};
|
||||||
pub use migrator::Migrator;
|
use serde::Serialize;
|
||||||
|
|
||||||
use sea_orm::{ConnectionTrait, Database, DbConn, DeriveActiveEnum, EnumIter};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, sea_orm::DbErr>;
|
type Result<T> = std::result::Result<T, sea_orm::DbErr>;
|
||||||
|
|
||||||
#[derive(EnumIter, DeriveActiveEnum, Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
|
||||||
#[sea_orm(rs_type = "i32", db_type = "Integer")]
|
|
||||||
#[serde(rename_all = "lowercase")]
|
|
||||||
pub enum PackageRelatedEnum {
|
|
||||||
#[sea_orm(num_value = 0)]
|
|
||||||
Conflicts,
|
|
||||||
#[sea_orm(num_value = 1)]
|
|
||||||
Replaces,
|
|
||||||
#[sea_orm(num_value = 2)]
|
|
||||||
Provides,
|
|
||||||
#[sea_orm(num_value = 3)]
|
|
||||||
Depend,
|
|
||||||
#[sea_orm(num_value = 4)]
|
|
||||||
Makedepend,
|
|
||||||
#[sea_orm(num_value = 5)]
|
|
||||||
Checkdepend,
|
|
||||||
#[sea_orm(num_value = 6)]
|
|
||||||
Optdepend,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(EnumIter, DeriveActiveEnum, Deserialize, Serialize, PartialEq, Eq, Clone, Debug)]
|
|
||||||
#[sea_orm(rs_type = "i32", db_type = "Integer")]
|
|
||||||
pub enum PackageState {
|
|
||||||
#[sea_orm(num_value = 0)]
|
|
||||||
PendingCommit,
|
|
||||||
#[sea_orm(num_value = 1)]
|
|
||||||
Committed,
|
|
||||||
#[sea_orm(num_value = 2)]
|
|
||||||
PendingDeletion,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct FullPackage {
|
pub struct FullPackage {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
entry: package::Model,
|
entry: entity::package::Model,
|
||||||
licenses: Vec<String>,
|
licenses: Vec<String>,
|
||||||
groups: Vec<String>,
|
groups: Vec<String>,
|
||||||
related: Vec<(PackageRelatedEnum, String)>,
|
related: Vec<(entity::PackageRelatedEnum, String)>,
|
||||||
files: Vec<String>,
|
files: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
use crate::db::*;
|
use crate::db::Result;
|
||||||
|
|
||||||
use sea_orm::{sea_query::IntoCondition, *};
|
use entity::{distro, prelude::Distro};
|
||||||
|
use sea_orm::{
|
||||||
|
sea_query::IntoCondition, ActiveModelTrait, ColumnTrait, Condition, DbConn, EntityTrait,
|
||||||
|
NotSet, PaginatorTrait, QueryFilter, QueryOrder, Set,
|
||||||
|
};
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
|
@ -21,7 +26,7 @@ pub async fn page(
|
||||||
per_page: u64,
|
per_page: u64,
|
||||||
page: u64,
|
page: u64,
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
) -> Result<Vec<distro::Model>> {
|
) -> Result<Vec<entity::distro::Model>> {
|
||||||
let paginator = Distro::find()
|
let paginator = Distro::find()
|
||||||
.filter(filter)
|
.filter(filter)
|
||||||
.order_by_asc(distro::Column::Id)
|
.order_by_asc(distro::Column::Id)
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
use crate::db::{self, *};
|
use crate::db::{FullPackage, Result};
|
||||||
|
|
||||||
use sea_orm::{sea_query::IntoCondition, *};
|
use entity::{
|
||||||
use sea_query::{Alias, Expr, Query, SelectStatement};
|
package, package_file, package_group, package_license, package_related,
|
||||||
|
prelude::{Package, PackageFile, PackageGroup, PackageLicense, PackageRelated},
|
||||||
|
PackageRelatedEnum, PackageState,
|
||||||
|
};
|
||||||
|
use sea_orm::{
|
||||||
|
sea_query::IntoCondition, ActiveModelTrait, ColumnTrait, Condition, ConnectionTrait, DbConn,
|
||||||
|
DeleteResult, EntityTrait, FromQueryResult, Iterable, ModelTrait, NotSet, PaginatorTrait,
|
||||||
|
QueryFilter, QuerySelect, SelectModel, SelectorRaw, Set, TransactionTrait,
|
||||||
|
};
|
||||||
|
use sea_query::{Alias, Expr, JoinType, Order, Query, SelectStatement};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
/// How many fields may be inserted at once into the database.
|
/// How many fields may be inserted at once into the database.
|
||||||
|
@ -31,22 +40,22 @@ pub async fn page(
|
||||||
) -> crate::Result<Vec<package::Model>> {
|
) -> crate::Result<Vec<package::Model>> {
|
||||||
let p2 = Alias::new("p2");
|
let p2 = Alias::new("p2");
|
||||||
let query = Query::select()
|
let query = Query::select()
|
||||||
.columns(db::package::Column::iter().map(|c| (db::package::Entity, c)))
|
.columns(package::Column::iter().map(|c| (package::Entity, c)))
|
||||||
.from(db::package::Entity)
|
.from(package::Entity)
|
||||||
.join_subquery(
|
.join_subquery(
|
||||||
JoinType::InnerJoin,
|
JoinType::InnerJoin,
|
||||||
max_pkg_ids_query(true),
|
max_pkg_ids_query(true),
|
||||||
p2.clone(),
|
p2.clone(),
|
||||||
Expr::col((db::package::Entity, db::package::Column::Id))
|
Expr::col((package::Entity, package::Column::Id))
|
||||||
.eq(Expr::col((p2.clone(), Alias::new("max_id")))),
|
.eq(Expr::col((p2.clone(), Alias::new("max_id")))),
|
||||||
)
|
)
|
||||||
.cond_where(filter)
|
.cond_where(filter)
|
||||||
.order_by((db::package::Entity, db::package::Column::Id), Order::Asc)
|
.order_by((package::Entity, package::Column::Id), Order::Asc)
|
||||||
.to_owned();
|
.to_owned();
|
||||||
let builder = conn.get_database_backend();
|
let builder = conn.get_database_backend();
|
||||||
let sql = builder.build(&query);
|
let sql = builder.build(&query);
|
||||||
|
|
||||||
Ok(db::Package::find()
|
Ok(Package::find()
|
||||||
.from_raw_sql(sql)
|
.from_raw_sql(sql)
|
||||||
.paginate(conn, per_page)
|
.paginate(conn, per_page)
|
||||||
.fetch_page(page)
|
.fetch_page(page)
|
||||||
|
@ -213,7 +222,7 @@ pub async fn full(conn: &DbConn, id: i32) -> Result<Option<FullPackage>> {
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(conn)
|
.all(conn)
|
||||||
.await?;
|
.await?;
|
||||||
let related: Vec<(db::PackageRelatedEnum, String)> = entry
|
let related: Vec<(PackageRelatedEnum, String)> = entry
|
||||||
.find_related(PackageRelated)
|
.find_related(PackageRelated)
|
||||||
.select_only()
|
.select_only()
|
||||||
.columns([package_related::Column::Type, package_related::Column::Name])
|
.columns([package_related::Column::Type, package_related::Column::Name])
|
||||||
|
@ -248,22 +257,22 @@ pub struct PkgToRemove {
|
||||||
|
|
||||||
fn max_pkg_ids_query(committed: bool) -> SelectStatement {
|
fn max_pkg_ids_query(committed: bool) -> SelectStatement {
|
||||||
let mut query = Query::select()
|
let mut query = Query::select()
|
||||||
.from(db::package::Entity)
|
.from(package::Entity)
|
||||||
.columns([
|
.columns([
|
||||||
db::package::Column::RepoId,
|
package::Column::RepoId,
|
||||||
db::package::Column::Arch,
|
package::Column::Arch,
|
||||||
db::package::Column::Name,
|
package::Column::Name,
|
||||||
])
|
])
|
||||||
.expr_as(db::package::Column::Id.max(), Alias::new("max_id"))
|
.expr_as(package::Column::Id.max(), Alias::new("max_id"))
|
||||||
.group_by_columns([
|
.group_by_columns([
|
||||||
db::package::Column::RepoId,
|
package::Column::RepoId,
|
||||||
db::package::Column::Arch,
|
package::Column::Arch,
|
||||||
db::package::Column::Name,
|
package::Column::Name,
|
||||||
])
|
])
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
if committed {
|
if committed {
|
||||||
query.cond_where(db::package::Column::State.eq(db::PackageState::Committed));
|
query.cond_where(package::Column::State.eq(PackageState::Committed));
|
||||||
}
|
}
|
||||||
|
|
||||||
query
|
query
|
||||||
|
@ -278,47 +287,44 @@ pub fn pkgs_to_sync(
|
||||||
) -> SelectorRaw<SelectModel<package::Model>> {
|
) -> SelectorRaw<SelectModel<package::Model>> {
|
||||||
let (p1, p2) = (Alias::new("p1"), Alias::new("p2"));
|
let (p1, p2) = (Alias::new("p1"), Alias::new("p2"));
|
||||||
let query = Query::select()
|
let query = Query::select()
|
||||||
.columns(db::package::Column::iter().map(|c| (p1.clone(), c)))
|
.columns(package::Column::iter().map(|c| (p1.clone(), c)))
|
||||||
.from_as(db::package::Entity, p1.clone())
|
.from_as(package::Entity, p1.clone())
|
||||||
.join_subquery(
|
.join_subquery(
|
||||||
JoinType::InnerJoin,
|
JoinType::InnerJoin,
|
||||||
max_pkg_ids_query(false),
|
max_pkg_ids_query(false),
|
||||||
p2.clone(),
|
p2.clone(),
|
||||||
Expr::col((p1.clone(), db::package::Column::Id))
|
Expr::col((p1.clone(), package::Column::Id))
|
||||||
.eq(Expr::col((p2.clone(), Alias::new("max_id")))),
|
.eq(Expr::col((p2.clone(), Alias::new("max_id")))),
|
||||||
)
|
)
|
||||||
.cond_where(
|
.cond_where(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(Expr::col((p1.clone(), db::package::Column::RepoId)).eq(repo))
|
.add(Expr::col((p1.clone(), package::Column::RepoId)).eq(repo))
|
||||||
|
.add(Expr::col((p1.clone(), package::Column::Arch)).is_in([arch, crate::ANY_ARCH]))
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::Arch))
|
Expr::col((p1.clone(), package::Column::State))
|
||||||
.is_in([arch, crate::ANY_ARCH]),
|
.ne(PackageState::PendingDeletion),
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Expr::col((p1.clone(), db::package::Column::State))
|
|
||||||
.ne(db::PackageState::PendingDeletion),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.to_owned();
|
.to_owned();
|
||||||
let builder = conn.get_database_backend();
|
let builder = conn.get_database_backend();
|
||||||
let sql = builder.build(&query);
|
let sql = builder.build(&query);
|
||||||
|
|
||||||
db::Package::find().from_raw_sql(sql)
|
Package::find().from_raw_sql(sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stale_pkgs_query(include_repo: bool) -> SelectStatement {
|
fn stale_pkgs_query(include_repo: bool) -> SelectStatement {
|
||||||
let (p1, p2) = (Alias::new("p1"), Alias::new("p2"));
|
let (p1, p2) = (Alias::new("p1"), Alias::new("p2"));
|
||||||
let mut query = Query::select()
|
let mut query = Query::select()
|
||||||
.from_as(db::package::Entity, p1.clone())
|
.from_as(package::Entity, p1.clone())
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
if include_repo {
|
if include_repo {
|
||||||
query.columns([
|
query.columns([
|
||||||
(p1.clone(), db::package::Column::RepoId),
|
(p1.clone(), package::Column::RepoId),
|
||||||
(p1.clone(), db::package::Column::Id),
|
(p1.clone(), package::Column::Id),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
query.column((p1.clone(), db::package::Column::Id));
|
query.column((p1.clone(), package::Column::Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// We left join on the max pkgs query because a repository that has all its packages set to
|
// We left join on the max pkgs query because a repository that has all its packages set to
|
||||||
|
@ -331,27 +337,27 @@ fn stale_pkgs_query(include_repo: bool) -> SelectStatement {
|
||||||
p2.clone(),
|
p2.clone(),
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::RepoId))
|
Expr::col((p1.clone(), package::Column::RepoId))
|
||||||
.eq(Expr::col((p2.clone(), db::package::Column::RepoId))),
|
.eq(Expr::col((p2.clone(), package::Column::RepoId))),
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::Arch))
|
Expr::col((p1.clone(), package::Column::Arch))
|
||||||
.eq(Expr::col((p2.clone(), db::package::Column::Arch))),
|
.eq(Expr::col((p2.clone(), package::Column::Arch))),
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::Name))
|
Expr::col((p1.clone(), package::Column::Name))
|
||||||
.eq(Expr::col((p2.clone(), db::package::Column::Name))),
|
.eq(Expr::col((p2.clone(), package::Column::Name))),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.cond_where(
|
.cond_where(
|
||||||
Condition::any()
|
Condition::any()
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::Id))
|
Expr::col((p1.clone(), package::Column::Id))
|
||||||
.lt(Expr::col((p2.clone(), Alias::new("max_id")))),
|
.lt(Expr::col((p2.clone(), Alias::new("max_id")))),
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), db::package::Column::State))
|
Expr::col((p1.clone(), package::Column::State))
|
||||||
.eq(db::PackageState::PendingDeletion),
|
.eq(PackageState::PendingDeletion),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -367,9 +373,9 @@ pub fn stale_pkgs(conn: &DbConn) -> SelectorRaw<SelectModel<PkgToRemove>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_stale_pkgs(conn: &DbConn, max_id: i32) -> crate::Result<()> {
|
pub async fn delete_stale_pkgs(conn: &DbConn, max_id: i32) -> crate::Result<()> {
|
||||||
Ok(db::Package::delete_many()
|
Ok(Package::delete_many()
|
||||||
.filter(db::package::Column::Id.lte(max_id))
|
.filter(package::Column::Id.lte(max_id))
|
||||||
.filter(db::package::Column::Id.in_subquery(stale_pkgs_query(false)))
|
.filter(package::Column::Id.in_subquery(stale_pkgs_query(false)))
|
||||||
.exec(conn)
|
.exec(conn)
|
||||||
.await
|
.await
|
||||||
.map(|_| ())?)
|
.map(|_| ())?)
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
use crate::db::*;
|
use crate::db::Result;
|
||||||
|
|
||||||
use sea_orm::{sea_query::IntoCondition, *};
|
use entity::{prelude::Repo, repo};
|
||||||
|
use sea_orm::{
|
||||||
|
sea_query::IntoCondition, ActiveModelTrait, ColumnTrait, Condition, DbConn, EntityTrait,
|
||||||
|
NotSet, PaginatorTrait, QueryFilter, QueryOrder, Set,
|
||||||
|
};
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub use error::{Result, ServerError};
|
||||||
use std::{io, path::PathBuf};
|
use std::{io, path::PathBuf};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use sea_orm_migration::MigratorTrait;
|
use migration::MigratorTrait;
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ fn setup(rt: &runtime::Handle, config_file: PathBuf) -> crate::Result<Global> {
|
||||||
|
|
||||||
tracing::info!("Connecting to database");
|
tracing::info!("Connecting to database");
|
||||||
let db = rt.block_on(crate::db::connect(&config.db))?;
|
let db = rt.block_on(crate::db::connect(&config.db))?;
|
||||||
rt.block_on(crate::db::Migrator::up(&db, None))?;
|
rt.block_on(migration::Migrator::up(&db, None))?;
|
||||||
|
|
||||||
let repo = match &config.fs {
|
let repo = match &config.fs {
|
||||||
FsConfig::Local { data_dir } => {
|
FsConfig::Local { data_dir } => {
|
||||||
|
|
|
@ -99,10 +99,10 @@ impl Actor {
|
||||||
|
|
||||||
if let Some(_guard) = repos.get(&repo).map(|n| n.1.lock()) {
|
if let Some(_guard) = repos.get(&repo).map(|n| n.1.lock()) {
|
||||||
let archs: Vec<String> = self.rt.block_on(
|
let archs: Vec<String> = self.rt.block_on(
|
||||||
db::Package::find()
|
entity::Package::find()
|
||||||
.filter(db::package::Column::RepoId.eq(repo))
|
.filter(entity::package::Column::RepoId.eq(repo))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::package::Column::Arch)
|
.column(entity::package::Column::Arch)
|
||||||
.distinct()
|
.distinct()
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.state.conn),
|
.all(&self.state.conn),
|
||||||
|
@ -171,12 +171,12 @@ impl Actor {
|
||||||
|
|
||||||
// Update the state for the newly committed packages
|
// Update the state for the newly committed packages
|
||||||
self.rt.block_on(
|
self.rt.block_on(
|
||||||
db::Package::update_many()
|
entity::Package::update_many()
|
||||||
.col_expr(
|
.col_expr(
|
||||||
db::package::Column::State,
|
entity::package::Column::State,
|
||||||
Expr::value(db::PackageState::Committed),
|
Expr::value(entity::PackageState::Committed),
|
||||||
)
|
)
|
||||||
.filter(db::package::Column::Id.is_in(committed_ids))
|
.filter(entity::package::Column::Id.is_in(committed_ids))
|
||||||
.exec(&self.state.conn),
|
.exec(&self.state.conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::db;
|
|
||||||
use std::{
|
use std::{
|
||||||
io::Write,
|
io::Write,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -69,7 +68,7 @@ impl RepoArchivesWriter {
|
||||||
Ok(ar.append_path(&mut ar_entry, src_path)?)
|
Ok(ar.append_path(&mut ar_entry, src_path)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn append_pkg(&mut self, pkg: &db::package::Model) -> crate::Result<()> {
|
pub fn append_pkg(&mut self, pkg: &entity::package::Model) -> crate::Result<()> {
|
||||||
self.write_desc(&self.tmp_paths[0], pkg)?;
|
self.write_desc(&self.tmp_paths[0], pkg)?;
|
||||||
self.write_files(&self.tmp_paths[1], pkg)?;
|
self.write_files(&self.tmp_paths[1], pkg)?;
|
||||||
|
|
||||||
|
@ -85,7 +84,11 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate a "files" archive entry for the package in the given path
|
/// Generate a "files" archive entry for the package in the given path
|
||||||
fn write_files(&self, path: impl AsRef<Path>, pkg: &db::package::Model) -> crate::Result<()> {
|
fn write_files(
|
||||||
|
&self,
|
||||||
|
path: impl AsRef<Path>,
|
||||||
|
pkg: &entity::package::Model,
|
||||||
|
) -> crate::Result<()> {
|
||||||
let mut f = std::io::BufWriter::new(std::fs::File::create(path)?);
|
let mut f = std::io::BufWriter::new(std::fs::File::create(path)?);
|
||||||
|
|
||||||
writeln!(f, "%FILES%")?;
|
writeln!(f, "%FILES%")?;
|
||||||
|
@ -93,7 +96,7 @@ impl RepoArchivesWriter {
|
||||||
let (tx, mut rx) = mpsc::channel(1);
|
let (tx, mut rx) = mpsc::channel(1);
|
||||||
|
|
||||||
let conn = self.conn.clone();
|
let conn = self.conn.clone();
|
||||||
let query = pkg.find_related(db::PackageFile);
|
let query = pkg.find_related(entity::prelude::PackageFile);
|
||||||
|
|
||||||
self.rt.spawn(async move {
|
self.rt.spawn(async move {
|
||||||
match query.stream(&conn).await {
|
match query.stream(&conn).await {
|
||||||
|
@ -121,7 +124,11 @@ impl RepoArchivesWriter {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_desc(&self, path: impl AsRef<Path>, pkg: &db::package::Model) -> crate::Result<()> {
|
fn write_desc(
|
||||||
|
&self,
|
||||||
|
path: impl AsRef<Path>,
|
||||||
|
pkg: &entity::package::Model,
|
||||||
|
) -> crate::Result<()> {
|
||||||
let mut f = std::io::BufWriter::new(std::fs::File::create(path)?);
|
let mut f = std::io::BufWriter::new(std::fs::File::create(path)?);
|
||||||
|
|
||||||
let filename = format!(
|
let filename = format!(
|
||||||
|
@ -147,9 +154,9 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let groups: Vec<String> = self.rt.block_on(
|
let groups: Vec<String> = self.rt.block_on(
|
||||||
pkg.find_related(db::PackageGroup)
|
pkg.find_related(entity::prelude::PackageGroup)
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::package_group::Column::Name)
|
.column(entity::package_group::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
@ -165,9 +172,9 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let licenses: Vec<String> = self.rt.block_on(
|
let licenses: Vec<String> = self.rt.block_on(
|
||||||
pkg.find_related(db::PackageLicense)
|
pkg.find_related(entity::prelude::PackageLicense)
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::package_license::Column::Name)
|
.column(entity::package_license::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
@ -186,21 +193,21 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let related = [
|
let related = [
|
||||||
("REPLACES", db::PackageRelatedEnum::Replaces),
|
("REPLACES", entity::PackageRelatedEnum::Replaces),
|
||||||
("CONFLICTS", db::PackageRelatedEnum::Conflicts),
|
("CONFLICTS", entity::PackageRelatedEnum::Conflicts),
|
||||||
("PROVIDES", db::PackageRelatedEnum::Provides),
|
("PROVIDES", entity::PackageRelatedEnum::Provides),
|
||||||
("DEPENDS", db::PackageRelatedEnum::Depend),
|
("DEPENDS", entity::PackageRelatedEnum::Depend),
|
||||||
("OPTDEPENDS", db::PackageRelatedEnum::Optdepend),
|
("OPTDEPENDS", entity::PackageRelatedEnum::Optdepend),
|
||||||
("MAKEDEPENDS", db::PackageRelatedEnum::Makedepend),
|
("MAKEDEPENDS", entity::PackageRelatedEnum::Makedepend),
|
||||||
("CHECKDEPENDS", db::PackageRelatedEnum::Checkdepend),
|
("CHECKDEPENDS", entity::PackageRelatedEnum::Checkdepend),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (key, attr) in related.into_iter() {
|
for (key, attr) in related.into_iter() {
|
||||||
let items: Vec<String> = self.rt.block_on(
|
let items: Vec<String> = self.rt.block_on(
|
||||||
pkg.find_related(db::PackageRelated)
|
pkg.find_related(entity::prelude::PackageRelated)
|
||||||
.filter(db::package_related::Column::Type.eq(attr))
|
.filter(entity::package_related::Column::Type.eq(attr))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::package_related::Column::Name)
|
.column(entity::package_related::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use super::{Command, SharedState};
|
use super::{Command, SharedState};
|
||||||
use crate::db;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
@ -34,10 +33,10 @@ impl Handle {
|
||||||
pub async fn get_or_create_repo(&self, distro: &str, repo: &str) -> crate::Result<i32> {
|
pub async fn get_or_create_repo(&self, distro: &str, repo: &str) -> crate::Result<i32> {
|
||||||
let mut repos = self.state.repos.write().await;
|
let mut repos = self.state.repos.write().await;
|
||||||
|
|
||||||
let distro_id: Option<i32> = db::Distro::find()
|
let distro_id: Option<i32> = entity::Distro::find()
|
||||||
.filter(db::distro::Column::Name.eq(distro))
|
.filter(entity::distro::Column::Name.eq(distro))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::distro::Column::Id)
|
.column(entity::distro::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -45,7 +44,7 @@ impl Handle {
|
||||||
let distro_id = if let Some(id) = distro_id {
|
let distro_id = if let Some(id) = distro_id {
|
||||||
id
|
id
|
||||||
} else {
|
} else {
|
||||||
let new_distro = db::distro::ActiveModel {
|
let new_distro = entity::distro::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
name: Set(distro.to_string()),
|
name: Set(distro.to_string()),
|
||||||
description: NotSet,
|
description: NotSet,
|
||||||
|
@ -54,11 +53,11 @@ impl Handle {
|
||||||
new_distro.insert(&self.state.conn).await?.id
|
new_distro.insert(&self.state.conn).await?.id
|
||||||
};
|
};
|
||||||
|
|
||||||
let repo_id: Option<i32> = db::Repo::find()
|
let repo_id: Option<i32> = entity::Repo::find()
|
||||||
.filter(db::repo::Column::DistroId.eq(distro_id))
|
.filter(entity::repo::Column::DistroId.eq(distro_id))
|
||||||
.filter(db::repo::Column::Name.eq(repo))
|
.filter(entity::repo::Column::Name.eq(repo))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::repo::Column::Id)
|
.column(entity::repo::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -66,7 +65,7 @@ impl Handle {
|
||||||
let repo_id = if let Some(id) = repo_id {
|
let repo_id = if let Some(id) = repo_id {
|
||||||
id
|
id
|
||||||
} else {
|
} else {
|
||||||
let new_repo = db::repo::ActiveModel {
|
let new_repo = entity::repo::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
distro_id: Set(distro_id),
|
distro_id: Set(distro_id),
|
||||||
name: Set(repo.to_string()),
|
name: Set(repo.to_string()),
|
||||||
|
@ -84,12 +83,12 @@ impl Handle {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_repo(&self, distro: &str, repo: &str) -> crate::Result<Option<i32>> {
|
pub async fn get_repo(&self, distro: &str, repo: &str) -> crate::Result<Option<i32>> {
|
||||||
Ok(db::Repo::find()
|
Ok(entity::Repo::find()
|
||||||
.find_also_related(db::Distro)
|
.find_also_related(entity::Distro)
|
||||||
.filter(
|
.filter(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(db::repo::Column::Name.eq(repo))
|
.add(entity::repo::Column::Name.eq(repo))
|
||||||
.add(db::distro::Column::Name.eq(distro)),
|
.add(entity::distro::Column::Name.eq(distro)),
|
||||||
)
|
)
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await
|
.await
|
||||||
|
@ -98,7 +97,9 @@ impl Handle {
|
||||||
|
|
||||||
pub async fn remove_repo(&self, repo: i32) -> crate::Result<()> {
|
pub async fn remove_repo(&self, repo: i32) -> crate::Result<()> {
|
||||||
self.state.repos.write().await.remove(&repo);
|
self.state.repos.write().await.remove(&repo);
|
||||||
db::Repo::delete_by_id(repo).exec(&self.state.conn).await?;
|
entity::Repo::delete_by_id(repo)
|
||||||
|
.exec(&self.state.conn)
|
||||||
|
.await?;
|
||||||
let _ = tokio::fs::remove_dir_all(self.state.repos_dir.join(repo.to_string())).await;
|
let _ = tokio::fs::remove_dir_all(self.state.repos_dir.join(repo.to_string())).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -108,15 +109,15 @@ impl Handle {
|
||||||
/// packages with the given architecture as "pending deletion", before performing a manual sync
|
/// packages with the given architecture as "pending deletion", before performing a manual sync
|
||||||
/// & removal of stale packages.
|
/// & removal of stale packages.
|
||||||
pub async fn remove_repo_arch(&self, repo: i32, arch: &str) -> crate::Result<()> {
|
pub async fn remove_repo_arch(&self, repo: i32, arch: &str) -> crate::Result<()> {
|
||||||
db::Package::update_many()
|
entity::Package::update_many()
|
||||||
.col_expr(
|
.col_expr(
|
||||||
db::package::Column::State,
|
entity::package::Column::State,
|
||||||
Expr::value(db::PackageState::PendingDeletion),
|
Expr::value(entity::PackageState::PendingDeletion),
|
||||||
)
|
)
|
||||||
.filter(
|
.filter(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(db::package::Column::RepoId.eq(repo))
|
.add(entity::package::Column::RepoId.eq(repo))
|
||||||
.add(db::package::Column::Arch.eq(arch)),
|
.add(entity::package::Column::Arch.eq(arch)),
|
||||||
)
|
)
|
||||||
.exec(&self.state.conn)
|
.exec(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -6,8 +6,6 @@ pub mod package;
|
||||||
pub use actor::Actor;
|
pub use actor::Actor;
|
||||||
pub use handle::Handle;
|
pub use handle::Handle;
|
||||||
|
|
||||||
use crate::db;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -67,9 +65,9 @@ pub fn start(
|
||||||
|
|
||||||
let mut repos = HashMap::new();
|
let mut repos = HashMap::new();
|
||||||
let repo_ids: Vec<i32> = rt.block_on(
|
let repo_ids: Vec<i32> = rt.block_on(
|
||||||
db::Repo::find()
|
entity::prelude::Repo::find()
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(db::repo::Column::Id)
|
.column(entity::repo::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&conn),
|
.all(&conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use crate::db::entities::package;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt, fs,
|
fmt, fs,
|
||||||
io::{self, BufRead, BufReader, Read},
|
io::{self, BufRead, BufReader, Read},
|
||||||
|
@ -11,7 +9,6 @@ use libarchive::{
|
||||||
read::{Archive, Builder},
|
read::{Archive, Builder},
|
||||||
Entry, ReadFilter,
|
Entry, ReadFilter,
|
||||||
};
|
};
|
||||||
use sea_orm::ActiveValue::Set;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Package {
|
pub struct Package {
|
||||||
|
@ -194,26 +191,3 @@ impl Package {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Package> for package::ActiveModel {
|
|
||||||
fn from(pkg: Package) -> Self {
|
|
||||||
let info = pkg.info;
|
|
||||||
|
|
||||||
package::ActiveModel {
|
|
||||||
base: Set(info.base),
|
|
||||||
name: Set(info.name),
|
|
||||||
version: Set(info.version),
|
|
||||||
arch: Set(info.arch),
|
|
||||||
size: Set(info.size),
|
|
||||||
c_size: Set(info.csize),
|
|
||||||
description: Set(info.description),
|
|
||||||
url: Set(info.url),
|
|
||||||
build_date: Set(info.build_date),
|
|
||||||
packager: Set(info.packager),
|
|
||||||
pgp_sig: Set(info.pgpsig),
|
|
||||||
pgp_sig_size: Set(info.pgpsigsize),
|
|
||||||
sha256_sum: Set(info.sha256sum),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ async fn get_repos(
|
||||||
State(global): State<crate::Global>,
|
State(global): State<crate::Global>,
|
||||||
Query(pagination): Query<pagination::Query>,
|
Query(pagination): Query<pagination::Query>,
|
||||||
Query(filter): Query<db::query::repo::Filter>,
|
Query(filter): Query<db::query::repo::Filter>,
|
||||||
) -> crate::Result<Json<PaginatedResponse<db::repo::Model>>> {
|
) -> crate::Result<Json<PaginatedResponse<entity::repo::Model>>> {
|
||||||
let items =
|
let items =
|
||||||
db::query::repo::page(&global.db, pagination.per_page, pagination.page - 1, filter).await?;
|
db::query::repo::page(&global.db, pagination.per_page, pagination.page - 1, filter).await?;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ async fn get_repos(
|
||||||
async fn get_single_repo(
|
async fn get_single_repo(
|
||||||
State(global): State<crate::Global>,
|
State(global): State<crate::Global>,
|
||||||
Path(id): Path<i32>,
|
Path(id): Path<i32>,
|
||||||
) -> crate::Result<Json<db::repo::Model>> {
|
) -> crate::Result<Json<entity::repo::Model>> {
|
||||||
let repo = db::query::repo::by_id(&global.db, id)
|
let repo = db::query::repo::by_id(&global.db, id)
|
||||||
.await?
|
.await?
|
||||||
.ok_or(axum::http::StatusCode::NOT_FOUND)?;
|
.ok_or(axum::http::StatusCode::NOT_FOUND)?;
|
||||||
|
@ -43,7 +43,7 @@ async fn get_packages(
|
||||||
State(global): State<crate::Global>,
|
State(global): State<crate::Global>,
|
||||||
Query(pagination): Query<pagination::Query>,
|
Query(pagination): Query<pagination::Query>,
|
||||||
Query(filter): Query<db::query::package::Filter>,
|
Query(filter): Query<db::query::package::Filter>,
|
||||||
) -> crate::Result<Json<PaginatedResponse<db::package::Model>>> {
|
) -> crate::Result<Json<PaginatedResponse<entity::package::Model>>> {
|
||||||
let items =
|
let items =
|
||||||
db::query::package::page(&global.db, pagination.per_page, pagination.page - 1, filter)
|
db::query::package::page(&global.db, pagination.per_page, pagination.page - 1, filter)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in New Issue