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

Add locking interface to blockstore #1453

Merged
merged 6 commits into from
Jul 9, 2015
Merged

Add locking interface to blockstore #1453

merged 6 commits into from
Jul 9, 2015

Conversation

whyrusleeping
Copy link
Member

The addition of a locking interface to the blockstore allows us to
perform atomic operations on the underlying datastore without having to
worry about different operations happening in the background, such as
garbage collection.

Also implement a few merkledag package changes.

License: MIT
Signed-off-by: Jeromy [email protected]

The addition of a locking interface to the blockstore allows us to
perform atomic operations on the underlying datastore without having to
worry about different operations happening in the background, such as
garbage collection.

License: MIT
Signed-off-by: Jeromy <[email protected]>
This commit improves (fixes) the FetchGraph call for recursively
fetching every descendant node of a given merkledag node. This operation
should be the simplest way of ensuring that you have replicated a dag
locally.

This commit also implements a method in the merkledag package called
EnumerateChildren, this method is used to get a set of the keys of every
descendant node of the given node. All keys found are noted in the
passed in KeySet, which may in the future be implemented on disk to
avoid excessive memory consumption.

License: MIT
Signed-off-by: Jeromy <[email protected]>

if live == 0 {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

what is live used for? it's incorrect. it's not decremented and will never go below 1.

Copy link
Member Author

Choose a reason for hiding this comment

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

its correct. i guess i could make it clearer by turning live += len(keys) - 1 into live += len(keys) and live--

Copy link
Member

Choose a reason for hiding this comment

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

oh! yeah that's not clear.

@jbenet
Copy link
Member

jbenet commented Jul 8, 2015

3 comments above

License: MIT
Signed-off-by: Jeromy <[email protected]>
License: MIT
Signed-off-by: Jeromy <[email protected]>
License: MIT
Signed-off-by: Jeromy <[email protected]>
@jbenet
Copy link
Member

jbenet commented Jul 9, 2015

Final changes:

  • RLock -> PinLock
  • Lock -> GCLock

License: MIT
Signed-off-by: Juan Batiz-Benet <[email protected]>
@whyrusleeping
Copy link
Member Author

@jbenet this RFM?

@jbenet
Copy link
Member

jbenet commented Jul 9, 2015

I think so (rebase first?)

jbenet added a commit that referenced this pull request Jul 9, 2015
Add locking interface to blockstore
@jbenet jbenet merged commit d2fe6ff into dev0.4.0 Jul 9, 2015
@jbenet jbenet deleted the locking-blockstore branch July 9, 2015 17:33
@jbenet jbenet removed the status/in-progress In progress label Jul 9, 2015
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.

2 participants