From bf1717440176fd57404176d4f5b9db3c7024a086 Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 6 Dec 2021 21:29:21 +0100 Subject: [PATCH] Update api and bromine version Signed-off-by: trivernis --- mediarepo-daemon/Cargo.lock | 74 ++--- mediarepo-daemon/mediarepo-core/Cargo.lock | 276 +++++++++++------ mediarepo-daemon/mediarepo-core/Cargo.toml | 5 +- mediarepo-daemon/mediarepo-core/src/error.rs | 9 +- mediarepo-daemon/mediarepo-core/src/lib.rs | 3 +- .../mediarepo-database/Cargo.lock | 279 ++++++++++------- mediarepo-daemon/mediarepo-model/Cargo.lock | 283 +++++++++++------- mediarepo-daemon/mediarepo-socket/Cargo.lock | 74 ++--- mediarepo-daemon/mediarepo-socket/Cargo.toml | 6 +- .../mediarepo-socket/src/from_model.rs | 6 +- mediarepo-daemon/mediarepo-socket/src/lib.rs | 10 +- .../mediarepo-socket/src/namespaces/files.rs | 115 +++---- .../mediarepo-socket/src/namespaces/mod.rs | 4 +- .../mediarepo-socket/src/namespaces/tags.rs | 52 ++-- .../mediarepo-socket/src/utils.rs | 7 +- 15 files changed, 669 insertions(+), 534 deletions(-) diff --git a/mediarepo-daemon/Cargo.lock b/mediarepo-daemon/Cargo.lock index e544f13..c94bd88 100644 --- a/mediarepo-daemon/Cargo.lock +++ b/mediarepo-daemon/Cargo.lock @@ -156,6 +156,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.54.0" @@ -233,6 +242,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bromine" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913d14c7bfcf3b8ea8a6fc9fc2217dc734a9557c54ebe2dd4a3cc8e769ffffc4" +dependencies = [ + "async-trait", + "bincode", + "byteorder", + "futures 0.3.17", + "lazy_static", + "serde", + "thiserror", + "tokio", + "tracing", + "typemap_rev", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -936,9 +963,10 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "mediarepo-api" -version = "0.12.0" -source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=16b892eab0b3446198601a8f5829d0bd54d2efdf#16b892eab0b3446198601a8f5829d0bd54d2efdf" +version = "0.13.0" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d64787c36e6cf68567db1c480860cd95b7c20e3f#d64787c36e6cf68567db1c480860cd95b7c20e3f" dependencies = [ + "bromine", "chrono", "serde", "serde_piecewise_default", @@ -954,9 +982,9 @@ dependencies = [ "futures 0.3.17", "glob", "itertools", + "mediarepo-api", "multibase", "multihash", - "rmp-ipc", "sea-orm", "serde", "sqlx", @@ -1020,7 +1048,6 @@ version = "0.1.0" dependencies = [ "chrono", "compare", - "mediarepo-api", "mediarepo-core", "mediarepo-database", "mediarepo-model", @@ -1644,45 +1671,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rmp" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "rmp-ipc" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573eb3e2e1008f550b7b5a53053d5ed8378fbda57731fa3739c3cfb18ad667f6" -dependencies = [ - "async-trait", - "byteorder", - "futures 0.3.17", - "lazy_static", - "rmp-serde", - "serde", - "thiserror", - "tokio", - "tracing", - "typemap_rev", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rust_decimal" version = "1.17.0" diff --git a/mediarepo-daemon/mediarepo-core/Cargo.lock b/mediarepo-daemon/mediarepo-core/Cargo.lock index b019685..5a627b7 100644 --- a/mediarepo-daemon/mediarepo-core/Cargo.lock +++ b/mediarepo-daemon/mediarepo-core/Cargo.lock @@ -71,9 +71,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -82,9 +82,9 @@ version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -114,6 +114,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.54.0" @@ -127,8 +136,8 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "regex", "rustc-hash", "shlex", @@ -191,6 +200,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bromine" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913d14c7bfcf3b8ea8a6fc9fc2217dc734a9557c54ebe2dd4a3cc8e769ffffc4" +dependencies = [ + "async-trait", + "bincode", + "byteorder", + "futures", + "lazy_static", + "serde", + "thiserror", + "tokio", + "tracing", + "typemap_rev", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -245,6 +272,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time", + "winapi", +] + [[package]] name = "clang-sys" version = "0.29.3" @@ -378,7 +419,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", - "syn", + "syn 1.0.81", ] [[package]] @@ -514,9 +555,9 @@ checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -789,6 +830,19 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "mediarepo-api" +version = "0.13.0" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d64787c36e6cf68567db1c480860cd95b7c20e3f#d64787c36e6cf68567db1c480860cd95b7c20e3f" +dependencies = [ + "bromine", + "chrono", + "serde", + "serde_piecewise_default", + "thiserror", + "tracing", +] + [[package]] name = "mediarepo-core" version = "0.1.0" @@ -797,9 +851,9 @@ dependencies = [ "futures", "glob", "itertools", + "mediarepo-api", "multibase", "multihash", - "rmp-ipc", "sea-orm", "serde", "sqlx", @@ -914,9 +968,9 @@ checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ "proc-macro-crate", "proc-macro-error", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "synstructure", ] @@ -1032,9 +1086,9 @@ checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1127,9 +1181,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "version_check", ] @@ -1139,8 +1193,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "version_check", ] @@ -1156,13 +1210,31 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.2", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", ] [[package]] @@ -1171,7 +1243,7 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.32", ] [[package]] @@ -1272,45 +1344,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rmp" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "rmp-ipc" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573eb3e2e1008f550b7b5a53053d5ed8378fbda57731fa3739c3cfb18ad667f6" -dependencies = [ - "async-trait", - "byteorder", - "futures", - "lazy_static", - "rmp-serde", - "serde", - "thiserror", - "tokio", - "tracing", - "typemap_rev", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rustc-hash" version = "1.1.0" @@ -1362,9 +1395,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cdc022b4f606353fe5dc85b09713a04e433323b70163e81513b141c6ae6eb5" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "thiserror", ] @@ -1384,9 +1417,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51c247af6c2c4ffd372fe97e9afa579b4438e4c306c9aa3f11cbf72f1e845180" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1404,9 +1437,31 @@ version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "serde_piecewise_default" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91a44b0f51aedd237f8f25c831e1f629982a187a5045c08ce4bccccce17b4b0" +dependencies = [ + "serde", + "serde_piecewise_default_derive", +] + +[[package]] +name = "serde_piecewise_default_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19446953e7b22342c23c79ede938c04b1c12f4eb7513db30cda94193ce30ff2a" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "serde", + "syn 0.15.44", ] [[package]] @@ -1523,12 +1578,12 @@ dependencies = [ "either", "heck", "once_cell", - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "sha2", "sqlx-core", "sqlx-rt", - "syn", + "syn 1.0.81", "url", ] @@ -1554,15 +1609,26 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "unicode-xid 0.2.2", ] [[package]] @@ -1571,10 +1637,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", + "unicode-xid 0.2.2", ] [[package]] @@ -1606,9 +1672,9 @@ version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1636,6 +1702,16 @@ dependencies = [ "weezl", ] +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "tinyvec" version = "1.5.1" @@ -1693,9 +1769,9 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1740,6 +1816,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -1807,9 +1889,9 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-shared", ] @@ -1819,7 +1901,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote", + "quote 1.0.10", "wasm-bindgen-macro-support", ] @@ -1829,9 +1911,9 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/mediarepo-daemon/mediarepo-core/Cargo.toml b/mediarepo-daemon/mediarepo-core/Cargo.toml index ba948dc..93fcdb6 100644 --- a/mediarepo-daemon/mediarepo-core/Cargo.toml +++ b/mediarepo-daemon/mediarepo-core/Cargo.toml @@ -12,7 +12,6 @@ multibase = "0.9.1" base64 = "0.13.0" toml = "0.5.8" serde = "1.0.130" -rmp-ipc = "0.11.0" typemap_rev = "0.1.5" futures = "0.3.17" itertools = "0.10.1" @@ -35,6 +34,10 @@ features = ["migrate"] version = "1.12.0" features = ["fs", "io-util", "io-std"] +[dependencies.mediarepo-api] +git = "https://github.com/Trivernis/mediarepo-api.git" +rev = "d64787c36e6cf68567db1c480860cd95b7c20e3f" +features = ["bromine"] [features] default = [] diff --git a/mediarepo-daemon/mediarepo-core/src/error.rs b/mediarepo-daemon/mediarepo-core/src/error.rs index 025310d..5935f7b 100644 --- a/mediarepo-daemon/mediarepo-core/src/error.rs +++ b/mediarepo-daemon/mediarepo-core/src/error.rs @@ -1,4 +1,3 @@ -use rmp_ipc::error::Error; use sea_orm::DbErr; use std::fmt::{Display, Formatter}; use thiserror::Error; @@ -24,7 +23,7 @@ pub enum RepoError { TomlSer(#[from] toml::ser::Error), #[error(transparent)] - IPC(#[from] rmp_ipc::error::Error), + IPC(#[from] mediarepo_api::bromine::error::Error), #[error(transparent)] Raw(StringError), @@ -77,8 +76,8 @@ impl From<&str> for RepoError { } } -impl From for rmp_ipc::error::Error { - fn from(e: RepoError) -> Error { - rmp_ipc::error::Error::Message(format!("{:?}", e)) +impl From for mediarepo_api::bromine::error::Error { + fn from(e: RepoError) -> mediarepo_api::bromine::error::Error { + mediarepo_api::bromine::error::Error::Message(format!("{:?}", e)) } } diff --git a/mediarepo-daemon/mediarepo-core/src/lib.rs b/mediarepo-daemon/mediarepo-core/src/lib.rs index 31b9697..1f96274 100644 --- a/mediarepo-daemon/mediarepo-core/src/lib.rs +++ b/mediarepo-daemon/mediarepo-core/src/lib.rs @@ -1,6 +1,7 @@ pub use futures; pub use itertools; -pub use rmp_ipc; +pub use mediarepo_api; +pub use mediarepo_api::bromine; pub use thumbnailer; pub mod context; diff --git a/mediarepo-daemon/mediarepo-database/Cargo.lock b/mediarepo-daemon/mediarepo-database/Cargo.lock index 7cc04e9..bcb1c99 100644 --- a/mediarepo-daemon/mediarepo-database/Cargo.lock +++ b/mediarepo-daemon/mediarepo-database/Cargo.lock @@ -71,9 +71,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -82,9 +82,9 @@ version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -110,9 +110,9 @@ checksum = "ec107f431ee3d8a8e45e6dd117adab769556ef463959e77bf6a4888d5fd500cf" dependencies = [ "heck", "proc-macro-error 0.4.12", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -127,6 +127,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -184,6 +193,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bromine" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913d14c7bfcf3b8ea8a6fc9fc2217dc734a9557c54ebe2dd4a3cc8e769ffffc4" +dependencies = [ + "async-trait", + "bincode", + "byteorder", + "futures", + "lazy_static", + "serde", + "thiserror", + "tokio", + "tracing", + "typemap_rev", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -232,6 +259,7 @@ dependencies = [ "libc", "num-integer", "num-traits", + "serde", "time", "winapi", ] @@ -374,7 +402,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", - "syn", + "syn 1.0.81", ] [[package]] @@ -500,9 +528,9 @@ checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -770,6 +798,19 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "mediarepo-api" +version = "0.13.0" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d64787c36e6cf68567db1c480860cd95b7c20e3f#d64787c36e6cf68567db1c480860cd95b7c20e3f" +dependencies = [ + "bromine", + "chrono", + "serde", + "serde_piecewise_default", + "thiserror", + "tracing", +] + [[package]] name = "mediarepo-core" version = "0.1.0" @@ -778,9 +819,9 @@ dependencies = [ "futures", "glob", "itertools", + "mediarepo-api", "multibase", "multihash", - "rmp-ipc", "sea-orm", "serde", "sqlx", @@ -906,9 +947,9 @@ checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ "proc-macro-crate", "proc-macro-error 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "synstructure", ] @@ -1076,9 +1117,9 @@ checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714" dependencies = [ "Inflector", "proc-macro-error 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1165,9 +1206,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" dependencies = [ "proc-macro-error-attr 0.4.12", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "version_check", ] @@ -1178,9 +1219,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "version_check", ] @@ -1190,9 +1231,9 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "syn-mid", "version_check", ] @@ -1203,8 +1244,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "version_check", ] @@ -1220,13 +1261,31 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.2", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", ] [[package]] @@ -1235,7 +1294,7 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.32", ] [[package]] @@ -1321,45 +1380,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rmp" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "rmp-ipc" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573eb3e2e1008f550b7b5a53053d5ed8378fbda57731fa3739c3cfb18ad667f6" -dependencies = [ - "async-trait", - "byteorder", - "futures", - "lazy_static", - "rmp-serde", - "serde", - "thiserror", - "tokio", - "tracing", - "typemap_rev", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rust_decimal" version = "1.17.0" @@ -1430,9 +1450,9 @@ checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c" dependencies = [ "bae", "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1455,9 +1475,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cdc022b4f606353fe5dc85b09713a04e433323b70163e81513b141c6ae6eb5" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "thiserror", ] @@ -1477,9 +1497,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51c247af6c2c4ffd372fe97e9afa579b4438e4c306c9aa3f11cbf72f1e845180" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1520,9 +1540,9 @@ version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1537,6 +1557,28 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_piecewise_default" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91a44b0f51aedd237f8f25c831e1f629982a187a5045c08ce4bccccce17b4b0" +dependencies = [ + "serde", + "serde_piecewise_default_derive", +] + +[[package]] +name = "serde_piecewise_default_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19446953e7b22342c23c79ede938c04b1c12f4eb7513db30cda94193ce30ff2a" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "serde", + "syn 0.15.44", +] + [[package]] name = "sha2" version = "0.9.8" @@ -1653,13 +1695,13 @@ dependencies = [ "either", "heck", "once_cell", - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "serde_json", "sha2", "sqlx-core", "sqlx-rt", - "syn", + "syn 1.0.81", "url", ] @@ -1691,15 +1733,26 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "unicode-xid 0.2.2", ] [[package]] @@ -1708,9 +1761,9 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1719,10 +1772,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", + "unicode-xid 0.2.2", ] [[package]] @@ -1754,9 +1807,9 @@ version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1873,9 +1926,9 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1920,6 +1973,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -1997,9 +2056,9 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-shared", ] @@ -2009,7 +2068,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote", + "quote 1.0.10", "wasm-bindgen-macro-support", ] @@ -2019,9 +2078,9 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/mediarepo-daemon/mediarepo-model/Cargo.lock b/mediarepo-daemon/mediarepo-model/Cargo.lock index c3e7af5..dc351d8 100644 --- a/mediarepo-daemon/mediarepo-model/Cargo.lock +++ b/mediarepo-daemon/mediarepo-model/Cargo.lock @@ -71,9 +71,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -82,9 +82,9 @@ version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -110,9 +110,9 @@ checksum = "ec107f431ee3d8a8e45e6dd117adab769556ef463959e77bf6a4888d5fd500cf" dependencies = [ "heck", "proc-macro-error 0.4.12", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -127,6 +127,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.54.0" @@ -140,8 +149,8 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "regex", "rustc-hash", "shlex", @@ -204,6 +213,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bromine" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913d14c7bfcf3b8ea8a6fc9fc2217dc734a9557c54ebe2dd4a3cc8e769ffffc4" +dependencies = [ + "async-trait", + "bincode", + "byteorder", + "futures", + "lazy_static", + "serde", + "thiserror", + "tokio", + "tracing", + "typemap_rev", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -267,6 +294,7 @@ dependencies = [ "libc", "num-integer", "num-traits", + "serde", "time", "winapi", ] @@ -420,7 +448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", - "syn", + "syn 1.0.81", ] [[package]] @@ -571,9 +599,9 @@ checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -857,6 +885,19 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "mediarepo-api" +version = "0.13.0" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d64787c36e6cf68567db1c480860cd95b7c20e3f#d64787c36e6cf68567db1c480860cd95b7c20e3f" +dependencies = [ + "bromine", + "chrono", + "serde", + "serde_piecewise_default", + "thiserror", + "tracing", +] + [[package]] name = "mediarepo-core" version = "0.1.0" @@ -865,9 +906,9 @@ dependencies = [ "futures", "glob", "itertools", + "mediarepo-api", "multibase", "multihash", - "rmp-ipc", "sea-orm", "serde", "sqlx", @@ -1020,9 +1061,9 @@ checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ "proc-macro-crate", "proc-macro-error 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "synstructure", ] @@ -1200,9 +1241,9 @@ checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714" dependencies = [ "Inflector", "proc-macro-error 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1295,9 +1336,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" dependencies = [ "proc-macro-error-attr 0.4.12", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "version_check", ] @@ -1308,9 +1349,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr 1.0.4", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "version_check", ] @@ -1320,9 +1361,9 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "syn-mid", "version_check", ] @@ -1333,8 +1374,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "version_check", ] @@ -1350,13 +1391,31 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.2", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", ] [[package]] @@ -1365,7 +1424,7 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.32", ] [[package]] @@ -1466,45 +1525,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rmp" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "rmp-ipc" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573eb3e2e1008f550b7b5a53053d5ed8378fbda57731fa3739c3cfb18ad667f6" -dependencies = [ - "async-trait", - "byteorder", - "futures", - "lazy_static", - "rmp-serde", - "serde", - "thiserror", - "tokio", - "tracing", - "typemap_rev", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rust_decimal" version = "1.17.0" @@ -1581,9 +1601,9 @@ checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c" dependencies = [ "bae", "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1606,9 +1626,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cdc022b4f606353fe5dc85b09713a04e433323b70163e81513b141c6ae6eb5" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "thiserror", ] @@ -1628,9 +1648,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51c247af6c2c4ffd372fe97e9afa579b4438e4c306c9aa3f11cbf72f1e845180" dependencies = [ "heck", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1671,9 +1691,9 @@ version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1688,6 +1708,28 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_piecewise_default" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91a44b0f51aedd237f8f25c831e1f629982a187a5045c08ce4bccccce17b4b0" +dependencies = [ + "serde", + "serde_piecewise_default_derive", +] + +[[package]] +name = "serde_piecewise_default_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19446953e7b22342c23c79ede938c04b1c12f4eb7513db30cda94193ce30ff2a" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "serde", + "syn 0.15.44", +] + [[package]] name = "sha2" version = "0.9.8" @@ -1810,13 +1852,13 @@ dependencies = [ "either", "heck", "once_cell", - "proc-macro2", - "quote", + "proc-macro2 1.0.32", + "quote 1.0.10", "serde_json", "sha2", "sqlx-core", "sqlx-rt", - "syn", + "syn 1.0.81", "url", ] @@ -1848,15 +1890,26 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "unicode-xid 0.2.2", ] [[package]] @@ -1865,9 +1918,9 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -1876,10 +1929,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", + "unicode-xid 0.2.2", ] [[package]] @@ -1911,9 +1964,9 @@ version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -2031,9 +2084,9 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", ] [[package]] @@ -2087,6 +2140,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -2164,9 +2223,9 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-shared", ] @@ -2176,7 +2235,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote", + "quote 1.0.10", "wasm-bindgen-macro-support", ] @@ -2186,9 +2245,9 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/mediarepo-daemon/mediarepo-socket/Cargo.lock b/mediarepo-daemon/mediarepo-socket/Cargo.lock index f3b8910..53bb6d1 100644 --- a/mediarepo-daemon/mediarepo-socket/Cargo.lock +++ b/mediarepo-daemon/mediarepo-socket/Cargo.lock @@ -127,6 +127,15 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -184,6 +193,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bromine" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913d14c7bfcf3b8ea8a6fc9fc2217dc734a9557c54ebe2dd4a3cc8e769ffffc4" +dependencies = [ + "async-trait", + "bincode", + "byteorder", + "futures 0.3.17", + "lazy_static", + "serde", + "thiserror", + "tokio", + "tracing", + "typemap_rev", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -802,9 +829,10 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "mediarepo-api" -version = "0.12.0" -source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=16b892eab0b3446198601a8f5829d0bd54d2efdf#16b892eab0b3446198601a8f5829d0bd54d2efdf" +version = "0.13.0" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d64787c36e6cf68567db1c480860cd95b7c20e3f#d64787c36e6cf68567db1c480860cd95b7c20e3f" dependencies = [ + "bromine", "chrono", "serde", "serde_piecewise_default", @@ -820,9 +848,9 @@ dependencies = [ "futures 0.3.17", "glob", "itertools", + "mediarepo-api", "multibase", "multihash", - "rmp-ipc", "sea-orm", "serde", "sqlx", @@ -867,7 +895,6 @@ version = "0.1.0" dependencies = [ "chrono", "compare", - "mediarepo-api", "mediarepo-core", "mediarepo-database", "mediarepo-model", @@ -1451,45 +1478,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rmp" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" -dependencies = [ - "byteorder", - "num-traits", -] - -[[package]] -name = "rmp-ipc" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573eb3e2e1008f550b7b5a53053d5ed8378fbda57731fa3739c3cfb18ad667f6" -dependencies = [ - "async-trait", - "byteorder", - "futures 0.3.17", - "lazy_static", - "rmp-serde", - "serde", - "thiserror", - "tokio", - "tracing", - "typemap_rev", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rust_decimal" version = "1.17.0" diff --git a/mediarepo-daemon/mediarepo-socket/Cargo.toml b/mediarepo-daemon/mediarepo-socket/Cargo.toml index d4d2fd3..c5f025c 100644 --- a/mediarepo-daemon/mediarepo-socket/Cargo.toml +++ b/mediarepo-daemon/mediarepo-socket/Cargo.toml @@ -30,8 +30,4 @@ features = ["serde"] [dependencies.tracing-futures] version = "0.2.5" -features = ["tokio-executor"] - -[dependencies.mediarepo-api] -git = "https://github.com/Trivernis/mediarepo-api.git" -rev = "16b892eab0b3446198601a8f5829d0bd54d2efdf" \ No newline at end of file +features = ["tokio-executor"] \ No newline at end of file diff --git a/mediarepo-daemon/mediarepo-socket/src/from_model.rs b/mediarepo-daemon/mediarepo-socket/src/from_model.rs index fab629d..886ae95 100644 --- a/mediarepo-daemon/mediarepo-socket/src/from_model.rs +++ b/mediarepo-daemon/mediarepo-socket/src/from_model.rs @@ -1,5 +1,7 @@ -use mediarepo_api::types::files::{FileMetadataResponse, ThumbnailMetadataResponse}; -use mediarepo_api::types::tags::TagResponse; +use mediarepo_core::mediarepo_api::types::files::{ + FileMetadataResponse, ThumbnailMetadataResponse, +}; +use mediarepo_core::mediarepo_api::types::tags::TagResponse; use mediarepo_model::file::File; use mediarepo_model::tag::Tag; use mediarepo_model::thumbnail::Thumbnail; diff --git a/mediarepo-daemon/mediarepo-socket/src/lib.rs b/mediarepo-daemon/mediarepo-socket/src/lib.rs index c49c0fc..4de2264 100644 --- a/mediarepo-daemon/mediarepo-socket/src/lib.rs +++ b/mediarepo-daemon/mediarepo-socket/src/lib.rs @@ -1,6 +1,6 @@ -use mediarepo_api::types::misc::InfoResponse; +use mediarepo_core::bromine::prelude::*; use mediarepo_core::error::{RepoError, RepoResult}; -use mediarepo_core::rmp_ipc::prelude::*; +use mediarepo_core::mediarepo_api::types::misc::InfoResponse; use mediarepo_core::settings::Settings; use mediarepo_core::type_keys::SettingsKey; use mediarepo_model::repo::Repo; @@ -68,14 +68,12 @@ fn get_builder(address: L::AddressType) -> IPCBu } #[tracing::instrument(skip_all)] -async fn info(ctx: &Context, event: Event) -> IPCResult<()> { +async fn info(ctx: &Context, _: Event) -> IPCResult<()> { let response = InfoResponse::new( env!("CARGO_PKG_NAME").to_string(), env!("CARGO_PKG_VERSION").to_string(), ); - ctx.emitter - .emit_response(event.id(), "info", response) - .await?; + ctx.emit("info", response).await?; Ok(()) } diff --git a/mediarepo-daemon/mediarepo-socket/src/namespaces/files.rs b/mediarepo-daemon/mediarepo-socket/src/namespaces/files.rs index 2bd0835..2cec74f 100644 --- a/mediarepo-daemon/mediarepo-socket/src/namespaces/files.rs +++ b/mediarepo-daemon/mediarepo-socket/src/namespaces/files.rs @@ -2,15 +2,15 @@ use crate::from_model::FromModel; use crate::utils::{file_by_identifier, get_repo_from_context, hash_by_identifier}; use chrono::NaiveDateTime; use compare::Compare; -use mediarepo_api::types::files::{ +use mediarepo_core::bromine::prelude::*; +use mediarepo_core::fs::thumbnail_store::Dimensions; +use mediarepo_core::itertools::Itertools; +use mediarepo_core::mediarepo_api::types::files::{ AddFileRequestHeader, FileMetadataResponse, FilterExpression, FindFilesRequest, GetFileThumbnailOfSizeRequest, GetFileThumbnailsRequest, ReadFileRequest, SortDirection, SortKey, ThumbnailMetadataResponse, UpdateFileNameRequest, }; -use mediarepo_api::types::identifier::FileIdentifier; -use mediarepo_core::fs::thumbnail_store::Dimensions; -use mediarepo_core::itertools::Itertools; -use mediarepo_core::rmp_ipc::prelude::*; +use mediarepo_core::mediarepo_api::types::identifier::FileIdentifier; use mediarepo_core::thumbnailer::ThumbnailSize; use mediarepo_core::utils::parse_namespace_and_tag; use mediarepo_database::queries::tags::{ @@ -37,7 +37,7 @@ impl NamespaceProvider for FilesNamespace { "files" } - fn register(handler: &mut EventHandler) { + fn register(handler: &mut EventHandler) { events!(handler, "all_files" => Self::all_files, "get_file" => Self::get_file, @@ -55,7 +55,7 @@ impl NamespaceProvider for FilesNamespace { impl FilesNamespace { /// Returns a list of all files #[tracing::instrument(skip_all)] - async fn all_files(ctx: &Context, event: Event) -> IPCResult<()> { + async fn all_files(ctx: &Context, _event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; let files = repo.files().await?; @@ -64,31 +64,27 @@ impl FilesNamespace { .map(FileMetadataResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "all_files", responses) - .await?; + ctx.emit_to(Self::name(), "all_files", responses).await?; Ok(()) } /// Returns a file by id #[tracing::instrument(skip_all)] - async fn get_file(ctx: &Context, event: Event) -> IPCResult<()> { - let id = event.data::()?; + async fn get_file(ctx: &Context, event: Event) -> IPCResult<()> { + let id = event.payload::()?; let repo = get_repo_from_context(ctx).await; let file = file_by_identifier(id, &repo).await?; let response = FileMetadataResponse::from_model(file); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "get_file", response) - .await?; + ctx.emit_to(Self::name(), "get_file", response).await?; Ok(()) } /// Searches for files by tags #[tracing::instrument(skip_all)] - async fn find_files(ctx: &Context, event: Event) -> IPCResult<()> { - let req = event.data::()?; + async fn find_files(ctx: &Context, event: Event) -> IPCResult<()> { + let req = event.payload::()?; let repo = get_repo_from_context(ctx).await; let tags = req @@ -143,17 +139,15 @@ impl FilesNamespace { .into_iter() .map(FileMetadataResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "find_files", responses) - .await?; + ctx.emit_to(Self::name(), "find_files", responses).await?; Ok(()) } /// Adds a file to the repository #[tracing::instrument(skip_all)] - async fn add_file(ctx: &Context, event: Event) -> IPCResult<()> { + async fn add_file(ctx: &Context, event: Event) -> IPCResult<()> { let (request, bytes) = event - .data::>()? + .payload::>()? .into_inner(); let AddFileRequestHeader { metadata, tags } = request; let repo = get_repo_from_context(ctx).await; @@ -174,22 +168,20 @@ impl FilesNamespace { let tag_ids: Vec = tags.into_iter().map(|t| t.id()).unique().collect(); file.add_tags(tag_ids).await?; - ctx.emitter - .emit_response_to( - event.id(), - Self::name(), - "add_file", - FileMetadataResponse::from_model(file), - ) - .await?; + ctx.emit_to( + Self::name(), + "add_file", + FileMetadataResponse::from_model(file), + ) + .await?; Ok(()) } /// Reads the binary contents of a file #[tracing::instrument(skip_all)] - async fn read_file(ctx: &Context, event: Event) -> IPCResult<()> { - let request = event.data::()?; + async fn read_file(ctx: &Context, event: Event) -> IPCResult<()> { + let request = event.payload::()?; let repo = get_repo_from_context(ctx).await; let file = file_by_identifier(request.id, &repo).await?; @@ -197,8 +189,7 @@ impl FilesNamespace { let mut buf = Vec::new(); reader.read_to_end(&mut buf).await?; - ctx.emitter - .emit_response_to(event.id(), Self::name(), "read_file", BytePayload::new(buf)) + ctx.emit_to(Self::name(), "read_file", BytePayload::new(buf)) .await?; Ok(()) @@ -206,8 +197,8 @@ impl FilesNamespace { /// Returns a list of available thumbnails of a file #[tracing::instrument(skip_all)] - async fn thumbnails(ctx: &Context, event: Event) -> IPCResult<()> { - let request = event.data::()?; + async fn thumbnails(ctx: &Context, event: Event) -> IPCResult<()> { + let request = event.payload::()?; let repo = get_repo_from_context(ctx).await; let file_hash = hash_by_identifier(request.id.clone(), &repo).await?; let mut thumbnails = repo.get_file_thumbnails(file_hash).await?; @@ -223,8 +214,7 @@ impl FilesNamespace { .into_iter() .map(ThumbnailMetadataResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "get_thumbnails", thumb_responses) + ctx.emit_to(Self::name(), "get_thumbnails", thumb_responses) .await?; Ok(()) @@ -232,11 +222,8 @@ impl FilesNamespace { /// Returns a thumbnail that is within the range of the requested sizes #[tracing::instrument(skip_all)] - async fn get_thumbnail_of_size( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { - let request = event.data::()?; + async fn get_thumbnail_of_size(ctx: &Context, event: Event) -> IPCResult<()> { + let request = event.payload::()?; let repo = get_repo_from_context(ctx).await; let file_hash = hash_by_identifier(request.id.clone(), &repo).await?; let thumbnails = repo.get_file_thumbnails(file_hash).await?; @@ -267,48 +254,38 @@ impl FilesNamespace { thumbnail.get_reader().await?.read_to_end(&mut buf).await?; let byte_payload = BytePayload::new(buf); let thumb_payload = ThumbnailMetadataResponse::from_model(thumbnail); - ctx.emitter - .emit_response_to( - event.id(), - Self::name(), - "get_thumbnail_of_size", - TandemPayload::new(thumb_payload, byte_payload), - ) - .await?; + ctx.emit_to( + Self::name(), + "get_thumbnail_of_size", + TandemPayload::new(thumb_payload, byte_payload), + ) + .await?; Ok(()) } /// Updates the name of a file #[tracing::instrument(skip_all)] - async fn update_file_name( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { + async fn update_file_name(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let request = event.data::()?; + let request = event.payload::()?; let mut file = file_by_identifier(request.file_id, &repo).await?; file.set_name(request.name).await?; - ctx.emitter - .emit_response_to( - event.id(), - Self::name(), - "update_file_name", - FileMetadataResponse::from_model(file), - ) - .await?; + ctx.emit_to( + Self::name(), + "update_file_name", + FileMetadataResponse::from_model(file), + ) + .await?; Ok(()) } /// Deletes all thumbnails of a file #[tracing::instrument(skip_all)] - async fn delete_thumbnails( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { + async fn delete_thumbnails(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let id = event.data::()?; + let id = event.payload::()?; let file = file_by_identifier(id, &repo).await?; let thumbnails = repo.get_file_thumbnails(file.hash().to_owned()).await?; diff --git a/mediarepo-daemon/mediarepo-socket/src/namespaces/mod.rs b/mediarepo-daemon/mediarepo-socket/src/namespaces/mod.rs index 5767e91..32512fb 100644 --- a/mediarepo-daemon/mediarepo-socket/src/namespaces/mod.rs +++ b/mediarepo-daemon/mediarepo-socket/src/namespaces/mod.rs @@ -1,5 +1,5 @@ -use mediarepo_core::rmp_ipc::prelude::AsyncStreamProtocolListener; -use mediarepo_core::rmp_ipc::{namespace, namespace::Namespace, IPCBuilder}; +use mediarepo_core::bromine::prelude::AsyncStreamProtocolListener; +use mediarepo_core::bromine::{namespace, namespace::Namespace, IPCBuilder}; pub mod files; pub mod tags; diff --git a/mediarepo-daemon/mediarepo-socket/src/namespaces/tags.rs b/mediarepo-daemon/mediarepo-socket/src/namespaces/tags.rs index b47ea7e..bf7a26e 100644 --- a/mediarepo-daemon/mediarepo-socket/src/namespaces/tags.rs +++ b/mediarepo-daemon/mediarepo-socket/src/namespaces/tags.rs @@ -1,8 +1,8 @@ use crate::from_model::FromModel; use crate::utils::{file_by_identifier, get_repo_from_context}; -use mediarepo_api::types::files::{GetFileTagsRequest, GetFilesTagsRequest}; -use mediarepo_api::types::tags::{ChangeFileTagsRequest, TagResponse}; -use mediarepo_core::rmp_ipc::prelude::*; +use mediarepo_core::bromine::prelude::*; +use mediarepo_core::mediarepo_api::types::files::{GetFileTagsRequest, GetFilesTagsRequest}; +use mediarepo_core::mediarepo_api::types::tags::{ChangeFileTagsRequest, TagResponse}; pub struct TagsNamespace; @@ -11,7 +11,7 @@ impl NamespaceProvider for TagsNamespace { "tags" } - fn register(handler: &mut EventHandler) { + fn register(handler: &mut EventHandler) { events!(handler, "all_tags" => Self::all_tags, "tags_for_file" => Self::tags_for_file, @@ -25,7 +25,7 @@ impl NamespaceProvider for TagsNamespace { impl TagsNamespace { /// Returns a list of all tags in the database #[tracing::instrument(skip_all)] - async fn all_tags(ctx: &Context, event: Event) -> IPCResult<()> { + async fn all_tags(ctx: &Context, _event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; let tags: Vec = repo .tags() @@ -33,27 +33,21 @@ impl TagsNamespace { .into_iter() .map(TagResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "all_tags", tags) - .await?; + ctx.emit_to(Self::name(), "all_tags", tags).await?; Ok(()) } /// Returns all tags for a single file #[tracing::instrument(skip_all)] - async fn tags_for_file( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { + async fn tags_for_file(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let request = event.data::()?; + let request = event.payload::()?; let file = file_by_identifier(request.id, &repo).await?; let tags = file.tags().await?; let responses: Vec = tags.into_iter().map(TagResponse::from_model).collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "tags_for_file", responses) + ctx.emit_to(Self::name(), "tags_for_file", responses) .await?; Ok(()) @@ -61,20 +55,16 @@ impl TagsNamespace { /// Returns all tags for a given list of file hashes #[tracing::instrument(skip_all)] - async fn tags_for_files( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { + async fn tags_for_files(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let request = event.data::()?; + let request = event.payload::()?; let tag_responses: Vec = repo .find_tags_for_hashes(request.hashes) .await? .into_iter() .map(TagResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "tags_for_files", tag_responses) + ctx.emit_to(Self::name(), "tags_for_files", tag_responses) .await?; Ok(()) @@ -82,9 +72,9 @@ impl TagsNamespace { /// Creates all tags given as input or returns the existing tag #[tracing::instrument(skip_all)] - async fn create_tags(ctx: &Context, event: Event) -> IPCResult<()> { + async fn create_tags(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let tags = event.data::>()?; + let tags = event.payload::>()?; let mut created_tags = Vec::new(); for tag in tags { @@ -95,9 +85,7 @@ impl TagsNamespace { .into_iter() .map(TagResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "create_tags", responses) - .await?; + ctx.emit_to(Self::name(), "create_tags", responses).await?; Ok(()) } @@ -105,12 +93,9 @@ impl TagsNamespace { /// Changes tags of a file /// it removes the tags from the removed list and adds the one from the add list #[tracing::instrument(skip_all)] - async fn change_file_tags( - ctx: &Context, - event: Event, - ) -> IPCResult<()> { + async fn change_file_tags(ctx: &Context, event: Event) -> IPCResult<()> { let repo = get_repo_from_context(ctx).await; - let request = event.data::()?; + let request = event.payload::()?; let file = file_by_identifier(request.file_id, &repo).await?; if !request.added_tags.is_empty() { @@ -126,8 +111,7 @@ impl TagsNamespace { .into_iter() .map(TagResponse::from_model) .collect(); - ctx.emitter - .emit_response_to(event.id(), Self::name(), "change_file_tags", responses) + ctx.emit_to(Self::name(), "change_file_tags", responses) .await?; Ok(()) diff --git a/mediarepo-daemon/mediarepo-socket/src/utils.rs b/mediarepo-daemon/mediarepo-socket/src/utils.rs index 23d051c..4d39315 100644 --- a/mediarepo-daemon/mediarepo-socket/src/utils.rs +++ b/mediarepo-daemon/mediarepo-socket/src/utils.rs @@ -1,13 +1,12 @@ -use mediarepo_api::types::identifier::FileIdentifier; +use mediarepo_core::bromine::ipc::context::Context; use mediarepo_core::error::{RepoError, RepoResult}; -use mediarepo_core::rmp_ipc::ipc::context::Context; -use mediarepo_core::rmp_ipc::protocol::AsyncProtocolStream; +use mediarepo_core::mediarepo_api::types::identifier::FileIdentifier; use mediarepo_model::file::File; use mediarepo_model::repo::Repo; use mediarepo_model::type_keys::RepoKey; use std::sync::Arc; -pub async fn get_repo_from_context(ctx: &Context) -> Arc { +pub async fn get_repo_from_context(ctx: &Context) -> Arc { let data = ctx.data.read().await; let repo = data.get::().unwrap(); Arc::clone(repo)