Skip to content

Commit

Permalink
refactor: replace channel with callback of transport in swarm (#561)
Browse files Browse the repository at this point in the history
* Separate transport operation in swarm

* Implement PayloadSender for SwarmTransport

* Update handshake api

* Update callback mode

* Remove channel

* Use MessageHandler in callback

* Update rings-core api in rings-node

* Simplify return type of gen_sorted_ht and gen_pure_dht

* Implement a node in default test for monitoring

* Fix static check of connection handler test

* Fix static check of tests

* Remove not using module and its dependencies

* Fix static check of wasm tests

* Fix callback of dummy transport

* Should always invoke user defined callbacks

* Should notify connected after data channel opened

* Fix dummy test datachannel callback behaviour

* Wait for msgs in stabilization and storage tests

* Fix test_fourth_node_connection by incr wait time

* Remove meaningless disconnected cleanup test

* Fix len error in test_extend_data

* Fix test_extend_data in storage handler

* Test case enhance

* Temeparary skip dummy tests

* Wait for msg arriving in test

* Fix handshake_on_both_sides test

* Fix receiver dropping bug in test_stabilization_final_dht

* Upgrade stabilization api

* Hide the SwarmTransport in the Swarm of rings-core
  • Loading branch information
Ma233 authored Mar 28, 2024
1 parent 10b621a commit 3ffcdd2
Show file tree
Hide file tree
Showing 64 changed files with 1,868 additions and 3,827 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/qaci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ jobs:
- name: Run doc tests
run: cargo test --doc

- name: Run dummy tests
run: cargo test -p rings-core --features dummy --verbose
# - name: Run dummy tests
# run: cargo test -p rings-core --features dummy --verbose

- name: Run tests
run: cargo test --release --all --verbose
Expand Down
22 changes: 1 addition & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ experimental = ["std"]
default = ["std"]
std = [
"webrtc",
"async-channel",
"sled",
"uuid/v4",
"uuid/serde",
Expand Down Expand Up @@ -88,7 +87,6 @@ tiny-keccak = { version = "2.0.1", features = ["keccak"] }
uuid = { version = "0.8.2", optional = true }

# default and dummy
async-channel = { version = "1.6.1", optional = true }
sled = { version = "0.34.7", optional = true }
webrtc = { workspace = true, optional = true }

Expand Down
63 changes: 0 additions & 63 deletions crates/core/src/channels/default.rs

This file was deleted.

14 changes: 0 additions & 14 deletions crates/core/src/channels/mod.rs

This file was deleted.

67 changes: 0 additions & 67 deletions crates/core/src/channels/wasm.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/core/src/dht/chord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ mod tests {
}
}

let dhts = gen_sorted_dht(5).await;
let dhts = gen_sorted_dht(5);
let [n1, n2, n3, n4, n5] = dhts.as_slice() else {
panic!("wrong dhts length");
};
Expand Down
3 changes: 1 addition & 2 deletions crates/core/src/dht/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ pub use chord::TopoInfo;
pub use chord::VNodeStorage;
pub use did::Did;
pub use finger::FingerTable;
pub use stabilization::Stabilization;
pub use stabilization::TStabilize;
pub use stabilization::Stabilizer;
pub use successor::SuccessorReader;
pub use successor::SuccessorWriter;
pub use types::Chord;
Expand Down
Loading

0 comments on commit 3ffcdd2

Please sign in to comment.