Commit Graph

132 Commits

Author SHA1 Message Date
ljedrz
3eade047b4 refactor: use unwrap_or_default instead of a handwritten empty slice
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-29 14:42:33 +02:00
ljedrz
67641dc5e0 perf: remove an unneeded clone
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-29 14:26:43 +02:00
ljedrz
a57d49216a perf: faster Bytes conversions in http::{block, dag}
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-29 13:38:32 +02:00
ljedrz
1c299109d2 refactor: shorten a match expression
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-29 12:41:29 +02:00
ljedrz
8c92c34d44 perf: remove an unneeded map presence check
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-29 12:10:23 +02:00
bors[bot]
008693fcd1
Merge #210
210: A round of cleanups r=koivunej a=ljedrz

Assorted drive-by cleanups and small refactorings; individual commits describe the specific changes.

Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-06-29 08:43:47 +00:00
Joonas Koivunen
50ae390e66 fix: return "n/a" in verbose swarm peers response
this follows the lead of js-ipfs with the "n/a".
2020-06-26 18:17:42 +03:00
ljedrz
a8103cb14c refactor: simplify a From impl for PubsubHttpApiMessage
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-26 15:27:07 +02:00
ljedrz
2603532027 refactor: make pubsub methods move their params
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-26 15:11:05 +02:00
ljedrz
8c89714da9 refactor: simplify one match expression
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-26 15:11:05 +02:00
Joonas Koivunen
d1cd15b4ec
Merge pull request #193 from eqlabs/fix_use_tempfile
fix test using non-unique tempfile
2020-06-18 01:16:08 +03:00
Joonas Koivunen
3ba5ddf1a3 fix test using non-unique tempfile 2020-06-18 00:55:11 +03:00
Joonas Koivunen
22aaec2377 refactor: remove unshared use
unshare was required as hyper was forced to require the body stream to
be Sync due to compiler issue while it was not really needed. Latest
hyper now has this workaround built-in.
2020-06-17 23:07:39 +03:00
Joonas Koivunen
27085b3095 chore: update hyper and warp to latest 2020-06-17 23:07:39 +03:00
Joonas Koivunen
3bfa506f69 refactor: suggestions from code review
Including mostly comment fixes and removal of an extra &mut.

