Commit Graph

324 Commits

Author SHA1 Message Date
Mark Henderson
c8cabd1616 feat: /refs/local endpoint
Adding list to BlockStore trait and cleanup support

Adding list functionality and tests

wip dag put

Update Cargo.toml

Co-Authored-By: Joonas Koivunen <joonas.koivunen@gmail.com>

Update Cargo.toml

Delete config

rustfmt

fix: examples and unused"

fix: switching back to Vecs

feat: adding list functions to repo and ipfs

feat: working endpoint

fix: more sane newline adding

fix: clippy

fix: cargo fmt

fix: inner Result

fix: warp filter chain fixes part 1

fix: HandledErr and some cargo fmt

fix: StringError

removing HandledErr

fix: HandledErr

fix: unwrap placement
2020-04-14 12:26:31 -04:00
Mark Henderson
d3912d511b fix: examples and unused" 2020-04-14 08:04:06 -04:00
Mark Henderson
bf7b0535ae chore: Cargo.lock 2020-04-14 08:04:06 -04:00
Mark Henderson
b6430b56c9 rustfmt 2020-04-14 08:04:06 -04:00
Mark Robert Henderson
5c53e5fb65 Delete config 2020-04-14 08:04:06 -04:00
Mark Robert Henderson
63f81b605a Update Cargo.toml 2020-04-14 08:04:06 -04:00
Mark Robert Henderson
d822838629 Update Cargo.toml
Co-Authored-By: Joonas Koivunen <joonas.koivunen@gmail.com>
2020-04-14 08:04:06 -04:00
David Craven
028b8074c3 wip dag put 2020-04-14 08:04:06 -04:00
Joonas Koivunen
89e3f7c5e5 fix: disable IpfsOptions::default for tests
this is the only way I found to minimize additional dead_code lints
while not allowing this method to be called from tests.
2020-04-02 13:04:25 +03:00
Joonas Koivunen
18dd8cb3ce fix: remove use of IpfsOptions::default in tests
This has been the cause of number of test failures which happen when a
two threads are executing the IpfsOption::default at the same time.

 * https://github.com/ipfs-rust/rust-ipfs/pull/131/checks?check_run_id=551965765#step:12:90
 * other's have already been re-run and can't easily be found
2020-04-02 13:04:25 +03:00
Joonas Koivunen
5e3afef59c refactor: remove obsolete test comment 2020-04-02 13:04:00 +03:00
Joonas Koivunen
e1d836a137 chore: update cargo lock
unsure why this happens given the changes.
2020-04-02 13:04:00 +03:00
Joonas Koivunen
2af43b4782 refactor: to_vec to into_vec per clippy 2020-04-02 13:04:00 +03:00
Joonas Koivunen
c1b1626399 chore: cargo fmt 2020-04-02 13:04:00 +03:00
Joonas Koivunen
85bd2cd705 add: salvaged exchange_block
This is from davids non-mergeable branch.

Co-authored-by: David Craven <david@craven.ch>
2020-04-02 13:04:00 +03:00
Joonas Koivunen
0c9b997ea4 add: http log pid for easier correlation 2020-04-02 13:04:00 +03:00
Joonas Koivunen
f0cbecc92e fix: enable bitswap logging by default 2020-04-02 13:04:00 +03:00
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