Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Iterate over both buffered and unbuffered database entries #6860

Closed
wants to merge 2 commits into from
Closed

Iterate over both buffered and unbuffered database entries #6860

wants to merge 2 commits into from

Conversation

efyang
Copy link
Contributor

@efyang efyang commented Oct 23, 2017

Closes #6048.

@parity-cla-bot
Copy link

It looks like @efyang hasn'signed our Contributor License Agreement, yet.

The purpose of a CLA is to ensure that the guardian of a project's outputs has the necessary ownership or grants of rights over all contributions to allow them to distribute under the chosen licence.
Wikipedia

You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io

Once you've signed, plesae reply to this thread with [clabot:check] to prove it.

Many thanks,

Parity Technologies CLA Bot

@efyang
Copy link
Contributor Author

efyang commented Oct 23, 2017

[clabot:check]

@parity-cla-bot
Copy link

It looks like @efyang signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

match *self.db.read() {
Some(DBAndColumns { ref db, ref cfs }) => {
let overlay = &self.overlay.read()[Self::to_overlay_column(col)];
let overlay_data = overlay.iter()
.filter_map(|(k, v)| match v {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use match * instead of prefixing every option with &:

match *v {
  KeyState::Insert(ref value) => {
}

&KeyState::InsertCompressed(ref value) =>
Some((k.clone().into_vec().into_boxed_slice(), value.clone().into_vec().into_boxed_slice())),
&KeyState::Delete => None,
}).collect::<Vec<_>>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need to allocate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm having trouble finding some other way to convert elasticarray's to boxed slices.

@keorn keorn added the A0-pleasereview 🤓 Pull request needs code review. label Oct 23, 2017
@5chdn 5chdn added the M4-core ⛓ Core client code / Rust. label Oct 23, 2017
@5chdn 5chdn added this to the 1.9 milestone Oct 23, 2017
match *self.db.read() {
Some(DBAndColumns { ref db, ref cfs }) => {
let overlay = &self.overlay.read()[Self::to_overlay_column(col)];
let overlay_data = overlay.iter()
Copy link
Contributor

Choose a reason for hiding this comment

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

hashmap iterators aren't ordered, so interleave-ordered behavior probably won't be right there.

@@ -536,7 +547,7 @@ impl Database {
.expect("iterator params are valid; qed"));

Some(DatabaseIterator {
iter: iter,
iter: interleave_ordered(Vec::new(), iter),
Copy link
Collaborator

Choose a reason for hiding this comment

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

it should use std::iter::empty instead of Vec::new

Copy link
Collaborator

Choose a reason for hiding this comment

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

nvm, I see that types would not match

@debris
Copy link
Collaborator

debris commented Nov 13, 2017

merged and reopened on top of latest master in #7048

@debris debris closed this Nov 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants