chore: publish mvp rust api

This commit is contained in:
Zixuan Chen 2023-11-28 21:25:58 +08:00
parent 6ef1e12d71
commit 564dde7703
No known key found for this signature in database
13 changed files with 118 additions and 41 deletions

54
Cargo.lock generated
View file

@ -874,7 +874,7 @@ dependencies = [
[[package]]
name = "loro"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"enum-as-inner 0.6.0",
"loro-internal",
@ -889,7 +889,7 @@ dependencies = [
"enum-as-inner 0.6.0",
"fxhash",
"js-sys",
"rle",
"loro-rle",
"serde",
"string_cache",
"thiserror",
@ -930,6 +930,7 @@ dependencies = [
"js-sys",
"loro-common",
"loro-preload",
"loro-rle",
"miniz_oxide 0.7.1",
"num",
"once_cell",
@ -937,7 +938,6 @@ dependencies = [
"proptest",
"proptest-derive",
"rand",
"rle",
"serde",
"serde-wasm-bindgen",
"serde_columnar",
@ -961,6 +961,29 @@ dependencies = [
"serde_columnar",
]
[[package]]
name = "loro-rle"
version = "0.1.0"
dependencies = [
"append-only-bytes",
"arref",
"bumpalo",
"color-backtrace",
"crdt-list",
"ctor",
"debug-log",
"enum-as-inner 0.5.1",
"fxhash",
"heapless",
"num",
"ouroboros",
"proptest",
"rand",
"smallvec",
"smartstring",
"static_assertions",
]
[[package]]
name = "loro-thunderdome"
version = "0.6.2"
@ -976,7 +999,7 @@ dependencies = [
"getrandom",
"js-sys",
"loro-internal",
"rle",
"loro-rle",
"serde",
"serde-wasm-bindgen",
"wasm-bindgen",
@ -1550,29 +1573,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "rle"
version = "0.1.0"
dependencies = [
"append-only-bytes",
"arref",
"bumpalo",
"color-backtrace",
"crdt-list",
"ctor",
"debug-log",
"enum-as-inner 0.5.1",
"fxhash",
"heapless",
"num",
"ouroboros",
"proptest",
"rand",
"smallvec",
"smartstring",
"static_assertions",
]
[[package]]
name = "rustc-demangle"
version = "0.1.21"

View file

@ -3,13 +3,14 @@ name = "loro-common"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Common types and functions for Loro. This is an internal lib of Loro."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1", features = ["derive"] }
thiserror = "1.0.43"
rle = { path = "../rle" }
rle = { path = "../rle", version = "0.1.0", package = "loro-rle" }
wasm-bindgen = { version = "=0.2.86", optional = true }
fxhash = "0.2.1"
enum-as-inner = "0.6.0"

View file

@ -0,0 +1,21 @@
MIT License Copyright (c) 2023 Zixuan Chen
Permission is hereby granted, free of
charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -3,14 +3,15 @@ name = "loro-internal"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Loro internal library. Do not use it directly as it's not stable."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
string_cache = "0.8.7"
rle = { path = "../rle" }
loro-preload = { path = "../loro-preload" }
loro-common = { path = "../loro-common" }
rle = { path = "../rle", version = "0.1.0", package = "loro-rle" }
loro-preload = { path = "../loro-preload", version = "0.1.0" }
loro-common = { path = "../loro-common", version = "0.1.0" }
smallvec = { version = "1.8.0", features = ["serde"] }
postcard = "1"
fxhash = "0.2.1"

View file

@ -3,11 +3,12 @@ name = "loro-preload"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Loro internal lib for loading data"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = {version="1", features=["derive"]}
serde = { version = "1", features = ["derive"] }
serde_columnar = { version = "0.3.2" }
loro-common = {path="../loro-common"}
loro-common = { path = "../loro-common", version = "0.1.0" }
bytes = "1.4.0"

View file

@ -15,7 +15,7 @@ console_error_panic_hook = { version = "0.1.6", optional = true }
getrandom = { version = "0.2.10", features = ["js"] }
debug-log = { version = "0.2.2", features = ["wasm"] }
serde = { version = "1", features = ["derive"] }
rle = { path = "../rle" }
rle = { path = "../rle", package = "loro-rle" }
[features]
default = ["console_error_panic_hook"]

View file

@ -1,12 +1,18 @@
[package]
name = "loro"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "MIT"
description = "Loro is a high-performance CRDTs framework. Make your app collaborative efforlessly."
homepage = "https://loro.dev"
authors = ["Zixuan Chen", "Liang Zhao"]
categories = ["data-structures", "crdt", "collaborative-editing", "local-first"]
keywords = ["crdt", "local-first"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
loro-internal = { path = "../loro-internal" }
loro-internal = { path = "../loro-internal", version = "0.1.0" }
enum-as-inner = "0.6.0"
[dev-dependencies]

21
crates/loro/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License Copyright (c) 2023 Zixuan Chen
Permission is hereby granted, free of
charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1 +1,4 @@
# Loro Rust
# Loro
Experimental Rust API of [Loro](https://loro.dev).

View file

@ -1,7 +1,9 @@
[package]
name = "rle"
name = "loro-rle"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "A internal library of loro for storing and manipulating run-length encoded data. Do not use it directly."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

21
crates/rle/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License Copyright (c) 2023 Zixuan Chen
Permission is hereby granted, free of
charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,5 +1,5 @@
mod string_tree;
use rle::RleTree;
use loro_rle::RleTree;
use string_tree::{CustomString, StringTreeTrait};
pub fn main() {

View file

@ -5,7 +5,7 @@ use std::{
rc::Rc,
};
use rle::{rle_tree::tree_trait::*, HasLength, Mergable, Sliceable};
use loro_rle::{rle_tree::tree_trait::*, HasLength, Mergable, Sliceable};
use smartstring::SmartString;
type SString = SmartString<smartstring::LazyCompact>;
@ -28,7 +28,7 @@ impl CustomString {
impl HasLength for CustomString {
fn content_len(&self) -> usize {
rle::HasLength::content_len(&self.slice)
loro_rle::HasLength::content_len(&self.slice)
}
}