Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

decouple the DAG traversal logic from the DAG reader (local branch) #60

Merged
merged 4 commits into from
Jan 30, 2019

Conversation

magik6k
Copy link
Member

@magik6k magik6k commented Jan 28, 2019

This PR fixes some issues with #12 (I couldn't push there), also adds a fix for SeekEnd from ipfs/kubo#5934

@ghost ghost assigned magik6k Jan 28, 2019
@ghost ghost added the status/in-progress In progress label Jan 28, 2019
@magik6k magik6k changed the title Feat/dag reader/use walker decouple the DAG traversal logic from the DAG reader (local branch) Jan 28, 2019
@@ -472,7 +472,7 @@ func (dr *dagReader) Seek(offset int64, whence int) (int64, error) {
// searches in the `Walker` (see `Walker.Seek`).

case io.SeekEnd:
return dr.Seek(int64(dr.Size())-offset, io.SeekStart)
return dr.Seek(int64(dr.Size())+offset, io.SeekStart)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

io/dagreader.go Outdated Show resolved Hide resolved
Copy link
Contributor

@schomatis schomatis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k Thanks a lot (again!) for carrying this forward ❤️

schomatis and others added 4 commits January 30, 2019 00:27
Decouple the DAG traversal logic from the `PBDagReader` encapsulating it in the
(new) `Walker` structure.

Collapse PB and Buffer DAG readers into one (`dagReader`) removing the
`bufdagreader.go` and `pbdagreader.go` files, moving all the code to
`dagreader.go`.

Remove `TestSeekAndReadLarge` and `TestReadAndCancel` which operated directly on
the `NodePromise` structure that is now abstracted away in `NavigableIPLDNode`,
in the `go-ipld-format` repo, where they should be recreated.

License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
This version writes one node at a time instead of first buffering the entire
file contents in a single array (taking up too much memory) before actually
writing it.
@magik6k
Copy link
Member Author

magik6k commented Jan 30, 2019

I ran go-ipfs gotest+sharness with this applied and it passed. @Stebalien mind giving this one last look before merging?

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this is correctly replicating the current behavior.

@Stebalien Stebalien merged commit f0d9ddc into master Jan 30, 2019
@ghost ghost removed the status/in-progress In progress label Jan 30, 2019
@Stebalien
Copy link
Member

🚀 🎉

@Stebalien Stebalien deleted the feat/dag-reader/use-walker branch January 30, 2019 02:43
@schomatis
Copy link
Contributor

Thank you both @magik6k and @Stebalien!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants