Commit Graph

407 Commits

Author SHA1 Message Date
Joonas Koivunen
608ca9f174 feat: bitswap stats with repo changes
this adds a BlockPut result in two places which is inferior to the more
complete bitswap refactoring. BlockPut will let the caller know if the
block was added or if it existed already. This is poorly implemented in
the fs blockstore.
2020-04-02 13:04:00 +03:00
Joonas Koivunen
868f4a8722 add: bitswap wantlist getters
compared to original version, attempt to differentiate peer vs. local at
method level. could probably be at the ipfs level as well?
2020-04-02 13:04:00 +03:00
Joonas Koivunen
cd26d39857 refactor: remove AsMut<Pubsub> in favor of getter
neither looks too good but AsMut<Pubsub> trick cannot be played with
multiple components so there goes that idea.
2020-04-02 13:04:00 +03:00
Joonas Koivunen
a068e2565b add: boilerplate for bitswap apis 2020-04-02 13:04:00 +03:00
Joonas Koivunen
72ff94cecf wip salvage
This is originally from the non-merging branch by David in
https://github.com/ipfs-rust/rust-ipfs/pull/126.

Co-authored-by: David Craven <david@craven.ch>
2020-04-02 13:04:00 +03:00
Joonas Koivunen
44e91e290e chore: forgotten cargo fmt 2020-04-01 14:30:25 +02:00
Joonas Koivunen
b60c99dbdb add: test for cancelled subscriptionfuture
was thinking that leaving the waker there might need to be fixed but
apparently it causes no problems.
2020-04-01 14:30:25 +02:00
Joonas Koivunen
74a790400b refactor: subscription debug impls with type params
these help when logging, since we have limited number of subscription
types.
2020-04-01 14:30:25 +02:00
Joonas Koivunen
fb6e80b954 add: shutdown to release subscriptionfuts on exit
without this any future created by get_block will never complete, which
will hang http requests with the block api for example.
2020-04-01 14:30:25 +02:00
Joonas Koivunen
b6dbd64ca4 refactor: remove warning 2020-03-28 19:45:18 -04:00
Joonas Koivunen
9b3bc0ee91 chore: update Cargo.lock 2020-03-28 19:45:18 -04:00
Joonas Koivunen
305e152aec fix: flaky test by cloning instead of try_unwrap 2020-03-28 19:45:18 -04:00
Mark Robert Henderson
ef8dc79cd1
Update README.md 2020-03-27 16:48:26 -04:00
Joonas Koivunen
0d214dc7dc
Merge pull request #117 from saresend/master
Adds basic support for pin and unpin operations
2020-03-27 19:15:45 +02:00
saresend
5ac059ff53 merging saresend/rust-ipfs to master ipfs-rust/rust-ipfs 2020-03-27 08:19:55 -07:00
Volker Mische
d9955928bb refactor: Move prefix code from rust-cid to here
Using prefixes for creating CIDs is tightly coupled to Bitswap. Hence moving
this functionality from rust-cid [1] directly into bitswap.

