mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-26 15:35:45 +00:00
last fixes
This commit is contained in:
parent
c7ad9fcfe6
commit
4771c1357d
@ -6,7 +6,7 @@
|
||||
import copy
|
||||
import logging
|
||||
import os
|
||||
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
from planetmint.version import __version__ # noqa
|
||||
|
||||
|
||||
@ -13,5 +13,4 @@ configuration or the ``PLANETMINT_DATABASE_BACKEND`` environment variable.
|
||||
|
||||
# Include the backend interfaces
|
||||
from planetmint.backend import schema, query # noqa
|
||||
|
||||
from planetmint.backend.connection import Connection
|
||||
|
||||
@ -3,29 +3,22 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import sys
|
||||
import logging
|
||||
from importlib import import_module
|
||||
from itertools import repeat
|
||||
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
from planetmint.backend.utils import get_planetmint_config_value, get_planetmint_config_value_or_key_error
|
||||
from planetmint.common.exceptions import ConfigurationError
|
||||
from planetmint.backend.utils import get_planetmint_config_value
|
||||
|
||||
BACKENDS = { # This is path to MongoDBClass
|
||||
'tarantool_db': 'planetmint.backend.tarantool.connection.TarantoolDB',
|
||||
'tarantool_db': r'planetmint.backend.tarantool.connection.TarantoolDB',
|
||||
'localmongodb': 'planetmint.backend.localmongodb.connection.LocalMongoDBConnection'
|
||||
}
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
modulename = sys.modules[__name__]
|
||||
backend = get_planetmint_config_value("backend")
|
||||
current_backend = getattr(modulename, BACKENDS[backend])
|
||||
modulepath, _, class_name = BACKENDS[backend].rpartition('.')
|
||||
current_backend = getattr(import_module(modulepath), class_name)
|
||||
|
||||
|
||||
class Connection(current_backend):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Register the single dispatched modules on import.
|
||||
from planetmint.backend.tarantool import schema, query, connection # noqa
|
||||
from planetmint.backend.tarantool import query, connection # noqa
|
||||
|
||||
# MongoDBConnection should always be accessed via
|
||||
# ``planetmint.backend.connect()``.
|
||||
@ -10,12 +10,10 @@ from pymongo import DESCENDING
|
||||
from secrets import token_hex
|
||||
from operator import itemgetter
|
||||
|
||||
from planetmint import backend
|
||||
from planetmint.backend.exceptions import DuplicateKeyError
|
||||
from planetmint.backend import query
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
register_query = module_dispatch_registrar(backend.query)
|
||||
register_query = module_dispatch_registrar(query)
|
||||
|
||||
|
||||
def _group_transaction_by_ids(txids: list, connection):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user