Skip to content

Commit

Permalink
feat: init y-octo-node
Browse files Browse the repository at this point in the history
  • Loading branch information
a committed Aug 20, 2023
1 parent 58a2ea5 commit 919699f
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 83 deletions.
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exclude = ["node_modules/**/*.toml", "target/**/*.toml"]

# https://taplo.tamasfe.dev/configuration/formatter-options.html
[formatting]
align_entries = true
indent_tables = true
reorder_keys = true
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[workspace]

members = ["packages/y-octo", "packages/y-octo-utils"]
members = ["packages/y-octo", "packages/y-octo-node", "packages/y-octo-utils"]
resolver = "2"

[workspace.dependencies]
y-octo = { workspace = true, path = "packages/y-octo" }
y-octo-utils = { workspace = true, path = "packages/y-octo-utils" }
[workspace.dependencies]
y-octo = { workspace = true, path = "packages/y-octo" }
y-octo-utils = { workspace = true, path = "packages/y-octo-utils" }

[profile.release]
lto = true
opt-level = 3
codegen-units = 1
lto = true
opt-level = 3

[profile.fast-release]
inherits = "release"
codegen-units = 16
lto = false
inherits = "release"
lto = false

[profile.profiling]
debug = true
inherits = "fast-release"
debug = true

# [profile.release.package.y-octo-fuzz]
# debug = 1

[patch.crates-io]
lib0 = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
yrs = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
lib0 = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
y-sync = { git = "https://github.com/toeverything/y-sync", rev = "aeb0010" }
yrs = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
11 changes: 11 additions & 0 deletions packages/y-octo-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
authors = ["DarkSky <[email protected]>"]
edition = "2021"
license = "MIT"
name = "y-octo-node"
repository = "https://github.com/toeverything/y-octo"
version = "0.0.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions packages/y-octo-node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
10 changes: 5 additions & 5 deletions packages/y-octo-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "y-octo-utils"
version = "0.0.1"
authors = ["x1a0t <[email protected]>"]
edition = "2021"
license = "MIT"
name = "y-octo-utils"
version = "0.0.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arbitrary = { version = "1.3.0", features = ["derive"] }
phf = { version = "0.11", features = ["macros"] }
yrs = "=0.16.5"
y-octo = { workspace = true }
phf = { version = "0.11", features = ["macros"] }
y-octo = { workspace = true }
yrs = "=0.16.5"
68 changes: 34 additions & 34 deletions packages/y-octo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
[package]
name = "y-octo"
version = "0.0.1"
authors = [
"DarkSky <[email protected]>",
"forehalo <[email protected]>",
"x1a0t <[email protected]>",
"Brooklyn <[email protected]>",
"DarkSky <[email protected]>",
"forehalo <[email protected]>",
"x1a0t <[email protected]>",
"Brooklyn <[email protected]>",
]
edition = "2021"
license = "MIT"
description = "High-performance and thread-safe CRDT implementation compatible with Yjs"
edition = "2021"
homepage = "https://github.com/toeverything/y-octo"
repository = "https://github.com/toeverything/y-octo"
keywords = ["collaboration", "crdt", "crdts", "yjs", "yata"]
include = ["src/**/*", "benches/**/*", "bin/**/*", "LICENSE", "README.md"]
keywords = ["collaboration", "crdt", "crdts", "yjs", "yata"]
license = "MIT"
name = "y-octo"
readme = "README.md"
repository = "https://github.com/toeverything/y-octo"
version = "0.0.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitvec = "1.0"
byteorder = "1.4"
log = "0.4"
nanoid = "0.4"
nom = "7.1"
bitvec = "1.0"
byteorder = "1.4"
log = "0.4"
nanoid = "0.4"
nom = "7.1"
ordered-float = "3.8"
rand = "0.8"
rand_chacha = "0.3"
serde = "1.0"
serde_json = "1.0"
thiserror = "1.0"
rand = "0.8"
rand_chacha = "0.3"
serde = "1.0"
serde_json = "1.0"
thiserror = "1.0"

[features]
bench = []

[target.'cfg(fuzzing)'.dependencies]
arbitrary = { version = "1.3", features = ["derive"] }
arbitrary = { version = "1.3", features = ["derive"] }
ordered-float = { version = "3.8", features = ["arbitrary"] }

[target.'cfg(loom)'.dependencies]
loom = { version = "0.6", features = ["checkpoint"] }

