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

guarantee mutually exclusive access to persisted state #358

Closed
btc opened this issue Nov 17, 2014 · 5 comments
Closed

guarantee mutually exclusive access to persisted state #358

btc opened this issue Nov 17, 2014 · 5 comments
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature

Comments

@btc
Copy link
Contributor

btc commented Nov 17, 2014

As part of its normal operation, IPFS persists these items to disk:

  • logs in IPFS_DIR/logs/
  • a configuration file as IPFS_DIR/config
  • a leveldb datastore in IPFS_DIR/datastore/

Collectively, we refer to these as the repo.

issue
We wish to ensure that access to these resources is granted to just one process at a time.

While different mechanisms could be used to enforce mutually-exclusive access for each of the three resources, it may be simpler to provide a common mechanism to cover them all.

proposal
A good first step is to repurpose the daemon.Lock (lock file) as a repo.Lock or a resource.Lock.

NB: This doesn't provide guarantees against callers who sidestep the Lock and go after the resources directly.

@btc btc added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue labels Nov 17, 2014
@jbenet
Copy link
Member

jbenet commented Nov 17, 2014

Collectively, we refer to these as the repo.

Yeah we have been using this. do we want to continue? is there a better word?

The proposal SGTM. 👍

@btc
Copy link
Contributor Author

btc commented Nov 18, 2014

Repo SGTM

@dborzov
Copy link
Contributor

dborzov commented Nov 23, 2014

@maybebtc , 👍 good points here.

It seems that currently @jbenet is locking a token file IPFS_DIR/config/deamon.lock as a flag that the repo is "loaded" and in use: https://github.com/jbenet/go-ipfs/blob/91fe0d953408c6d7656ac02b17f65f110780cb31/core/daemon/daemon.go#L15 .

Are you suggesting locking everything within IPFS-DIR altogether? Or is it about moving it from the deamon to initialization check for every running instance?

BTW, evidently using deamon.lock as the flag token file is the fallback behaviour for non-Unix systems for github.com/camlistore/lock already :)

@btc
Copy link
Contributor Author

btc commented Nov 23, 2014

Are you suggesting locking everything within IPFS-DIR altogether? Or is it about moving it from the deamon to initialization check for every running instance?

using one mechanism to manage all items in IPFS_DIR

@jbenet
Copy link
Member

jbenet commented Jan 15, 2015

@briantigerchow i believe this can be closed now? reopen if not.

@jbenet jbenet closed this as completed Jan 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants