Compare commits
No commits in common. "f761e3b36dbc28d94cbe28cb308334606a58ba13" and "777d57512e2da821754c3203e7140df9aa8f956c" have entirely different histories.
f761e3b36d
...
777d57512e
|
@ -132,154 +132,6 @@ 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"
|
||||||
|
@ -302,12 +154,6 @@ 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"
|
||||||
|
@ -491,19 +337,6 @@ 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"
|
||||||
|
@ -653,15 +486,6 @@ 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"
|
||||||
|
@ -782,14 +606,6 @@ 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"
|
||||||
|
@ -823,36 +639,6 @@ 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"
|
||||||
|
@ -964,34 +750,6 @@ 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"
|
||||||
|
@ -1066,18 +824,6 @@ 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"
|
||||||
|
@ -1146,12 +892,6 @@ 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"
|
||||||
|
@ -1332,26 +1072,6 @@ 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"
|
||||||
|
@ -1382,15 +1102,6 @@ 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"
|
||||||
|
@ -1439,12 +1150,6 @@ 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"
|
||||||
|
@ -1466,9 +1171,6 @@ 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"
|
||||||
|
@ -1501,14 +1203,6 @@ 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"
|
||||||
|
@ -1640,7 +1334,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 0.3.9",
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1698,12 +1392,6 @@ 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"
|
||||||
|
@ -1803,17 +1491,6 @@ 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"
|
||||||
|
@ -1841,37 +1518,6 @@ 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"
|
||||||
|
@ -2082,14 +1728,13 @@ 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",
|
||||||
|
@ -2188,20 +1833,6 @@ 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"
|
||||||
|
@ -2211,7 +1842,7 @@ dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.4.14",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2440,18 +2071,18 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.204"
|
version = "1.0.203"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.204"
|
version = "1.0.203"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2584,16 +2215,6 @@ 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"
|
||||||
|
@ -2668,7 +2289,7 @@ dependencies = [
|
||||||
"crc",
|
"crc",
|
||||||
"crossbeam-queue",
|
"crossbeam-queue",
|
||||||
"either",
|
"either",
|
||||||
"event-listener 2.5.3",
|
"event-listener",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-intrusive",
|
"futures-intrusive",
|
||||||
|
@ -2950,8 +2571,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"fastrand 2.1.0",
|
"fastrand",
|
||||||
"rustix 0.38.34",
|
"rustix",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3045,7 +2666,7 @@ dependencies = [
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"socket2 0.5.7",
|
"socket2",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
@ -3354,12 +2975,6 @@ 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"
|
||||||
|
@ -3372,12 +2987,6 @@ 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"
|
||||||
|
@ -3415,18 +3024,6 @@ 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"
|
||||||
|
@ -3456,16 +3053,6 @@ 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,10 +1,9 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
'migration',
|
|
||||||
'server',
|
'server',
|
||||||
'libarchive',
|
'libarchive',
|
||||||
'libarchive3-sys'
|
'libarchive3-sys'
|
||||||
, "entity"]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "fat"
|
lto = "fat"
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "entity"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
sea-orm = "0.12.15"
|
|
||||||
serde = { version = "1.0.204", features = ["derive"] }
|
|
|
@ -1,37 +0,0 @@
|
||||||
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,
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
[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",
|
|
||||||
]
|
|
|
@ -1,41 +0,0 @@
|
||||||
# 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,6 +0,0 @@
|
||||||
use sea_orm_migration::prelude::*;
|
|
||||||
|
|
||||||
#[async_std::main]
|
|
||||||
async fn main() {
|
|
||||||
cli::run_cli(migration::Migrator).await;
|
|
||||||
}
|
|
|
@ -15,6 +15,7 @@ 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"
|
||||||
|
@ -25,8 +26,6 @@ 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"
|
||||||
|
|
|
@ -8,7 +8,6 @@ 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,8 +1,11 @@
|
||||||
//! `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 {
|
||||||
|
@ -17,13 +20,14 @@ 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: DateTime,
|
pub build_date: NaiveDateTime,
|
||||||
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,
|
||||||
pub state: crate::PackageState,
|
#[serde(skip_serializing)]
|
||||||
|
pub state: PackageState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
@ -3,13 +3,15 @@
|
||||||
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: crate::PackageRelatedEnum,
|
pub r#type: PackageRelatedEnum,
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
|
@ -9,7 +9,6 @@ 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>,
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
pub use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
mod m20230730_000001_create_repo_tables;
|
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
|
mod m20230730_000001_create_repo_tables;
|
||||||
|
|
||||||
#[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>> {
|
|
@ -1,19 +1,55 @@
|
||||||
|
pub mod entities;
|
||||||
|
mod migrator;
|
||||||
pub mod query;
|
pub mod query;
|
||||||
|
|
||||||
use crate::config::DbConfig;
|
use crate::config::DbConfig;
|
||||||
|
|
||||||
use sea_orm::{ConnectionTrait, Database, DbConn};
|
pub use entities::{prelude::*, *};
|
||||||
use serde::Serialize;
|
pub use migrator::Migrator;
|
||||||
|
|
||||||
|
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: entity::package::Model,
|
entry: package::Model,
|
||||||
licenses: Vec<String>,
|
licenses: Vec<String>,
|
||||||
groups: Vec<String>,
|
groups: Vec<String>,
|
||||||
related: Vec<(entity::PackageRelatedEnum, String)>,
|
related: Vec<(PackageRelatedEnum, String)>,
|
||||||
files: Vec<String>,
|
files: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
use crate::db::Result;
|
use crate::db::*;
|
||||||
|
|
||||||
use entity::{distro, prelude::Distro};
|
use sea_orm::{sea_query::IntoCondition, *};
|
||||||
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 {
|
||||||
|
@ -26,7 +21,7 @@ pub async fn page(
|
||||||
per_page: u64,
|
per_page: u64,
|
||||||
page: u64,
|
page: u64,
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
) -> Result<Vec<entity::distro::Model>> {
|
) -> Result<Vec<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,16 +1,7 @@
|
||||||
use crate::db::{FullPackage, Result};
|
use crate::db::{self, *};
|
||||||
|
|
||||||
use entity::{
|
use sea_orm::{sea_query::IntoCondition, *};
|
||||||
package, package_file, package_group, package_license, package_related,
|
use sea_query::{Alias, Expr, Query, SelectStatement};
|
||||||
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.
|
||||||
|
@ -40,22 +31,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(package::Column::iter().map(|c| (package::Entity, c)))
|
.columns(db::package::Column::iter().map(|c| (db::package::Entity, c)))
|
||||||
.from(package::Entity)
|
.from(db::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((package::Entity, package::Column::Id))
|
Expr::col((db::package::Entity, db::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((package::Entity, package::Column::Id), Order::Asc)
|
.order_by((db::package::Entity, db::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(Package::find()
|
Ok(db::Package::find()
|
||||||
.from_raw_sql(sql)
|
.from_raw_sql(sql)
|
||||||
.paginate(conn, per_page)
|
.paginate(conn, per_page)
|
||||||
.fetch_page(page)
|
.fetch_page(page)
|
||||||
|
@ -222,7 +213,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<(PackageRelatedEnum, String)> = entry
|
let related: Vec<(db::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])
|
||||||
|
@ -257,22 +248,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(package::Entity)
|
.from(db::package::Entity)
|
||||||
.columns([
|
.columns([
|
||||||
package::Column::RepoId,
|
db::package::Column::RepoId,
|
||||||
package::Column::Arch,
|
db::package::Column::Arch,
|
||||||
package::Column::Name,
|
db::package::Column::Name,
|
||||||
])
|
])
|
||||||
.expr_as(package::Column::Id.max(), Alias::new("max_id"))
|
.expr_as(db::package::Column::Id.max(), Alias::new("max_id"))
|
||||||
.group_by_columns([
|
.group_by_columns([
|
||||||
package::Column::RepoId,
|
db::package::Column::RepoId,
|
||||||
package::Column::Arch,
|
db::package::Column::Arch,
|
||||||
package::Column::Name,
|
db::package::Column::Name,
|
||||||
])
|
])
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
if committed {
|
if committed {
|
||||||
query.cond_where(package::Column::State.eq(PackageState::Committed));
|
query.cond_where(db::package::Column::State.eq(db::PackageState::Committed));
|
||||||
}
|
}
|
||||||
|
|
||||||
query
|
query
|
||||||
|
@ -287,44 +278,47 @@ 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(package::Column::iter().map(|c| (p1.clone(), c)))
|
.columns(db::package::Column::iter().map(|c| (p1.clone(), c)))
|
||||||
.from_as(package::Entity, p1.clone())
|
.from_as(db::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(), package::Column::Id))
|
Expr::col((p1.clone(), db::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(), package::Column::RepoId)).eq(repo))
|
.add(Expr::col((p1.clone(), db::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(), package::Column::State))
|
Expr::col((p1.clone(), db::package::Column::Arch))
|
||||||
.ne(PackageState::PendingDeletion),
|
.is_in([arch, crate::ANY_ARCH]),
|
||||||
|
)
|
||||||
|
.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);
|
||||||
|
|
||||||
Package::find().from_raw_sql(sql)
|
db::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(package::Entity, p1.clone())
|
.from_as(db::package::Entity, p1.clone())
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
if include_repo {
|
if include_repo {
|
||||||
query.columns([
|
query.columns([
|
||||||
(p1.clone(), package::Column::RepoId),
|
(p1.clone(), db::package::Column::RepoId),
|
||||||
(p1.clone(), package::Column::Id),
|
(p1.clone(), db::package::Column::Id),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
query.column((p1.clone(), package::Column::Id));
|
query.column((p1.clone(), db::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
|
||||||
|
@ -337,27 +331,27 @@ fn stale_pkgs_query(include_repo: bool) -> SelectStatement {
|
||||||
p2.clone(),
|
p2.clone(),
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), package::Column::RepoId))
|
Expr::col((p1.clone(), db::package::Column::RepoId))
|
||||||
.eq(Expr::col((p2.clone(), package::Column::RepoId))),
|
.eq(Expr::col((p2.clone(), db::package::Column::RepoId))),
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), package::Column::Arch))
|
Expr::col((p1.clone(), db::package::Column::Arch))
|
||||||
.eq(Expr::col((p2.clone(), package::Column::Arch))),
|
.eq(Expr::col((p2.clone(), db::package::Column::Arch))),
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), package::Column::Name))
|
Expr::col((p1.clone(), db::package::Column::Name))
|
||||||
.eq(Expr::col((p2.clone(), package::Column::Name))),
|
.eq(Expr::col((p2.clone(), db::package::Column::Name))),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.cond_where(
|
.cond_where(
|
||||||
Condition::any()
|
Condition::any()
|
||||||
.add(
|
.add(
|
||||||
Expr::col((p1.clone(), package::Column::Id))
|
Expr::col((p1.clone(), db::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(), package::Column::State))
|
Expr::col((p1.clone(), db::package::Column::State))
|
||||||
.eq(PackageState::PendingDeletion),
|
.eq(db::PackageState::PendingDeletion),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -373,9 +367,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(Package::delete_many()
|
Ok(db::Package::delete_many()
|
||||||
.filter(package::Column::Id.lte(max_id))
|
.filter(db::package::Column::Id.lte(max_id))
|
||||||
.filter(package::Column::Id.in_subquery(stale_pkgs_query(false)))
|
.filter(db::package::Column::Id.in_subquery(stale_pkgs_query(false)))
|
||||||
.exec(conn)
|
.exec(conn)
|
||||||
.await
|
.await
|
||||||
.map(|_| ())?)
|
.map(|_| ())?)
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
use crate::db::Result;
|
use crate::db::*;
|
||||||
|
|
||||||
use entity::{prelude::Repo, repo};
|
use sea_orm::{sea_query::IntoCondition, *};
|
||||||
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 migration::MigratorTrait;
|
use sea_orm_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(migration::Migrator::up(&db, None))?;
|
rt.block_on(crate::db::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(
|
||||||
entity::Package::find()
|
db::Package::find()
|
||||||
.filter(entity::package::Column::RepoId.eq(repo))
|
.filter(db::package::Column::RepoId.eq(repo))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::package::Column::Arch)
|
.column(db::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(
|
||||||
entity::Package::update_many()
|
db::Package::update_many()
|
||||||
.col_expr(
|
.col_expr(
|
||||||
entity::package::Column::State,
|
db::package::Column::State,
|
||||||
Expr::value(entity::PackageState::Committed),
|
Expr::value(db::PackageState::Committed),
|
||||||
)
|
)
|
||||||
.filter(entity::package::Column::Id.is_in(committed_ids))
|
.filter(db::package::Column::Id.is_in(committed_ids))
|
||||||
.exec(&self.state.conn),
|
.exec(&self.state.conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::db;
|
||||||
use std::{
|
use std::{
|
||||||
io::Write,
|
io::Write,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -68,7 +69,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: &entity::package::Model) -> crate::Result<()> {
|
pub fn append_pkg(&mut self, pkg: &db::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)?;
|
||||||
|
|
||||||
|
@ -84,11 +85,7 @@ 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(
|
fn write_files(&self, path: impl AsRef<Path>, pkg: &db::package::Model) -> crate::Result<()> {
|
||||||
&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%")?;
|
||||||
|
@ -96,7 +93,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(entity::prelude::PackageFile);
|
let query = pkg.find_related(db::PackageFile);
|
||||||
|
|
||||||
self.rt.spawn(async move {
|
self.rt.spawn(async move {
|
||||||
match query.stream(&conn).await {
|
match query.stream(&conn).await {
|
||||||
|
@ -124,11 +121,7 @@ impl RepoArchivesWriter {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_desc(
|
fn write_desc(&self, path: impl AsRef<Path>, pkg: &db::package::Model) -> crate::Result<()> {
|
||||||
&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!(
|
||||||
|
@ -154,9 +147,9 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let groups: Vec<String> = self.rt.block_on(
|
let groups: Vec<String> = self.rt.block_on(
|
||||||
pkg.find_related(entity::prelude::PackageGroup)
|
pkg.find_related(db::PackageGroup)
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::package_group::Column::Name)
|
.column(db::package_group::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
@ -172,9 +165,9 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let licenses: Vec<String> = self.rt.block_on(
|
let licenses: Vec<String> = self.rt.block_on(
|
||||||
pkg.find_related(entity::prelude::PackageLicense)
|
pkg.find_related(db::PackageLicense)
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::package_license::Column::Name)
|
.column(db::package_license::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
@ -193,21 +186,21 @@ impl RepoArchivesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
let related = [
|
let related = [
|
||||||
("REPLACES", entity::PackageRelatedEnum::Replaces),
|
("REPLACES", db::PackageRelatedEnum::Replaces),
|
||||||
("CONFLICTS", entity::PackageRelatedEnum::Conflicts),
|
("CONFLICTS", db::PackageRelatedEnum::Conflicts),
|
||||||
("PROVIDES", entity::PackageRelatedEnum::Provides),
|
("PROVIDES", db::PackageRelatedEnum::Provides),
|
||||||
("DEPENDS", entity::PackageRelatedEnum::Depend),
|
("DEPENDS", db::PackageRelatedEnum::Depend),
|
||||||
("OPTDEPENDS", entity::PackageRelatedEnum::Optdepend),
|
("OPTDEPENDS", db::PackageRelatedEnum::Optdepend),
|
||||||
("MAKEDEPENDS", entity::PackageRelatedEnum::Makedepend),
|
("MAKEDEPENDS", db::PackageRelatedEnum::Makedepend),
|
||||||
("CHECKDEPENDS", entity::PackageRelatedEnum::Checkdepend),
|
("CHECKDEPENDS", db::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(entity::prelude::PackageRelated)
|
pkg.find_related(db::PackageRelated)
|
||||||
.filter(entity::package_related::Column::Type.eq(attr))
|
.filter(db::package_related::Column::Type.eq(attr))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::package_related::Column::Name)
|
.column(db::package_related::Column::Name)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&self.conn),
|
.all(&self.conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use super::{Command, SharedState};
|
use super::{Command, SharedState};
|
||||||
|
use crate::db;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
@ -33,10 +34,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> = entity::Distro::find()
|
let distro_id: Option<i32> = db::Distro::find()
|
||||||
.filter(entity::distro::Column::Name.eq(distro))
|
.filter(db::distro::Column::Name.eq(distro))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::distro::Column::Id)
|
.column(db::distro::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -44,7 +45,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 = entity::distro::ActiveModel {
|
let new_distro = db::distro::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
name: Set(distro.to_string()),
|
name: Set(distro.to_string()),
|
||||||
description: NotSet,
|
description: NotSet,
|
||||||
|
@ -53,11 +54,11 @@ impl Handle {
|
||||||
new_distro.insert(&self.state.conn).await?.id
|
new_distro.insert(&self.state.conn).await?.id
|
||||||
};
|
};
|
||||||
|
|
||||||
let repo_id: Option<i32> = entity::Repo::find()
|
let repo_id: Option<i32> = db::Repo::find()
|
||||||
.filter(entity::repo::Column::DistroId.eq(distro_id))
|
.filter(db::repo::Column::DistroId.eq(distro_id))
|
||||||
.filter(entity::repo::Column::Name.eq(repo))
|
.filter(db::repo::Column::Name.eq(repo))
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::repo::Column::Id)
|
.column(db::repo::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -65,7 +66,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 = entity::repo::ActiveModel {
|
let new_repo = db::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()),
|
||||||
|
@ -83,12 +84,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(entity::Repo::find()
|
Ok(db::Repo::find()
|
||||||
.find_also_related(entity::Distro)
|
.find_also_related(db::Distro)
|
||||||
.filter(
|
.filter(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(entity::repo::Column::Name.eq(repo))
|
.add(db::repo::Column::Name.eq(repo))
|
||||||
.add(entity::distro::Column::Name.eq(distro)),
|
.add(db::distro::Column::Name.eq(distro)),
|
||||||
)
|
)
|
||||||
.one(&self.state.conn)
|
.one(&self.state.conn)
|
||||||
.await
|
.await
|
||||||
|
@ -97,9 +98,7 @@ 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);
|
||||||
entity::Repo::delete_by_id(repo)
|
db::Repo::delete_by_id(repo).exec(&self.state.conn).await?;
|
||||||
.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(())
|
||||||
|
@ -109,15 +108,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<()> {
|
||||||
entity::Package::update_many()
|
db::Package::update_many()
|
||||||
.col_expr(
|
.col_expr(
|
||||||
entity::package::Column::State,
|
db::package::Column::State,
|
||||||
Expr::value(entity::PackageState::PendingDeletion),
|
Expr::value(db::PackageState::PendingDeletion),
|
||||||
)
|
)
|
||||||
.filter(
|
.filter(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(entity::package::Column::RepoId.eq(repo))
|
.add(db::package::Column::RepoId.eq(repo))
|
||||||
.add(entity::package::Column::Arch.eq(arch)),
|
.add(db::package::Column::Arch.eq(arch)),
|
||||||
)
|
)
|
||||||
.exec(&self.state.conn)
|
.exec(&self.state.conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -6,6 +6,8 @@ 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},
|
||||||
|
@ -65,9 +67,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(
|
||||||
entity::prelude::Repo::find()
|
db::Repo::find()
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(entity::repo::Column::Id)
|
.column(db::repo::Column::Id)
|
||||||
.into_tuple()
|
.into_tuple()
|
||||||
.all(&conn),
|
.all(&conn),
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use crate::db::entities::package;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt, fs,
|
fmt, fs,
|
||||||
io::{self, BufRead, BufReader, Read},
|
io::{self, BufRead, BufReader, Read},
|
||||||
|
@ -9,6 +11,7 @@ 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 {
|
||||||
|
@ -191,3 +194,26 @@ 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<entity::repo::Model>>> {
|
) -> crate::Result<Json<PaginatedResponse<db::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<entity::repo::Model>> {
|
) -> crate::Result<Json<db::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<entity::package::Model>>> {
|
) -> crate::Result<Json<PaginatedResponse<db::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