NDRS-76: add LMDB storage implementation#21
Conversation
| + Send | ||
| + Sync; |
There was a problem hiding this comment.
Just an idea: if something is Clone and Copy why does it have to be also Send and Sync? Wouldn't it be simpler to just clone it?
There was a problem hiding this comment.
The Clone and Copy traits are somewhat orthogonal to Send and Sync. The latter are just "marker traits" - they don't really do anything except indicate the implementing type can be safely sent or shared between threads (see https://doc.rust-lang.org/nomicon/send-and-sync.html for a better explanation than my effort!)
There was a problem hiding this comment.
Yes, I am aware of that. I just thought that as a caller you could decide how to do it. My reasoning was that if you copy the value every time it's sent between threads then you don't need Send but maybe that's precisely what Send would do/decide. I will re-read the nomicon. Thans.
| type Block: Value; | ||
| type Deploy: Value; |
There was a problem hiding this comment.
What's the reason for making a single point of access to deploy and block storage?
There was a problem hiding this comment.
It's really to have a single point of access to all storage pieces. The storage component will manage all aspects of storage, which is important mostly in the case of on-disk storage.
We made the design decision a while back since it seems like the best way handle things like managing disk usage, and having fewer IO components (where an IO component has a need to break from the normal component paradigm since its operations can be blocking for an unacceptably long period)
|
|
||
| #### List stored `Deploy`s | ||
|
|
||
| To get a list of all stored `Deploy`s' hashes: |
There was a problem hiding this comment.
This is just for PoC right?
There was a problem hiding this comment.
I would think so, I certainly put it in for that reason. If it were to remain, it'd need some work (e.g. to handle larger responses)
src/components/api_server.rs
Outdated
| hex_hashes.push(','); | ||
| } | ||
| } | ||
| hex_hashes.push(']'); |
There was a problem hiding this comment.
Can't serde(-json) do this for you?
There was a problem hiding this comment.
Unfortunately, it won't encode binary data as hex, so if I were to use serde_json, I'd need to first convert the Vec<DeployHash> to Vec<String>, and use serde_json on that vec. I didn't think it was worth the effort to use serde_json for that, but looking at it with fresh eyes, it might be worthwhile. I'll try it.
…urses Do not create temporary purses during distribute
CI: hardcode protocol 1 to 1.4.5
reactor/tests: add tests for burning fees
* Add serde-types feature * Update format conventions for Cargo.toml
changing ordering logic
# This is the 1st commit message: Initial wip # The commit message #2 will be skipped: # Basic case working. Pre-fixture tests # The commit message #3 will be skipped: # Initial fixture tests passing # The commit message #4 will be skipped: # Test case passing for disabled versions # The commit message #5 will be skipped: # EE tests passing # The commit message #6 will be skipped: # Additional fixture tests and PR prep # The commit message #7 will be skipped: # Run make format # The commit message #8 will be skipped: # X # The commit message #9 will be skipped: # X # The commit message casper-network#10 will be skipped: # X # The commit message casper-network#11 will be skipped: # X # The commit message casper-network#12 will be skipped: # Add flag to engine config to return error # The commit message casper-network#13 will be skipped: # Add flag to chainspec.toml # The commit message casper-network#14 will be skipped: # Address CI issues # The commit message casper-network#15 will be skipped: # Add contract runtime tests # The commit message casper-network#16 will be skipped: # rebasing with darthsiroftardis/change-package-version-calls # The commit message casper-network#17 will be skipped: # fmt fix # The commit message casper-network#18 will be skipped: # fmt fix # The commit message casper-network#19 will be skipped: # fmt fix # The commit message casper-network#20 will be skipped: # refactoring put_key contract # The commit message casper-network#21 will be skipped: # refactoring put_key contract # The commit message casper-network#22 will be skipped: # X
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip # The commit message casper-network#30 will be skipped: # wip # The commit message casper-network#31 will be skipped: # wip # The commit message casper-network#32 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip # The commit message casper-network#30 will be skipped: # wip # The commit message casper-network#31 will be skipped: # wip # The commit message casper-network#32 will be skipped: # wip # The commit message casper-network#33 will be skipped: # wip # The commit message casper-network#34 will be skipped: # wip # The commit message casper-network#35 will be skipped: # wip # The commit message casper-network#36 will be skipped: # wip # The commit message casper-network#37 will be skipped: # wip # The commit message casper-network#38 will be skipped: # wip # The commit message casper-network#39 will be skipped: # wip # The commit message casper-network#40 will be skipped: # rebasing
Note: This PR is based on top of #20, so that should ideally be reviewed and merged first. Only the final four commits of this PR are not included in #20.
This PR adds the LMDB storage implementation along with corresponding config options. There is a separate LMDB environment for each of the separate types of store (Block and Deploy).
It also includes a simplification of the storage component by merging the discrete internal error types into a single storage
Errorenum, and by changing theStorageTypetrait's associated types fromStore<T>toT.Finally, it also adds a new HTTP endpoint to allow the client to receive a list of hashes of all stored deploys.