* Problem: `ValidatorElection` and `MigrationElection` need to inherit from a common `Election` class. Solution: Factored the common logic out of `ValidatorElection` and moved it to `Election` parent class. * Problem: No need to store different types of elections in their own tables Solution: Remove `DB_TABLE` property from `Election` class. Solution: Created the `elections` table with secondary_index `election_id`. * Problem: `UpsertValidatorVote` can be generalized to just be `Vote` Solution: Renamed, refactored and moved the `Vote` class to tie in with the more general `Election` base class. * Problem: `election_id` is not unique if two elections have the same properties. Solution: Added a random `uuid4` seed to enforce uniqueness.
Overview
A high-level description of the files and subdirectories of BigchainDB.
Files
lib.py
The BigchainDB class is defined here. Most node-level operations and database interactions are found in this file. This is the place to start if you are interested in implementing a server API, since many of these class methods concern BigchainDB interacting with the outside world.
models.py
Block, Transaction, and Asset classes are defined here. The classes mirror the block and transaction structure from the documentation, but also include methods for validation and signing.
consensus.py
Base class for consensus methods (verification of votes, blocks, and transactions). The actual logic is mostly found in transaction and block models, defined in models.py.
processes.py
Entry point for the BigchainDB process, after initialization. All subprocesses are started here: processes to handle new blocks, votes, etc.
config_utils.py
Methods for managing the configuration, including loading configuration files, automatically generating the configuration, and keeping the configuration consistent across BigchainDB instances.
Folders
commands
Contains code for the CLI for BigchainDB.
db
Code for building the database connection, creating indexes, and other database setup tasks.