From 72d9cc1e5b55c6af8b27454fa3db4ae94e433164 Mon Sep 17 00:00:00 2001 From: liuyi Date: Wed, 31 Jan 2024 06:54:33 +0000 Subject: [PATCH] chore(storage): bump y-octo (#5751) --- Cargo.lock | 1000 +---------------- .../server/src/fundamentals/storage/index.ts | 2 - packages/backend/storage/Cargo.toml | 4 +- packages/backend/storage/index.d.ts | 22 - packages/backend/storage/src/lib.rs | 131 +-- 5 files changed, 58 insertions(+), 1101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff081424ec..df25eced23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -59,26 +49,13 @@ name = "affine_storage" version = "1.0.0" dependencies = [ "chrono", - "jwst-codec", - "jwst-core", - "jwst-storage", "napi", "napi-build", "napi-derive", "rand", "sha3", "tokio", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", + "y-octo", ] [[package]] @@ -103,12 +80,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "allocator-api2" version = "0.2.16" @@ -130,54 +101,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" - -[[package]] -name = "anstyle-parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" -dependencies = [ - "anstyle", - "windows-sys", -] - [[package]] name = "anyhow" version = "1.0.75" @@ -193,45 +116,6 @@ dependencies = [ "derive_arbitrary", ] -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "async-trait" -version = "0.1.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "atoi" version = "2.0.0" @@ -284,17 +168,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "bigdecimal" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -331,79 +204,12 @@ dependencies = [ "generic-array", ] -[[package]] -name = "borsh" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" -dependencies = [ - "borsh-derive", - "hashbrown 0.13.2", -] - -[[package]] -name = "borsh-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -441,57 +247,10 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets", ] -[[package]] -name = "clap" -version = "4.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "clap_lex" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - [[package]] name = "const-oid" version = "0.9.5" @@ -610,27 +369,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "deranged" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "derive_arbitrary" version = "1.3.1" @@ -767,21 +505,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" -[[package]] -name = "futures" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.29" @@ -826,17 +549,6 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" -[[package]] -name = "futures-macro" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "futures-sink" version = "0.3.29" @@ -849,22 +561,14 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - [[package]] name = "futures-util" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ - "futures-channel", "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", @@ -913,46 +617,13 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "governor" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" -dependencies = [ - "cfg-if", - "dashmap", - "futures", - "futures-timer", - "no-std-compat", - "nonzero_ext", - "parking_lot", - "quanta", - "rand", - "smallvec", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] - [[package]] name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash", ] [[package]] @@ -961,7 +632,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ - "ahash 0.8.6", + "ahash", "allocator-api2", ] @@ -1065,17 +736,6 @@ dependencies = [ "hashbrown 0.14.2", ] -[[package]] -name = "inherent" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "inotify" version = "0.9.6" @@ -1120,92 +780,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jwst-codec" -version = "0.1.0" -source = "git+https://github.com/toeverything/OctoBase.git?rev=49a6b7a#49a6b7af25ce1fe54e8383e10980e9536821d286" -dependencies = [ - "arbitrary", - "bitvec", - "byteorder", - "jwst-logger", - "loom", - "nanoid", - "nom", - "ordered-float 4.1.1", - "rand", - "rand_chacha", - "rand_distr", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "jwst-core" -version = "0.1.0" -source = "git+https://github.com/toeverything/OctoBase.git?rev=49a6b7a#49a6b7af25ce1fe54e8383e10980e9536821d286" -dependencies = [ - "async-trait", - "base64", - "bytes", - "chrono", - "futures", - "jwst-codec", - "nanoid", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "jwst-logger" -version = "0.1.0" -source = "git+https://github.com/toeverything/OctoBase.git?rev=49a6b7a#49a6b7af25ce1fe54e8383e10980e9536821d286" -dependencies = [ - "chrono", - "nu-ansi-term 0.49.0", - "tracing", - "tracing-log", - "tracing-stackdriver", - "tracing-subscriber", -] - -[[package]] -name = "jwst-storage" -version = "0.1.0" -source = "git+https://github.com/toeverything/OctoBase.git?rev=49a6b7a#49a6b7af25ce1fe54e8383e10980e9536821d286" -dependencies = [ - "anyhow", - "async-trait", - "bytes", - "chrono", - "futures", - "governor", - "jwst-codec", - "jwst-core", - "jwst-logger", - "jwst-storage-migration", - "path-ext", - "sea-orm", - "sea-orm-migration", - "sha2", - "thiserror", - "tokio", - "tokio-util", - "url", -] - -[[package]] -name = "jwst-storage-migration" -version = "0.1.0" -source = "git+https://github.com/toeverything/OctoBase.git?rev=49a6b7a#49a6b7af25ce1fe54e8383e10980e9536821d286" -dependencies = [ - "sea-orm-migration", - "tokio", -] - [[package]] name = "keccak" version = "0.1.4" @@ -1235,6 +809,16 @@ dependencies = [ "libc", ] +[[package]] +name = "lasso" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4644821e1c3d7a560fe13d842d13f587c07348a1a05d3a797152d41c90c56df2" +dependencies = [ + "dashmap", + "hashbrown 0.13.2", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1314,15 +898,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "mach2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" -dependencies = [ - "libc", -] - [[package]] name = "matchers" version = "0.1.0" @@ -1419,23 +994,23 @@ checksum = "d4b4532cf86bfef556348ac65e561e3123879f0e7566cca6d43a6ff5326f13df" [[package]] name = "napi-derive" -version = "2.14.2" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0cca5738c6e81eb5ffd2c8ff2b4f05ece9c4c60c7e2b36cec6524492cf7f330" +checksum = "7622f0dbe0968af2dacdd64870eee6dee94f93c989c841f1ad8f300cf1abd514" dependencies = [ "cfg-if", "convert_case", "napi-derive-backend", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "napi-derive-backend" -version = "1.0.55" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35960e5f33228192a9b661447d0dfe8f5a3790ff5b4058c4d67680ded4f65b91" +checksum = "8ec514d65fce18a959be55e7f683ac89c6cb850fb59b09e25ab777fd5a4a8d9e" dependencies = [ "convert_case", "once_cell", @@ -1443,7 +1018,7 @@ dependencies = [ "quote", "regex", "semver", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -1468,12 +1043,6 @@ dependencies = [ "pin-utils", ] -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - [[package]] name = "nom" version = "7.1.3" @@ -1484,12 +1053,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - [[package]] name = "notify" version = "6.1.1" @@ -1520,26 +1083,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "nu-ansi-term" -version = "0.49.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -1613,15 +1156,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "ordered-float" -version = "3.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" -dependencies = [ - "num-traits", -] - [[package]] name = "ordered-float" version = "4.1.1" @@ -1632,30 +1166,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ouroboros" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ba07320d39dfea882faa70554b4bd342a5f273ed59ba7c1c6b4c840492c954" -dependencies = [ - "aliasable", - "ouroboros_macro", - "static_assertions", -] - -[[package]] -name = "ouroboros_macro" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "overload" version = "0.1.1" @@ -1691,15 +1201,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "path-ext" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8285c3c3c3085f8819bdcebc9c7e783851527f34974d7d283ced36c977ae812" -dependencies = [ - "walkdir", -] - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -1754,51 +1255,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.69" @@ -1808,42 +1270,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "quanta" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" -dependencies = [ - "crossbeam-utils", - "libc", - "mach2", - "once_cell", - "raw-cpuid", - "wasi", - "web-sys", - "winapi", -] - [[package]] name = "quote" version = "1.0.33" @@ -1899,15 +1325,6 @@ dependencies = [ "rand", ] -[[package]] -name = "raw-cpuid" -version = "10.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -1970,15 +1387,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "rend" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" -dependencies = [ - "bytecheck", -] - [[package]] name = "ring" version = "0.16.20" @@ -1994,34 +1402,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rkyv" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" -dependencies = [ - "bitvec", - "bytecheck", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rsa" version = "0.9.6" @@ -2042,22 +1422,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rust_decimal" -version = "1.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" -dependencies = [ - "arrayvec", - "borsh", - "bytes", - "num-traits", - "rand", - "rkyv", - "serde", - "serde_json", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2150,171 +1514,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sea-bae" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd3534a9978d0aa7edd2808dc1f8f31c4d0ecd31ddf71d997b3c98e9f3c9114" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "sea-orm" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d17105eb8049488d2528580ecc3f0912ab177d600f10e8e292d6994870ba6a" -dependencies = [ - "async-stream", - "async-trait", - "bigdecimal", - "chrono", - "futures", - "log", - "ouroboros", - "rust_decimal", - "sea-orm-macros", - "sea-query", - "sea-query-binder", - "serde", - "serde_json", - "sqlx", - "strum", - "thiserror", - "time", - "tracing", - "url", - "uuid", -] - -[[package]] -name = "sea-orm-cli" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66b46c28caf05824ecd1e68865de762959aa3640e1c21a415a00090e67b1658" -dependencies = [ - "chrono", - "clap", - "dotenvy", - "glob", - "regex", - "sea-schema", - "tracing", - "tracing-subscriber", - "url", -] - -[[package]] -name = "sea-orm-macros" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc4e1945c3b07bbc3031dd5de75808d8e94221625f548b5fd582d301da86022" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "sea-bae", - "syn 2.0.38", - "unicode-ident", -] - -[[package]] -name = "sea-orm-migration" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a340d727bafe3d817b55f920498cc469e8664e8b654017d2ec93a31aed40b70f" -dependencies = [ - "async-trait", - "clap", - "dotenvy", - "futures", - "sea-orm", - "sea-orm-cli", - "sea-schema", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "sea-query" -version = "0.30.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3e6bba153bb198646c8762c48414942a38db27d142e44735a133cabddcc820" -dependencies = [ - "bigdecimal", - "chrono", - "derivative", - "inherent", - "ordered-float 3.9.2", - "rust_decimal", - "sea-query-derive", - "serde_json", - "time", - "uuid", -] - -[[package]] -name = "sea-query-binder" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36bbb68df92e820e4d5aeb17b4acd5cc8b5d18b2c36a4dd6f4626aabfa7ab1b9" -dependencies = [ - "bigdecimal", - "chrono", - "rust_decimal", - "sea-query", - "serde_json", - "sqlx", - "time", - "uuid", -] - -[[package]] -name = "sea-query-derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a82fcb49253abcb45cdcb2adf92956060ec0928635eb21b4f7a6d8f25ab0bc" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.38", - "thiserror", -] - -[[package]] -name = "sea-schema" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cd9561232bd1b82ea748b581f15909d11de0db6563ddcf28c5d908aee8282f1" -dependencies = [ - "futures", - "sea-query", - "sea-schema-derive", -] - -[[package]] -name = "sea-schema-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f686050f76bffc4f635cda8aea6df5548666b830b52387e8bc7de11056d11e" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "semver" version = "1.0.20" @@ -2412,12 +1611,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - [[package]] name = "slab" version = "0.4.9" @@ -2433,6 +1626,15 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +[[package]] +name = "smol_str" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6845563ada680337a52d43bb0b29f396f2d911616f6573012645b9e3d048a49" +dependencies = [ + "serde", +] + [[package]] name = "socket2" version = "0.5.5" @@ -2498,9 +1700,8 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" dependencies = [ - "ahash 0.8.6", + "ahash", "atoi", - "bigdecimal", "byteorder", "bytes", "chrono", @@ -2522,7 +1723,6 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rust_decimal", "rustls", "rustls-pemfile", "serde", @@ -2531,12 +1731,10 @@ dependencies = [ "smallvec", "sqlformat", "thiserror", - "time", "tokio", "tokio-stream", "tracing", "url", - "uuid", "webpki-roots", ] @@ -2588,7 +1786,6 @@ checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", "base64", - "bigdecimal", "bitflags 2.4.1", "byteorder", "bytes", @@ -2613,7 +1810,6 @@ dependencies = [ "percent-encoding", "rand", "rsa", - "rust_decimal", "serde", "sha1", "sha2", @@ -2621,9 +1817,7 @@ dependencies = [ "sqlx-core", "stringprep", "thiserror", - "time", "tracing", - "uuid", "whoami", ] @@ -2635,7 +1829,6 @@ checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", "base64", - "bigdecimal", "bitflags 2.4.1", "byteorder", "chrono", @@ -2654,10 +1847,8 @@ dependencies = [ "log", "md-5", "memchr", - "num-bigint", "once_cell", "rand", - "rust_decimal", "serde", "serde_json", "sha1", @@ -2666,9 +1857,7 @@ dependencies = [ "sqlx-core", "stringprep", "thiserror", - "time", "tracing", - "uuid", "whoami", ] @@ -2691,19 +1880,11 @@ dependencies = [ "percent-encoding", "serde", "sqlx-core", - "time", "tracing", "url", "urlencoding", - "uuid", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "stringprep" version = "0.1.4" @@ -2715,18 +1896,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" - [[package]] name = "subtle" version = "2.5.0" @@ -2804,35 +1973,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -2889,28 +2029,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-util" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "tracing" version = "0.1.40" @@ -2955,31 +2073,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-stackdriver" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644201289b078e925ad49bfdeb7c0ced851d211462376d5154b13ce7be899afa" -dependencies = [ - "Inflector", - "serde", - "serde_json", - "thiserror", - "time", - "tracing-core", - "tracing-subscriber", -] - [[package]] name = "tracing-subscriber" version = "0.3.17" @@ -2987,18 +2080,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ "matchers", - "nu-ansi-term 0.46.0", + "nu-ansi-term", "once_cell", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] [[package]] @@ -3063,12 +2153,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "uuid" version = "1.6.1" @@ -3314,6 +2398,30 @@ dependencies = [ "tap", ] +[[package]] +name = "y-octo" +version = "0.0.1" +source = "git+https://github.com/y-crdt/y-octo.git?branch=main#01ec08ac008729fc41f73f6700cfbed52a01c632" +dependencies = [ + "ahash", + "arbitrary", + "bitvec", + "byteorder", + "lasso", + "log", + "loom", + "nanoid", + "nom", + "ordered-float", + "rand", + "rand_chacha", + "rand_distr", + "serde", + "serde_json", + "smol_str", + "thiserror", +] + [[package]] name = "zerocopy" version = "0.7.31" diff --git a/packages/backend/server/src/fundamentals/storage/index.ts b/packages/backend/server/src/fundamentals/storage/index.ts index fe73e30463..a18bcee5c6 100644 --- a/packages/backend/server/src/fundamentals/storage/index.ts +++ b/packages/backend/server/src/fundamentals/storage/index.ts @@ -15,8 +15,6 @@ try { : require('../../../storage.node'); } -export { storageModule as OctoBaseStorageModule }; - export const mergeUpdatesInApplyWay = storageModule.mergeUpdatesInApplyWay; export const verifyChallengeResponse = async ( diff --git a/packages/backend/storage/Cargo.toml b/packages/backend/storage/Cargo.toml index b1374cac9f..ff57257043 100644 --- a/packages/backend/storage/Cargo.toml +++ b/packages/backend/storage/Cargo.toml @@ -8,9 +8,6 @@ crate-type = ["cdylib"] [dependencies] chrono = "0.4" -jwst-codec = { git = "https://github.com/toeverything/OctoBase.git", rev = "49a6b7a" } -jwst-core = { git = "https://github.com/toeverything/OctoBase.git", rev = "49a6b7a" } -jwst-storage = { git = "https://github.com/toeverything/OctoBase.git", rev = "49a6b7a" } napi = { version = "2", default-features = false, features = [ "napi5", "async", @@ -18,6 +15,7 @@ napi = { version = "2", default-features = false, features = [ napi-derive = { version = "2", features = ["type-def"] } rand = "0.8" sha3 = "0.10" +y-octo = { git = "https://github.com/y-crdt/y-octo.git", branch = "main" } [dev-dependencies] tokio = "1" diff --git a/packages/backend/storage/index.d.ts b/packages/backend/storage/index.d.ts index 28e5de90c0..9fe6df5a2f 100644 --- a/packages/backend/storage/index.d.ts +++ b/packages/backend/storage/index.d.ts @@ -1,28 +1,6 @@ /* auto-generated by NAPI-RS */ /* eslint-disable */ -export class Storage { - /** Create a storage instance and establish connection to persist store. */ - static connect(database: string, debugOnlyAutoMigrate?: boolean | undefined | null): Promise - /** List all blobs in a workspace. */ - listBlobs(workspaceId?: string | undefined | null): Promise> - /** Fetch a workspace blob. */ - getBlob(workspaceId: string, name: string): Promise - /** Upload a blob into workspace storage. */ - uploadBlob(workspaceId: string, blob: Buffer): Promise - /** Delete a blob from workspace storage. */ - deleteBlob(workspaceId: string, hash: string): Promise - /** Workspace size taken by blobs. */ - blobsSize(workspaces: Array): Promise -} - -export interface Blob { - contentType: string - lastModified: string - size: number - data: Buffer -} - /** * Merge updates in form like `Y.applyUpdate(doc, update)` way and return the * result binary. diff --git a/packages/backend/storage/src/lib.rs b/packages/backend/storage/src/lib.rs index 229cbde78a..40d119ae55 100644 --- a/packages/backend/storage/src/lib.rs +++ b/packages/backend/storage/src/lib.rs @@ -2,16 +2,10 @@ pub mod hashcash; -use std::{ - collections::HashMap, - fmt::{Debug, Display}, - path::PathBuf, -}; +use std::fmt::{Debug, Display}; -use jwst_codec::Doc; -use jwst_core::BlobStorage; -use jwst_storage::{BlobStorageType, JwstStorage, JwstStorageError}; use napi::{bindgen_prelude::*, Error, Result, Status}; +use y_octo::Doc; #[macro_use] extern crate napi_derive; @@ -35,132 +29,13 @@ macro_rules! map_err { }; } -macro_rules! napi_wrap { - ($( ($name: ident, $target: ident) ),*) => { - $( - #[napi] - pub struct $name($target); - - impl std::ops::Deref for $name { - type Target = $target; - - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - impl From<$target> for $name { - fn from(t: $target) -> Self { - Self(t) - } - } - )* - }; -} - -napi_wrap!((Storage, JwstStorage)); - -#[napi(object)] -pub struct Blob { - pub content_type: String, - pub last_modified: String, - pub size: i64, - pub data: Buffer, -} - -#[napi] -impl Storage { - /// Create a storage instance and establish connection to persist store. - #[napi] - pub async fn connect(database: String, debug_only_auto_migrate: Option) -> Result { - let inner = match if cfg!(debug_assertions) && debug_only_auto_migrate.unwrap_or(false) { - JwstStorage::new_with_migration(&database, BlobStorageType::DB).await - } else { - JwstStorage::new(&database, BlobStorageType::DB).await - } { - Ok(storage) => storage, - Err(JwstStorageError::Db(e)) => { - return Err(Error::new( - Status::GenericFailure, - format!("failed to connect to database: {}", e), - )); - } - Err(e) => return Err(Error::new(Status::GenericFailure, e.to_string())), - }; - - Ok(inner.into()) - } - - /// List all blobs in a workspace. - #[napi] - pub async fn list_blobs(&self, workspace_id: Option) -> Result> { - map_err!(self.blobs().list_blobs(workspace_id).await) - } - - /// Fetch a workspace blob. - #[napi] - pub async fn get_blob(&self, workspace_id: String, name: String) -> Result> { - let (id, params) = { - let path = PathBuf::from(name.clone()); - let ext = path - .extension() - .and_then(|s| s.to_str().map(|s| s.to_string())); - let id = path - .file_stem() - .and_then(|s| s.to_str().map(|s| s.to_string())) - .unwrap_or(name); - - (id, ext.map(|ext| HashMap::from([("format".into(), ext)]))) - }; - - let Ok(meta) = self - .blobs() - .get_metadata(Some(workspace_id.clone()), id.clone(), params.clone()) - .await - else { - return Ok(None); - }; - - let Ok(file) = self.blobs().get_blob(Some(workspace_id), id, params).await else { - return Ok(None); - }; - - Ok(Some(Blob { - content_type: meta.content_type, - last_modified: format!("{:?}", meta.last_modified), - size: meta.size, - data: file.into(), - })) - } - - /// Upload a blob into workspace storage. - #[napi] - pub async fn upload_blob(&self, workspace_id: String, blob: Buffer) -> Result { - // TODO: can optimize, avoid copy - let blob = blob.as_ref().to_vec(); - map_err!(self.blobs().put_blob(Some(workspace_id), blob).await) - } - - /// Delete a blob from workspace storage. - #[napi] - pub async fn delete_blob(&self, workspace_id: String, hash: String) -> Result { - map_err!(self.blobs().delete_blob(Some(workspace_id), hash).await) - } - - /// Workspace size taken by blobs. - #[napi] - pub async fn blobs_size(&self, workspaces: Vec) -> Result { - map_err!(self.blobs().get_blobs_size(workspaces).await) - } -} - /// Merge updates in form like `Y.applyUpdate(doc, update)` way and return the /// result binary. #[napi(catch_unwind)] pub fn merge_updates_in_apply_way(updates: Vec) -> Result { let mut doc = Doc::default(); for update in updates { - map_err!(doc.apply_update_from_binary(update.as_ref().to_vec()))?; + map_err!(doc.apply_update_from_binary_v1(update.as_ref()))?; } let buf = map_err!(doc.encode_update_v1())?;