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

Ability to pin ipns names #1467

Open
reit-c opened this Issue Jul 11, 2015 · 11 comments

Comments

Projects
None yet
8 participants
@reit-c
Copy link

reit-c commented Jul 11, 2015

It would be very nice to be able pin IPNS names, such that the daemon periodically polls the DHT to find if there are any new hashes published to the requested names, and then automatically pins them if so.

Depending on the structure of the code (I'm not familiar with Go), this may be a simple matter of creating a new thread to sit in a loop that does

while(running){
  for each (name in pinned_names){
    new_hash = resolve(name)
    if(new_hash != last_good_known[name]){
      pin(new_hash)
      unpin(last_good_known[name])
      last_good_known[name] = new_hash
    }
  }
  sleep(something_sensible)
}

This would make it very easy to use IPFS as a backup solution, either to create a mirror of your website on another of your servers, or to make general backups to a remote machine (e.g. passworded duplicity backups would work quite well here).

Note that there should be some way within the command line syntax to allow the user to include a '-r' recursive pin/unpin option, for distinguishing if the user wants to pin a single node or the entire tree. Possible syntax could be something like ipfs pin name add -r .

@whyrusleeping

This comment has been minimized.

Copy link
Member

whyrusleeping commented Jul 11, 2015

I've been thinking a little bit about this recently, and what my current train of thought is, is that once we implement pub-sub, updating an ipns entry will be a 'publish' that people can subscribe to, so they can be notified of every time it gets updated and then update the pin.

@fazo96

This comment has been minimized.

Copy link

fazo96 commented Nov 27, 2015

@whyrusleeping is it planned for the pin command to take an IPNS name and automatically pin the address pointed by the name and automatically unpin the old adress and pin the new one when the record is updated?

I think this has many usecases and should be taken into consideration, not sure about how hard it would be to implement but it doesn't look like it would need much except pub/sub.

@whyrusleeping

This comment has been minimized.

Copy link
Member

whyrusleeping commented Nov 27, 2015

@fazo96 yeah, something along those lines is planned. The issue is when to check for updates, its either polling or pubsub, and I really am not a fan of polling.

@lidel

This comment has been minimized.

Copy link
Contributor

lidel commented Jan 6, 2016

Right now when I try to pin IPNS path it just.. hangs and needs to be interrupted via Ctrl+C:

$ ipfs-node ipfs pin add /ipfs/QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/example
pinned QmeKozNssnkJ4NcyRidYgDY2jfRZqVEoRGfipkgath71bX recursively

$ ipfs-node ipfs pin add /ipns/ipfs.git.sexy
^C

At this point it is not possible to pin anything else and I need to restart go-ipfs daemon to fix pinning functionality.

I think pinning a valid IPNS address should immediately return an error (Error: pin: IPNS not implemented yet), just like it does for invalid ones:

$ ipfs pin add /ipns/invalid.one
Error: pin: could not resolve name.
@palkeo

This comment has been minimized.

Copy link
Contributor

palkeo commented Feb 20, 2016

Hey. I'm also interested by that.

But do you think that pub-sub would be able to solve all the problem by itself ? If I pin an IPNS name, turn my node off and go back 10 days later, my node should do polling to poll for the last version of the content too as it may have missed pub/sub updates.
Maybe something hybrid, where I could do either polling, pubsub, or both ?

@mildred

This comment has been minimized.

Copy link
Contributor

mildred commented Jan 3, 2018

Probably related issue: #4435

@NiKiZe

This comment has been minimized.

Copy link

NiKiZe commented Jul 23, 2018

Is it true that trying to pin ipns path currently hangs, and also causes the daemon to not accept more pins, if so could we get a fix in that returns an error instead, or at least a warning? (that would avoid noobs like me spending lots of time wondering why/how pinning works and why it seems to hang) Thanks!

@whyrusleeping

This comment has been minimized.

Copy link
Member

whyrusleeping commented Jul 23, 2018

@NiKiZe pinning is a blocking operation, it fetches the data while holding the pin lock to ensure a garbage collection doesnt come along and wipe out the transfer progress. Because of this, while one thing is being pinned, another can't be pinned in the meantime.

We have plans on improving this moving forward

@Stebalien

This comment has been minimized.

Copy link
Contributor

Stebalien commented Jul 23, 2018

The pin lock is a read-write lock. This shouldn't be an issue (and I can't reproduce). The bug in question was reported before the pin lock was even introduced.

@Stebalien

This comment has been minimized.

Copy link
Contributor

Stebalien commented Jul 23, 2018

@whyrusleeping pointed out that there is a different lock.

@NiKiZe

This comment has been minimized.

Copy link

NiKiZe commented Jul 23, 2018

My bad, pinning with /ipns/ seems to work, just (as explained why above) seemingly unresponsive, Thanks and sorry for the noise. (Looking forward to the ability to pin ipns and have it auto update)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment