Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap lobjs so they can be deduped w/ other IPFS objects, fixes #12 #21

Closed
wants to merge 1 commit into from

Conversation

sameer
Copy link

@sameer sameer commented Jan 4, 2019

This PR fixes #12 by splitting large objects into a header and raw data which are individually hashed then patched together for the lobj hash. I kept a fallback to just adding the entire object if the header can't be found.

I ran it against a repo, one 3.6MB lobj example is:

headerHash = QmddzD2eZgPcLHYku5DMFXgBXh8GPzPGr3SaBr4ioPuVDU
dataHash= QmTBDL8wuSbjF5eCzkwdPXA2sTiTNmwKtqUUkJTYWKWa4W
objectHash = QmURkbZP6hVdt4MAo9CBv4rJxNUA7x57UKgHtzxgpfY8Np

Not exactly sure how to add tests for this -- any guidance is appreciated.

Edit: tests seem to fail on macOS but I think it's unrelated.

@magik6k magik6k self-requested a review January 4, 2019 15:30
Copy link
Collaborator

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

1 small thing. A test or two would be nice too.

return err
}

dataHash, err := h.api.Add(bytes.NewReader(data[endOfHeader:]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two adds can run in parallel with sync.waitgroup (api calls can be slow, but can be heavily parallelized)

@sameer sameer force-pushed the lobj-wrap branch 2 times, most recently from 8b94056 to ca3d565 Compare January 7, 2019 18:37
@sameer
Copy link
Author

sameer commented Jan 7, 2019

So I added a lobj branch to the mock git repo with a file large enough to generate a lobj that would hit my changes on a push. However, IpnsHandler.Push() is not called because the testing never does an actual push. I will try to add a push test.

Edit: I misspoke, there is a push test, but the large object does not get sent because it's pushing refs/heads/master.

@sameer
Copy link
Author

sameer commented Jan 7, 2019

Discovered that the push tests were never actually run because there was a missing newline at the end of testCase(t, args, "push refs/heads/master:refs/heads/master\n", []string{}).

@magik6k
Copy link
Collaborator

magik6k commented Jan 8, 2019

Jenkins is broken in ipfs-shipyard for go projects, I'll try to work around it tomorrow if time permits

@sameer
Copy link
Author

sameer commented Jan 23, 2019

Looks like macOS is still failing:

[git-remote-ipld] Running shell script

+ go test -v ./...

+ tee output

/var/jenkins/workspace/pyard_git-remote-ipld_PR-21-BEUY3MIKEUQKTXCLQUO4RZM773OQDB3XCGN6CAIWBSB6ADFZOXKQ/src/github.com/ipfs shipyard/git-remote-ipld/cmd/git-remote-ipld/ipld.go:15:2: cannot find package "github.com/ipfs-shipyard/git-remote-ipld/core" in any of:

	/var/jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.11/src/github.com/ipfs-shipyard/git-remote-ipld/core (from $GOROOT)

	/var/jenkins/workspace/pyard_git-remote-ipld_PR-21-BEUY3MIKEUQKTXCLQUO4RZM773OQDB3XCGN6CAIWBSB6ADFZOXKQ/src/github.com/ipfs-shipyard/git-remote-ipld/core (from $GOPATH)

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

Successfully merging this pull request may close these issues.

Wrap big object data
2 participants