Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Implement and integrate Rust block store #1885

Merged
merged 8 commits into from
Oct 2, 2018

Conversation

aludvik
Copy link

@aludvik aludvik commented Sep 28, 2018

Replaces the Python implementation of the blockstore with a pure Rust implementation, dubbed the CommitStore to be consistent with the naming scheme used by the BlockManager API.

@aludvik aludvik force-pushed the use-rust-blockstore branch from 83d20c7 to 51c0225 Compare October 1, 2018 15:44
Adam Ludvik added 7 commits October 1, 2018 09:47
This is required to debug certain FFI and threading issues and should be one by
default to save time.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
Move this code to the Python FFI module and make it more general purpose.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
Rewrite the Python blockstore in Rust.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
Replace the Python blockstore with the Rust blockstoer.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
These are not used.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
The FFI layer was no longer required and the ChainController can access the
CommiStore directly now.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
The Rust blockstore only exposes those FFI methods required by client handlers,
and these methods are already covered by the client request handlers.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
DictDatabase no long works with BlockStore, so we need to replace its usage.

Signed-off-by: Adam Ludvik <ludvik@bitwise.io>
@aludvik aludvik force-pushed the use-rust-blockstore branch from 4ade52d to aa4e3ea Compare October 1, 2018 21:49
let gil = Python::acquire_gil();
let py = gil.python();
let py_block_store = PyBlockStore::new(PyObject::from_borrowed_ptr(py, block_store));
let commit_store = Box::from_raw(commit_store as *mut CommitStore);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you use from_raw/into_raw here? Why don't you just use the pointer?

Copy link
Author

Choose a reason for hiding this comment

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

I don’t have a good reason for not just using the pointer. I thought I needed to do from_raw/into_raw to get the clone to work right, but I was confused.

Copy link
Contributor

@peterschwarz peterschwarz Oct 2, 2018

Choose a reason for hiding this comment

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

There are lot's of examples of this in chain_ffi.rs , including a call to clone

Copy link
Author

Choose a reason for hiding this comment

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

The thing that threw me off is the type expected by add_store() is Box<BlockStore>, not CommitStore, so you can't do (*(commit_store as *mut CommitStore)).

Copy link
Author

Choose a reason for hiding this comment

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

I am changing my mind again. Trying to do (*(commit_store as *mut Box<CommitStore>)) is bad, causes a seg fault, so I think I do need the from_raw/into_raw.

@aludvik aludvik merged commit 32bdaa1 into hyperledger-archives:master Oct 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants