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

[utils] Add MutexMap #246

Merged
merged 4 commits into from
Nov 23, 2020
Merged

[utils] Add MutexMap #246

merged 4 commits into from
Nov 23, 2020

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Nov 23, 2020

Related: https://github.com/coinbase/rosetta-sdk-go/tree/patrick/priority-lock

This PR implements a new data structure called a MutexMap. MutexMap allows the caller to acquire a global lock across any number of *PriorityMutex and to identify locks by some identifier (which enables very fine-grained locking). This data structure can be used to implement concurrent, non-conflicting database transactions in storage.

Changes

Future Work

In a subsequent PR, we will implement another new data structure called ShardedMap that removes the need to acquire a global lock on entries.

@coveralls
Copy link

coveralls commented Nov 23, 2020

Pull Request Test Coverage Report for Build 12021

  • 60 of 63 (95.24%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 79.007%

Changes Missing Coverage Covered Lines Changed/Added Lines %
utils/priority_mutex_map.go 52 55 94.55%
Totals Coverage Status
Change from base Build 11950: 0.09%
Covered Lines: 7734
Relevant Lines: 9789

💛 - Coveralls

yfl92
yfl92 previously approved these changes Nov 23, 2020
Copy link

@yfl92 yfl92 left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

4 participants