-
Notifications
You must be signed in to change notification settings - Fork 795
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
Unchecked cleanup #3600
Unchecked cleanup #3600
Conversation
…d_ptr<nano::block> upcast. This allows it to be implicitly convertible to nano::unchecked_info through a conversion-constructor.
Since the hash in unchecked_key must always match the block hash of the block in unchecked_info, put don't directly accept unchecked_key values and instead infers it from the block in unchecked_info directly. Only the dependency needs to be passed in.
…ally ordered instead of totally ordered which doesn't match lmdb behavior. It's not established this has a performance impact and this table is a candidate for using a disk based hash table for superior performance as it doesn't need atomic guarantees.
…unction nano::unchecked_store::equal_range which returns a pair of iterators covering keys equal to the given dependency.
… iterators covering all items in the unchecked store.
@@ -352,7 +352,7 @@ TEST (bootstrap, simple) | |||
nano::logger_mt logger; | |||
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); | |||
ASSERT_TRUE (!store->init_error ()); | |||
auto block1 (std::make_shared<nano::send_block> (0, 1, 2, nano::keypair ().prv, 4, 5)); | |||
std::shared_ptr<nano::block> block1 = std::make_shared<nano::send_block> (0, 1, 2, nano::keypair ().prv, 4, 5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clean up looks good, but since you touched the lines anyway, why not auto block = std::make_shared...
? Not really important but just in the spirit of if cleaning it up, clean it all the way
:D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one specifically is because std::shared_ptrnano::send_block won't implicitly convert to unchecked_info when passed to unchecked_store::put. It won't do an upcast and also an implicit conversion.
send5->signature.bytes[31] ^= 0x1; | ||
auto signature = send5->block_signature (); | ||
signature.bytes[31] ^= 0x1; | ||
send5->signature_set (signature); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's more clean to get the signature, touch it, then set it back, but was there a functional problem with changing it in-place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're holding a pointer to nano::block instead of the specific block type, the signature field is no longer directly accessible.
Looks good to me; also, reviewing commits individually turned out to be really helpful, so I recommend that other reviewers do that. |
This is a series of commits in preparation for adding the unchecked_map ADT.
Each commit is best reviewed individually.