Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Add pubsub http (#120)
Browse files Browse the repository at this point in the history
* add: pubsub http api
* add: get shoveling and subscription complications going

currently the missing piece is seeing locally sent messages in the
subscribed streams, then maybe creating a more complicated API for
subscribing which will require a single task for shoveling into the
responses.

* chore: lower timeout to pass the tests

Should probably have another drop sender here.

* fix: close stream on first error

tokio::sync::broadcast will continue after telling how many items were
lost, which seems likely with the small buffer and quickly firing more
than the buffer elements.

* fix: raise the buffer size for subscribe responses
* feat: use custom rust-libp2p to pass tests

the v0.16.2-with-floodsub-opts includes "subscribers see locally
published messages" which is needed for the conformance tests to pass.
this has been PR'd as libp2p/rust-libp2p#1520.

* fix: pubsub test after changing the floodsub impl
  • Loading branch information
Joonas Koivunen authored Mar 25, 2020
1 parent ae89f4a commit 6cbf679
Show file tree
Hide file tree
Showing 10 changed files with 758 additions and 161 deletions.
220 changes: 110 additions & 110 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ members = [ "bitswap", "http", "examples" ]

[patch.crates-io]
ctr = { git = "https://github.com/koivunej/stream-ciphers.git", branch = "ctr128-64to128" }

# these are needed for the floodsub local originated messages to be seen by subscribers
libp2p = { git = "https://github.com/koivunej/rust-libp2p.git", branch = "v0.16.2-with-floodsub-opts" }
libp2p-core = { git = "https://github.com/koivunej/rust-libp2p.git", branch = "v0.16.2-with-floodsub-opts" }
libp2p-swarm = { git = "https://github.com/koivunej/rust-libp2p.git", branch = "v0.16.2-with-floodsub-opts" }
libp2p-floodsub = { git = "https://github.com/koivunej/rust-libp2p.git", branch = "v0.16.2-with-floodsub-opts" }
1 change: 1 addition & 0 deletions http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ warp = { version = "0.2" }
thiserror = "1.0"
multibase = "0.8.0"
futures = "0.3"
percent-encoding = "*"

# openssl is required for rsa keygen but not used by the rust-ipfs or it's dependencies
openssl = "0.10"
Expand Down
3 changes: 2 additions & 1 deletion http/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use ipfs::{Ipfs, IpfsTypes};
use std::convert::Infallible;

pub mod id;
pub mod pubsub;
pub mod swarm;
pub mod version;

Expand Down Expand Up @@ -43,7 +44,7 @@ where
.or(warp::path!("object" / ..).and_then(not_implemented))
.or(warp::path!("pin" / ..).and_then(not_implemented))
.or(warp::path!("ping" / ..).and_then(not_implemented))
.or(warp::path!("pubsub" / ..).and_then(not_implemented))
.or(pubsub::routes(ipfs))
.or(warp::path!("refs" / ..).and_then(not_implemented))
.or(warp::path!("repo" / ..).and_then(not_implemented))
.or(warp::path!("stats" / ..).and_then(not_implemented))
Expand Down
Loading

0 comments on commit 6cbf679

Please sign in to comment.