Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Conversation

@peterschwarz
Copy link
Contributor

@peterschwarz peterschwarz commented Jun 10, 2021

This PR adds an implementation of state that applies a Merkle-Radix tree using a SQL database as its back-end. This PR includes a diesel/SQLite implementation

Experimental feature implementation of RFC 10

@peterschwarz peterschwarz self-assigned this Jun 10, 2021
@peterschwarz peterschwarz force-pushed the pschwarz-sql-merkle-state branch 8 times, most recently from 2029efd to 89d018a Compare June 14, 2021 16:47
@peterschwarz peterschwarz marked this pull request as ready for review June 14, 2021 16:49

/// Set the path for the Sqlite database.
///
/// This is a require field.
Copy link
Contributor

Choose a reason for hiding this comment

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

require => required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@peterschwarz peterschwarz force-pushed the pschwarz-sql-merkle-state branch from 89d018a to ec07fe7 Compare June 14, 2021 21:33
@peterschwarz peterschwarz requested a review from agunde406 June 14, 2021 21:34
agunde406
agunde406 previously approved these changes Jun 15, 2021
Caleb-Hill
Caleb-Hill previously approved these changes Jun 17, 2021
@peterschwarz peterschwarz dismissed stale reviews from Caleb-Hill and agunde406 via de4edd5 June 17, 2021 22:21
@peterschwarz peterschwarz force-pushed the pschwarz-sql-merkle-state branch from ec07fe7 to de4edd5 Compare June 17, 2021 22:21
agunde406
agunde406 previously approved these changes Jun 18, 2021
Caleb-Hill
Caleb-Hill previously approved these changes Jun 21, 2021
///
/// This struct provides the backend implementation details for SQLite databases.
#[derive(Clone)]
pub struct Sqlite {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be called SqliteBackend, being the primary purpose is an impl of Backend for sqlite?

Copy link
Contributor Author

@peterschwarz peterschwarz Jun 21, 2021

Choose a reason for hiding this comment

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

I was mirroring the diesel back-end naming convention. I would be open to changing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@peterschwarz peterschwarz dismissed stale reviews from Caleb-Hill and agunde406 via c172af9 June 21, 2021 16:28
@peterschwarz peterschwarz force-pushed the pschwarz-sql-merkle-state branch from de4edd5 to c172af9 Compare June 21, 2021 16:28
This commit introduces the transact-specific Backend and Connection
trait, that can be used for SQL implementations. These traits help to
minimize the exposure of dependencies to the transact public API.

The SqliteBackend includes a builder and a set of enums for configuring
the connection pool instance.

Signed-off-by: Peter Schwarz <pschwarz@bitwise.io>
This change includes a MigrationManager trait in order to provide
migration capabilities to a Backend.  It also includes an implementation
for SqliteBackend.

Signed-off-by: Peter Schwarz <pschwarz@bitwise.io>
This struct provides the SQL implementation of MerkleState, via the
state::Read, Write traits, as well as the MerkleRadixLeafReader trait.

Likewise, the integration tests have been added for this implementation.
This includes a new test that allows for comparisons between MerkleState
implementations only using the Read and Write traits.

It omits the state::Prune trait for now (this will be implemented in a
future commit).

Signed-off-by: Peter Schwarz <pschwarz@bitwise.io>
@peterschwarz peterschwarz force-pushed the pschwarz-sql-merkle-state branch from c172af9 to 6efc3a8 Compare June 23, 2021 20:47
@agunde406 agunde406 self-requested a review June 23, 2021 21:00
@peterschwarz peterschwarz merged commit bdf16a2 into hyperledger-archives:main Jun 24, 2021
@peterschwarz peterschwarz deleted the pschwarz-sql-merkle-state branch June 24, 2021 14:57
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.

4 participants