Skip to content
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

database: Introduce v2 module. #1799

Merged
merged 5 commits into from
Jul 23, 2019
Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jul 22, 2019

In order to make use of dcrutil/v2, a new major version of the database module is required because database/v1 accepts and returns types from dcrutil/v1 in its API.

Since a new major version is required, this also takes the opportunity break the tight coupling with dcrutil by introducing a new BlockSerializer interface and accepting it instead of *dcrutil.Block in the database interface API.

Consequently, this introduces database/v2 which addresses the aforementioned items. A series of individual commits is provided to make the review process easier. Each commit message more thoroughly describes its purpose, but primarily they consist of the following:

  • Freeze version 1 of the database module
  • Remove the root module database override so building the software will still produce binaries based on the v1 module until the v2 module is fully released
  • Introduce a new BlockSerializer interface that is limited specifically to ability to obtain the hash and serialization of a block and update the StoreBlock method that previously accepted *dcrutil.Block to use the new interface instead
  • Update to use dcrutil/v2@v2.0.0
  • Bump the module version to v2
  • Update all examples, tests, internal imports, and the dbtool utility to import database/v2
  • Update docs for the new module version

Finally, it should also be noted that this only introduces the new module and does not update anything to make use of it yet, so building the software will still produce binaries based on the v1 module.

@davecgh davecgh added this to the 1.5.0 milestone Jul 22, 2019
This serves as the final release of version 1 of the database module.
All future releases will be moving to version 2 of the module.

Consequently, it removes the database override in the root module and
updates it so building the software will still produce binaries based on
the v1 module until the v2 module is fully released.
This introduces a new interface named BlockSerializer and updates the
functions that currently take a pointer to a dcrutil.Block struct to
accept the interface instead.

This removes the tight coupling between the two packages at the API
boundary and allows callers to easily provide custom values.

Since the interface is already implemented by dcrutil.Block, no further
changes to the code or tests is needed.
This updates the database module to use v2 of the dcrutil module.
@davecgh davecgh force-pushed the database_introduce_v2 branch 2 times, most recently from ff0ca73 to 1e6129f Compare July 23, 2019 00:46
This updates the docs/README.md file, module hierarchy graphviz, and
module hierarchy diagram to reflect the new module version
@davecgh davecgh merged commit 99d7b17 into decred:master Jul 23, 2019
@davecgh davecgh deleted the database_introduce_v2 branch July 23, 2019 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants