mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix docstring rst errors in the backend modules
This commit is contained in:
parent
448ee87944
commit
5f9c0f7b1b
@ -9,7 +9,7 @@ BACKENDS = {
|
|||||||
|
|
||||||
|
|
||||||
def connect(backend=None, host=None, port=None, name=None):
|
def connect(backend=None, host=None, port=None, name=None):
|
||||||
'''Create a connection to a database.
|
"""Create a connection to the database backend.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
backend (str): the name of the backend to use.
|
backend (str): the name of the backend to use.
|
||||||
@ -19,7 +19,7 @@ def connect(backend=None, host=None, port=None, name=None):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
An instance of :class:`~bigchaindb.backend.connection.Connection`.
|
An instance of :class:`~bigchaindb.backend.connection.Connection`.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
backend = backend or bigchaindb.config['database']['backend']
|
backend = backend or bigchaindb.config['database']['backend']
|
||||||
host = host or bigchaindb.config['database']['host']
|
host = host or bigchaindb.config['database']['host']
|
||||||
|
@ -94,7 +94,7 @@ def get_transaction_from_backlog(connection, transaction_id):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def get_blocks_status_from_transaction(connection, transaction_id):
|
def get_blocks_status_from_transaction(connection, transaction_id):
|
||||||
"""Retrieve block election information given a secondary index and value
|
"""Retrieve block election information given a secondary index and value.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
value: a value to search (e.g. transaction id string, payload hash string)
|
value: a value to search (e.g. transaction id string, payload hash string)
|
||||||
@ -120,7 +120,7 @@ def get_txids_by_asset_id(connection, asset_id):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A list of transactions ids related to the asset. If no transaction
|
A list of transactions ids related to the asset. If no transaction
|
||||||
exists for that asset it returns an empty list `[]`
|
exists for that asset it returns an empty list ``[]``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -218,7 +218,7 @@ def write_block(connection, block):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def get_block(connection, block_id):
|
def get_block(connection, block_id):
|
||||||
"""Get a block from the bigchain table
|
"""Get a block from the bigchain table.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
block_id (str): block id of the block to get
|
block_id (str): block id of the block to get
|
||||||
@ -282,7 +282,7 @@ def write_vote(connection, vote):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def get_genesis_block(connection):
|
def get_genesis_block(connection):
|
||||||
"""Get the genesis block
|
"""Get the genesis block.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The genesis block
|
The genesis block
|
||||||
|
@ -9,11 +9,12 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class RethinkDBConnection(Connection):
|
class RethinkDBConnection(Connection):
|
||||||
"""This class is a proxy to run queries against the database,
|
"""
|
||||||
it is:
|
This class is a proxy to run queries against the database, it is:
|
||||||
- lazy, since it creates a connection only when needed
|
|
||||||
- resilient, because before raising exceptions it tries
|
- lazy, since it creates a connection only when needed
|
||||||
more times to run the query or open a connection.
|
- resilient, because before raising exceptions it tries
|
||||||
|
more times to run the query or open a connection.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, host, port, dbname, max_tries=3):
|
def __init__(self, host, port, dbname, max_tries=3):
|
||||||
@ -34,7 +35,7 @@ class RethinkDBConnection(Connection):
|
|||||||
self.conn = None
|
self.conn = None
|
||||||
|
|
||||||
def run(self, query):
|
def run(self, query):
|
||||||
"""Run a query.
|
"""Run a RethinkDB query.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: the RethinkDB query.
|
query: the RethinkDB query.
|
||||||
|
@ -8,14 +8,14 @@ from bigchaindb.backend.connection import connect
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def create_database(connection, dbname):
|
def create_database(connection, dbname):
|
||||||
"""Create database to be used by BigchainDB
|
"""Create database to be used by BigchainDB.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dbname (str): the name of the database to create.
|
dbname (str): the name of the database to create.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:exc:`~bigchaindb.common.exceptions.DatabaseAlreadyExists`: If the
|
:exc:`~DatabaseAlreadyExists`: If the given :attr:`dbname` already
|
||||||
given :attr:`dbname` already exists as a database.
|
exists as a database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -23,7 +23,7 @@ def create_database(connection, dbname):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def create_tables(connection, dbname):
|
def create_tables(connection, dbname):
|
||||||
"""Create the tables to be used by BigchainDB
|
"""Create the tables to be used by BigchainDB.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dbname (str): the name of the database to create tables for.
|
dbname (str): the name of the database to create tables for.
|
||||||
@ -34,7 +34,7 @@ def create_tables(connection, dbname):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def create_indexes(connection, dbname):
|
def create_indexes(connection, dbname):
|
||||||
"""Create the indexes to be used by BigchainDB
|
"""Create the indexes to be used by BigchainDB.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dbname (str): the name of the database to create indexes for.
|
dbname (str): the name of the database to create indexes for.
|
||||||
@ -45,14 +45,14 @@ def create_indexes(connection, dbname):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def drop_database(connection, dbname):
|
def drop_database(connection, dbname):
|
||||||
"""Drop the database used by BigchainDB
|
"""Drop the database used by BigchainDB.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dbname (str): the name of the database to drop.
|
dbname (str): the name of the database to drop.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:exc:`~bigchaindb.common.exceptions.DatabaseDoesNotExist`: If the
|
:exc:`~DatabaseDoesNotExist`: If the given :attr:`dbname` does not
|
||||||
given :attr:`dbname` does not exist as a database.
|
exist as a database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -73,8 +73,8 @@ def init_database(connection=None, dbname=None):
|
|||||||
configuration.
|
configuration.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:exc:`~bigchaindb.common.exceptions.DatabaseAlreadyExists`: If the
|
:exc:`~DatabaseAlreadyExists`: If the given :attr:`dbname` already
|
||||||
given :attr:`dbname` already exists as a database.
|
exists as a database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
connection = connection or connect()
|
connection = connection or connect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user