Co-authored-by: ljedrz <ljedrz@users.noreply.github.com>
2020-06-17 17:27:05 +03:00
Joonas Koivunen
9aa9322a33 refactor: remove unused warnings on windows 2020-06-17 17:27:05 +03:00
Joonas Koivunen
24e4c4da42 chore: cargo fmt 2020-06-17 17:27:05 +03:00
Joonas Koivunen
0d2dd477e9 doc: refresh and check out cargo docs 2020-06-17 17:27:05 +03:00
Joonas Koivunen
c874e1165a fix: windows build 2020-06-17 17:27:05 +03:00
Joonas Koivunen
6be2556341 chore: cargo fmt 2020-06-17 17:27:05 +03:00
Joonas Koivunen
f5ada8728d add(http): multiblock file /get test
this does not hit the buffer cycling cases but hits all other file
cases.
2020-06-17 17:27:05 +03:00
Joonas Koivunen
7e0fcd05b3 refactor(http): more /get test support 2020-06-17 17:27:05 +03:00
Joonas Koivunen
bd6a974db5 refactor: simplify to simple buffer in TarHelper
two buffers would allow better reusing, but only with concurrency.
2020-06-17 17:27:05 +03:00
Joonas Koivunen
6eb276eb28 add: test /get for long and file names 2020-06-17 17:27:05 +03:00
Joonas Koivunen
9151834ba3 chore: cleanup warnings, fmt 2020-06-17 17:27:05 +03:00
Joonas Koivunen
350bb9ccf7 fix: hopefully get windows compiling 2020-06-17 17:27:05 +03:00
Joonas Koivunen
92cc2ab353 fix panicing with long link names 2020-06-17 17:27:05 +03:00
Joonas Koivunen
6a96593866 refactor: make Walker easier to use
turns out the internal structure almost supported this already, but
`self.current` needed to be done an Option.
2020-06-17 17:27:05 +03:00
Joonas Koivunen
e25a23380c refactor: split tar helper to own module 2020-06-17 17:27:05 +03:00
Joonas Koivunen
f71c212edd chore: fmt and clippy warnings 2020-06-17 17:27:05 +03:00
Joonas Koivunen
948eeff48f refactor: rename FileMetadata to ipfs_unixfs::Metadata 2020-06-17 17:27:05 +03:00
Joonas Koivunen
9b18427e16 refactor: move ipfs_unixfs::dir::walk to top level 2020-06-17 17:27:05 +03:00
Joonas Koivunen
d61b0424d8 fix: use errors instead of unwraps in /get as well 2020-06-17 17:27:05 +03:00
Joonas Koivunen
7feededa81 fix: refs must use new ipfspath.follow_dagpb_data 2020-06-17 17:27:05 +03:00
Joonas Koivunen
3da2bc7028 fix: last cat conformance test failure 2020-06-17 17:27:05 +03:00
Joonas Koivunen
07ae552634 doc: add comments to tar export 2020-06-17 17:27:05 +03:00
Joonas Koivunen
cbd2d4a992 feat: add follow_dagpb_data option to ipfspath 2020-06-17 17:27:05 +03:00
Joonas Koivunen
8ada8370c4 fix: get walking interop tests to complete 2020-06-17 17:27:05 +03:00
Joonas Koivunen
6671e74113 feat: /get http endpoint
does not at all pass any tests. we need to add a root path param, which
will be a string version of the requested Cid for the http api. Also,
with this, it becomes possible to hide everything (files, symlinks)
under a single walk api.
2020-06-17 17:26:39 +03:00
Joonas Koivunen
169be7b562 refactor: extract special dagpb handling out 2020-06-11 19:10:46 +03:00
Joonas Koivunen
38e41ff79d
Apply suggestions from code review
Forgot this from the first batch..

Co-authored-by: ljedrz <ljedrz@users.noreply.github.com>
2020-06-11 19:09:47 +03:00
Joonas Koivunen
d5be60249c
Apply suggestions from code review
Co-authored-by: ljedrz <ljedrz@users.noreply.github.com>
2020-06-11 18:55:02 +03:00
Joonas Koivunen
38b7e4bd61 doc: add comments for the long function 2020-06-11 17:20:19 +03:00
Joonas Koivunen
6102488e23 chore: cargo fmt 2020-06-11 16:54:05 +03:00
Joonas Koivunen
31b30cddf5 fix: load the block always on walk_paths
this was a curious bug: to pass the test on interface-ipfs-core we need
to be still loading the first block and we must not be on the stream
phase. apparently the http cancellation works differently depending on
whether any response headers have been sent or not as the test fails if
the headers and cancelled error is sent.

the issue of returning either an loaded raw block or possibly projected
Ipld value was solved by introducing yet another enum Loaded. I did
consider `Either` from crate either, and `Result<Box<[u8]>, Ipld>` but
the custom enum at least allows us to write a documentation story what
the alternatives represent.
2020-06-11 16:48:43 +03:00
Joonas Koivunen
2d99d1aed2 fix: adjust default log levels with the addition of a crate 2020-06-11 16:48:20 +03:00
Joonas Koivunen
5fed9c5220 chore: cargo fmt 2020-06-11 13:45:57 +03:00
Joonas Koivunen
b65f6b7590 fix: handle corner case gracefully in walk_path
also: the walk_path should become ipfs::resolve(IpfsPath).
2020-06-11 13:44:57 +03:00
Joonas Koivunen
da7f2b4882 fix: get dag tests passing again
the remaining issue is how to handle the path resolving for the ugly
error mangling case...
2020-06-11 13:03:40 +03:00
Joonas Koivunen
392840c0ad chore: cargo fmt 2020-06-10 20:32:58 +03:00