-
Notifications
You must be signed in to change notification settings - Fork 279
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
remove transactions copy #447
remove transactions copy #447
Conversation
120d9cd
to
d73377c
Compare
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.
Generally, shared objects should be const
so that they would not change when not expected to. I would like to keep shared pointer to const block in the interfaces. The change you make does not demand the interface to use non-const shared block.
IMHO, what is wrong here is the block creator (fetch
method) creating a const
object. To be consistent with my first point, this producer should rather create a non-const unique pointer, and if the component that gets this block needs to share it, it is responsible for making it a shared const. If it does not need to share, then it has a non-const block that it can move
transactions from without any risk of messing someone other's view.
irohad/ametsuchi/block_storage.hpp
Outdated
std::shared_ptr<shared_model::interface::Block>> | ||
fetch(shared_model::interface::types::HeightType height) = 0; |
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.
std::shared_ptr<shared_model::interface::Block>> | |
fetch(shared_model::interface::types::HeightType height) = 0; | |
std::unique_ptr<shared_model::interface::Block>> | |
fetch(shared_model::interface::types::HeightType height) const = 0; |
irohad/ametsuchi/block_storage.hpp
Outdated
@@ -53,7 +53,7 @@ namespace iroha { | |||
/** | |||
* Iterates through all the stored blocks | |||
*/ | |||
virtual void forEach(FunctionType function) const = 0; | |||
virtual void forEach(FunctionType function) = 0; |
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.
virtual void forEach(FunctionType function) = 0; | |
virtual void forEach(FunctionType function) const = 0; |
bb80a3e
to
790e75a
Compare
aeeb3f6
to
0f2863c
Compare
a8ccf81
to
044a412
Compare
Signed-off-by: iceseer <iceseer@gmail.com>
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
044a412
to
d3c6323
Compare
Signed-off-by: iceseer iceseer@gmail.com
Description of the Change
Performance fix.
Benefits
Possible Drawbacks
Usage Examples or Tests [optional]
Alternate Designs [optional]