[1]: fcb8ea3f48/src/prefix.rs
2020-03-27 10:44:42 -03:00
saresend
344a3aac9f formatting 2020-03-26 18:33:56 -07:00
saresend
42c9d7ac49 adds test for pin and unpin 2020-03-26 18:32:03 -07:00
saresend
9a7215f91a removing extraneous logic 2020-03-26 18:23:36 -07:00
saresend
e95bd89dce moving to use RC-like logic 2020-03-26 18:21:55 -07:00
saresend
8f1349dab7 removes api from dag, operates directly on the repo 2020-03-26 17:53:48 -07:00
saresend
5e2a7d5b40 Merge branch 'master' of https://github.com/ipfs-rust/rust-ipfs 2020-03-26 17:49:46 -07:00
Joonas Koivunen
6cbf679644
Add pubsub http (#120)
* 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 https://github.com/libp2p/rust-libp2p/pull/1520.

* fix: pubsub test after changing the floodsub impl
2020-03-25 21:42:06 +02:00
Joonas Koivunen
ae89f4aa3d
Add pubsub api (#118)
* add: simple pubsub api

the api is quite horrible with `ipfs::Ipfs::pubsub_*` methods but it
works. `ipfs::Ipfs` provides subscribing to a topic at most once, the
old subscription needs to be unsubscribed with `pubsub_unsubscribe`
before a new one can be started.

message publishing happens via the `Floodsub::publish_any` api which
allows publishing into not subscribed topics.

there are also apis for getting the known peers optionally per topic and
listing the active subscriptions.

subscriptions can be dropped by the user but the subscription will not
be cleaned up until a message comes in... this is perhaps something to
be looked at.

* add: simple pubsub tests
* fix: impl unsubscribing via drop
* doc: add missing public doc comment
* doc: add and adjust
* refactor: clippy warnings
* fix: dont unsub on drop after stream ended

this happens only once the sender has been dropped by unsubscribing (or
later via bounded channel becoming full).

* doc: update comments on pubsub
* fix: poll swarm fully

there was an issue where swarm wasn't being polled to the end for which
I hastly created https://github.com/libp2p/rust-libp2p/issues/1516. in
later investigation it turned out that the ipfs::p2p::pubsub was
returning `Poll::Pending` too soon. alternative to the loops would be to
wake the task up where previously `Poll::Pending` was returned.

the issue manifested because of the polling order and the changes made
to the swarm after polling it. the changes created new events which
needed to be dispatched which in turn means the swarm needs to be polled
again or a wakeup be scheduled. adding those wakeups would make the
tasks more co-operative with the same tasks running on the executor.

also reverts the changes made in
290fcfa3ad to ipfs::p2p::swarm where
std::task::Waker was recorded and notified on changes. adding the waker
helped in that particular case but not in general.

* fix: remove rare panic in valid situation
* refactor: remove extra logging
2020-03-25 20:52:41 +02:00
saresend
94a1c946e2 pushed through a query function and unpinning to top level, and adds check when upinning 2020-03-24 08:59:10 -07:00
saresend
c9dec62d99 fixing clippy lints 2020-03-23 11:43:16 -07:00
saresend
fe6ab0499b augments datastore to include pinnable data 2020-03-23 11:35:24 -07:00
saresend
fe2a51b616 exposing properly on API side 2020-03-23 11:30:04 -07:00
saresend
d6e159c4de punching datastore functions through to API 2020-03-23 11:28:27 -07:00
saresend
dee4e1cab5 reformatting repo/mod.rs 2020-03-23 11:15:52 -07:00
saresend
3c11bcb179 fixing edits 2020-03-23 11:14:49 -07:00
saresend
3ad149494d Adding partial stups to support pin/unpin 2020-03-23 11:10:25 -07:00
Joonas Koivunen
374512a948 fix: stop doing reading common config during tests
IpfsOptions::<T>::default() reads from disk, which I had forgotten when
writing the test case.
2020-03-22 17:49:49 -03:00
Joonas Koivunen
c33b87e8ef refactor: remove extra version fields
Created https://github.com/ferristseng/rust-ipfs-api/issues/46 instead.
2020-03-22 17:48:43 -03:00
Joonas Koivunen
89354e7075 fix: version to contain all fields for tests
incl. additional fields for rust-ipfs-api.
2020-03-22 17:48:43 -03:00
Joonas Koivunen
0b4e698c41 refactor: remove needless spawning 2020-03-22 19:34:35 +02:00
Joonas Koivunen
290fcfa3ad
Merge pull request #108 from eqlabs/add_connect_integration_test
Add connect integration test
2020-03-22 19:02:17 +02:00
Joonas Koivunen
512c34a8d5 chore: cargo fmt 2020-03-22 16:43:55 +02:00
Joonas Koivunen
4829f0133e refactor: minor cleanup in tests and swarm 2020-03-22 16:42:47 +02:00
Joonas Koivunen
71df1d9a06 fix: wakeup when adding the dial action on swarm 2020-03-22 16:41:06 +02:00
Joonas Koivunen
90bf986b24 wip: use println instead of log in test 2020-03-22 15:44:35 +02:00
Joonas Koivunen
307a724b1a fix: poll swarm first, use SwarmEvents
polling swarm first seems important, otherwise there'll be a race to
first listening endpoint getting up at least.
2020-03-22 15:08:57 +02:00
Joonas Koivunen
cd7a416528 add: test case for connecting two nodes
this currently fails because the identify query is executed before
network of swarm is ready, or is even polled the first time.
2020-03-22 15:00:12 +02:00
Joonas Koivunen
f624d1f7bd fix: both crate names were wrong by default
This is a leftover from PR #103.
2020-03-22 09:00:49 -03:00
Joonas Koivunen
c8b44941f6
Merge pull request #104 from dvc94ch/swarm-http-2
Implement swarm api.
2020-03-22 12:13:50 +02:00
David Craven
498016b9fb Try fix windows. 2020-03-21 16:56:49 -03:00
David Craven
8889b0de12 Fix ci. 2020-03-21 13:25:32 -03:00
David Craven
1e96deab76 Update Cargo.lock 2020-03-21 12:41:21 -03:00
David Craven
07481a65b3 Make mdns togglable. 2020-03-21 12:41:21 -03:00
David Craven
f121a21c81 Implement swarm http api. 2020-03-21 12:41:21 -03:00