[dev-dependencies]
assert-json-diff = "2.0"
criterion = { version = "0.5", features = ["html_reports"] }
lib0 = { version = "0.16", features = ["lib0-serde"] }
ordered-float = { version = "3.8", features = ["proptest"] }
path-ext = "0.1"
proptest = "1.1"
proptest-derive = "0.3"
y-sync = "=0.3.0"
yrs = "=0.16.5"
criterion = { version = "0.5", features = ["html_reports"] }
lib0 = { version = "0.16", features = ["lib0-serde"] }
ordered-float = { version = "3.8", features = ["proptest"] }
path-ext = "0.1"
proptest = "1.1"
proptest-derive = "0.3"
y-sync = "=0.3.0"
yrs = "=0.16.5"

[[bin]]
name = "memory_leak_test"
path = "bin/memory_leak_test.rs"

[[bench]]
name = "array_ops_benchmarks"
harness = false
name = "array_ops_benchmarks"

[[bench]]
name = "codec_benchmarks"
harness = false
name = "codec_benchmarks"

[[bench]]
name = "map_ops_benchmarks"
harness = false
name = "map_ops_benchmarks"

[[bench]]
name = "text_ops_benchmarks"
harness = false
name = "text_ops_benchmarks"

[[bench]]
name = "update_benchmarks"
harness = false
name = "update_benchmarks"

[lib]
bench = true
44 changes: 22 additions & 22 deletions packages/y-octo/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[package]
name = "y-octo-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
name = "y-octo-fuzz"
publish = false
version = "0.0.0"

[package.metadata]
cargo-fuzz = true
[package.metadata]
cargo-fuzz = true

[dependencies]
rand = "0.8"
rand_chacha = "0.3"
lib0 = "=0.16.5"
libfuzzer-sys = "0.4"
lib0 = "=0.16.5"
yrs = "=0.16.5"
rand = "0.8"
rand_chacha = "0.3"
yrs = "=0.16.5"

y-octo-utils = { path = "../../y-octo-utils" }

[dependencies.y-octo]
path = ".."
[dependencies.y-octo]
path = ".."

# Prevent this from interfering with workspaces
[workspace]
Expand All @@ -27,66 +27,66 @@ members = ["."]
debug = 1

[[bin]]
doc = false
name = "codec_doc_any_struct"
path = "fuzz_targets/codec_doc_any_struct.rs"
test = false
doc = false

[[bin]]
doc = false
name = "codec_doc_any"
path = "fuzz_targets/codec_doc_any.rs"
test = false
doc = false

[[bin]]
doc = false
name = "decode_bytes"
path = "fuzz_targets/decode_bytes.rs"
test = false
doc = false

[[bin]]
doc = false
name = "ins_del_text"
path = "fuzz_targets/ins_del_text.rs"
test = false
doc = false

[[bin]]
doc = false
name = "sync_message"
path = "fuzz_targets/sync_message.rs"
test = false
doc = false

[[bin]]
doc = false
name = "i32_decode"
path = "fuzz_targets/i32_decode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "i32_encode"
path = "fuzz_targets/i32_encode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "u64_decode"
path = "fuzz_targets/u64_decode.rs"
test = false
doc = false


[[bin]]
doc = false
name = "u64_encode"
path = "fuzz_targets/u64_encode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "apply_update"
path = "fuzz_targets/apply_update.rs"
test = false
doc = false

[patch.crates-io]
lib0 = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
yrs = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
yrs = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
3 changes: 1 addition & 2 deletions packages/y-octo/src/doc/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ impl DocStore {
}

if ty.is_owned() {
self.dangling_types
.insert(ty.ptr().as_ptr() as usize, ty.swap_take());
self.dangling_types.insert(ty.ptr().as_ptr() as usize, ty.swap_take());
} else {
return Err(JwstCodecError::InvalidParent);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/y-octo/src/doc/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ impl Value {
}

pub fn from_vec<T: Into<Any>>(el: Vec<T>) -> Self {
Value::Any(Any::Array(
el.into_iter().map(|item| item.into()).collect::<Vec<_>>(),
))
Value::Any(Any::Array(el.into_iter().map(|item| item.into()).collect::<Vec<_>>()))
}
}

Expand Down
12 changes: 6 additions & 6 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Keep in sync with .editorconfig
max_width = 120
tab_spaces = 4
hard_tabs = false
format_strings = true
wrap_comments = true
format_strings = true
group_imports = "StdExternalCrate"
hard_tabs = false
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
max_width = 120
tab_spaces = 4
wrap_comments = true

0 comments on commit 919699f

Please sign in to comment.