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

coreunix.Add is documented to pin objects but it doesn't #3470

Closed
zaibon opened this issue Dec 5, 2016 · 2 comments
Closed

coreunix.Add is documented to pin objects but it doesn't #3470

zaibon opened this issue Dec 5, 2016 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/docs-ipfs Topic docs-ipfs
Milestone

Comments

@zaibon
Copy link

zaibon commented Dec 5, 2016

Version information:

go-ipfs version: 0.4.4-
Repo version: 4
System version: amd64/linux
Golang version: go1.7

Type: Bug

Priority: P5

Description:

The documentation of the coreunix.Add method claims to pin the object to the local data store but it doens't seem to do so.

After adding a file using :

// r is a reader from a file
hash, err := coreunix.AddWithContext(ctx, service.node, r)
if err != nil {
	panic("error adding file")
}
fmt.Println(hash)

I'm trying to make sure the object is pinned using ipfs pin ls but this command returns nothing
I can cat the file with ipfs cat <hash> but after doing ipfs repo gc
trying to cat the file again fails with Error: merkledag: not found which proof the object was not pinned

@Kubuxu Kubuxu assigned ghost Dec 5, 2016
@Kubuxu Kubuxu added this to the ipfs 0.4.5 milestone Dec 5, 2016
@Kubuxu Kubuxu added kind/bug A bug in existing code (including security flaws) need/review Needs a review status/ready Ready to be worked and removed need/review Needs a review labels Dec 5, 2016
@zaibon zaibon changed the title coreunix.Add is document that is pin object but it doesn't coreunix.Add is documented to pin objects but it doesn't Dec 5, 2016
@whyrusleeping
Copy link
Member

Oh, AddWithContext should be calling adder.PinRoot().

@ghost ghost added the topic/docs-ipfs Topic docs-ipfs label Dec 8, 2016
@ghost
Copy link

ghost commented Dec 8, 2016

So, the coreunix.Add*() functions used to pin before 0.4.0, but in the huge overhaul of add, importer, pinning, and with the introduction of GC, it was decided the default behaviour on the library layer should be to not pin. Only the CLI and (under certain circumstances) end-user apps should pin by default.

The documentation simply slipped through, so thanks for catching that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/docs-ipfs Topic docs-ipfs
Projects
None yet
Development

No branches or pull requests

3 participants