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

Use LDBVersionedStore for wallet also #1011

Merged
merged 25 commits into from
Dec 27, 2019
Merged

Use LDBVersionedStore for wallet also #1011

merged 25 commits into from
Dec 27, 2019

Conversation

kushti
Copy link
Member

@kushti kushti commented Dec 23, 2019

This PR builds on top #969 . In addition the PR #969 , this one is using LDBVersionedStore for wallet registry as well. Old class VersionedLDBKVStore currently is used in benchmarks only , and to be removed.

Some ByteArrayWrapper usages eliminated as well, and IODB with ByteArrayWrapper are to be removed in next versions as well.

@kushti kushti added the S-wip Status: Work in progress label Dec 23, 2019
@kushti kushti changed the base branch from master to develop December 24, 2019 11:43
@kushti kushti changed the title Db rework Use LDBVersionedStore for wallet also Dec 24, 2019
Copy link
Member

@greenhat greenhat left a comment

Choose a reason for hiding this comment

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

LGTM

avldb/build.sbt Show resolved Hide resolved
def get(key: K): Option[V] = {
lock.readLock().lock()
val res = Option(db.get(key))
lock.readLock().unlock()
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be protected with try {..} finally { ... } section?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed



/**
* Iterate through the database to read elements according to a filter function
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Iterate through the database to read elements according to a filter function
* Iterate through the database to read elements according to a filter function.
* The method first load filtered data in memory and then returns an iterator over them.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

}

/**
* Read all the database elements
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Read all the database elements
* Read all the database elements.
* The elements are first loaded in memory and then returned as the iterator.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

*
* Finds all keys from given iterable.
* Result is returned in an iterable of key-value pairs.
* If key is not found, null value is included in result pair.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* If key is not found, null value is included in result pair.
* If key is not found, None value is included in result pair.

/**
* Registry of opened LevelDB instances.
* LevelDB prohibit access to the same storage file from more than one DB instance.
* And ergo application (mostly tests) quite frequently doesn't not explicitly close
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* And ergo application (mostly tests) quite frequently doesn't not explicitly close
* And ergo application (mostly tests) quite frequently doesn't close explicitly

Copy link
Member Author

Choose a reason for hiding this comment

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

explicitly close is a perfect word order

Copy link
Member

Choose a reason for hiding this comment

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

I don't get the meaning of the sentence in this case.

lock.writeLock().lock()
try {
add(path, factory.open(path, options))
} catch {
Copy link
Member

Choose a reason for hiding this comment

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

Fix formatting and identation

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@kushti
Copy link
Member Author

kushti commented Dec 26, 2019

@aslesarenko thanks for the comments, I've addressed all of them!

@kushti kushti merged commit fe9edd6 into develop Dec 27, 2019
@kushti kushti deleted the db_rework branch December 27, 2019 14:41
@kushti kushti mentioned this pull request Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-wip Status: Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants