diff --git a/docker/set_build.py b/docker/set_build.py index 4cefcce..af89f93 100644 --- a/docker/set_build.py +++ b/docker/set_build.py @@ -2,7 +2,7 @@ import sys import os import re import logging -import scribe.build_info as build_info_mod +import hub.build_info as build_info_mod log = logging.getLogger() log.addHandler(logging.StreamHandler()) diff --git a/scribe/__init__.py b/hub/__init__.py similarity index 100% rename from scribe/__init__.py rename to hub/__init__.py diff --git a/hub/blockchain/__init__.py b/hub/blockchain/__init__.py new file mode 100644 index 0000000..32c9bea --- /dev/null +++ b/hub/blockchain/__init__.py @@ -0,0 +1 @@ +from hub.blockchain.network import LBCTestNet, LBCRegTest, LBCMainNet diff --git a/scribe/blockchain/__main__.py b/hub/blockchain/__main__.py similarity index 80% rename from scribe/blockchain/__main__.py rename to hub/blockchain/__main__.py index 32f851a..6f04bd6 100644 --- a/scribe/blockchain/__main__.py +++ b/hub/blockchain/__main__.py @@ -2,9 +2,9 @@ import os import logging import traceback import argparse -from scribe.common import setup_logging -from scribe.blockchain.env import BlockchainEnv -from scribe.blockchain.service import BlockchainProcessorService +from hub.common import setup_logging +from hub.blockchain.env import BlockchainEnv +from hub.blockchain.service import BlockchainProcessorService def main(): diff --git a/scribe/blockchain/daemon.py b/hub/blockchain/daemon.py similarity index 98% rename from scribe/blockchain/daemon.py rename to hub/blockchain/daemon.py index 745eaa3..b5af795 100644 --- a/scribe/blockchain/daemon.py +++ b/hub/blockchain/daemon.py @@ -7,8 +7,8 @@ from functools import wraps import aiohttp from prometheus_client import Gauge, Histogram -from scribe import PROMETHEUS_NAMESPACE -from scribe.common import LRUCacheWithMetrics, RPCError, DaemonError, WarmingUpError, WorkQueueFullError +from hub import PROMETHEUS_NAMESPACE +from hub.common import LRUCacheWithMetrics, RPCError, DaemonError, WarmingUpError, WorkQueueFullError log = logging.getLogger(__name__) diff --git a/scribe/blockchain/env.py b/hub/blockchain/env.py similarity index 99% rename from scribe/blockchain/env.py rename to hub/blockchain/env.py index ea5c560..e96669a 100644 --- a/scribe/blockchain/env.py +++ b/hub/blockchain/env.py @@ -1,4 +1,4 @@ -from scribe.env import Env +from hub.env import Env class BlockchainEnv(Env): diff --git a/scribe/blockchain/mempool.py b/hub/blockchain/mempool.py similarity index 97% rename from scribe/blockchain/mempool.py rename to hub/blockchain/mempool.py index 848f929..f516702 100644 --- a/scribe/blockchain/mempool.py +++ b/hub/blockchain/mempool.py @@ -2,10 +2,10 @@ import itertools import attr import typing from collections import defaultdict -from scribe.blockchain.transaction.deserializer import Deserializer +from hub.blockchain.transaction.deserializer import Deserializer if typing.TYPE_CHECKING: - from scribe.db import HubDB + from hub.db import HubDB @attr.s(slots=True) diff --git a/scribe/blockchain/network.py b/hub/blockchain/network.py similarity index 96% rename from scribe/blockchain/network.py rename to hub/blockchain/network.py index eb63ecf..fc794db 100644 --- a/scribe/blockchain/network.py +++ b/hub/blockchain/network.py @@ -4,12 +4,12 @@ import typing from typing import List from hashlib import sha256 from decimal import Decimal -from scribe.schema.base58 import Base58 -from scribe.schema.bip32 import PublicKey -from scribe.common import hash160, hash_to_hex_str, double_sha256 -from scribe.blockchain.transaction import TxOutput, TxInput, Block -from scribe.blockchain.transaction.deserializer import Deserializer -from scribe.blockchain.transaction.script import OpCodes, P2PKH_script, P2SH_script, txo_script_parser +from hub.schema.base58 import Base58 +from hub.schema.bip32 import PublicKey +from hub.common import hash160, hash_to_hex_str, double_sha256 +from hub.blockchain.transaction import TxOutput, TxInput, Block +from hub.blockchain.transaction.deserializer import Deserializer +from hub.blockchain.transaction.script import OpCodes, P2PKH_script, P2SH_script, txo_script_parser HASHX_LEN = 11 diff --git a/scribe/blockchain/prefetcher.py b/hub/blockchain/prefetcher.py similarity index 97% rename from scribe/blockchain/prefetcher.py rename to hub/blockchain/prefetcher.py index ab4eaff..ec569a0 100644 --- a/scribe/blockchain/prefetcher.py +++ b/hub/blockchain/prefetcher.py @@ -2,8 +2,8 @@ import asyncio import logging import typing if typing.TYPE_CHECKING: - from scribe.blockchain.network import LBCMainNet - from scribe.blockchain.daemon import LBCDaemon + from hub.blockchain.network import LBCMainNet + from hub.blockchain.daemon import LBCDaemon def chunks(items, size): diff --git a/scribe/blockchain/service.py b/hub/blockchain/service.py similarity index 98% rename from scribe/blockchain/service.py rename to hub/blockchain/service.py index 078f06b..3a75442 100644 --- a/scribe/blockchain/service.py +++ b/hub/blockchain/service.py @@ -7,20 +7,20 @@ from typing import Optional, List, Tuple, Set, DefaultDict, Dict from prometheus_client import Gauge, Histogram from collections import defaultdict -from scribe import PROMETHEUS_NAMESPACE -from scribe.db.prefixes import ACTIVATED_SUPPORT_TXO_TYPE, ACTIVATED_CLAIM_TXO_TYPE -from scribe.db.prefixes import PendingActivationKey, PendingActivationValue, ClaimToTXOValue -from scribe.error.base import ChainError -from scribe.common import hash_to_hex_str, hash160, RPCError, HISTOGRAM_BUCKETS, StagedClaimtrieItem, sha256, LRUCache -from scribe.blockchain.daemon import LBCDaemon -from scribe.blockchain.transaction import Tx, TxOutput, TxInput, Block -from scribe.blockchain.prefetcher import Prefetcher -from scribe.blockchain.mempool import MemPool -from scribe.schema.url import normalize_name -from scribe.service import BlockchainService +from hub import PROMETHEUS_NAMESPACE +from hub.db.prefixes import ACTIVATED_SUPPORT_TXO_TYPE, ACTIVATED_CLAIM_TXO_TYPE +from hub.db.prefixes import PendingActivationKey, PendingActivationValue, ClaimToTXOValue +from hub.error.base import ChainError +from hub.common import hash_to_hex_str, hash160, RPCError, HISTOGRAM_BUCKETS, StagedClaimtrieItem, sha256, LRUCache +from hub.blockchain.daemon import LBCDaemon +from hub.blockchain.transaction import Tx, TxOutput, TxInput, Block +from hub.blockchain.prefetcher import Prefetcher +from hub.blockchain.mempool import MemPool +from hub.schema.url import normalize_name +from hub.service import BlockchainService if typing.TYPE_CHECKING: - from scribe.blockchain.env import BlockchainEnv - from scribe.db.revertable import RevertableOpStack + from hub.blockchain.env import BlockchainEnv + from hub.db.revertable import RevertableOpStack NAMESPACE = f"{PROMETHEUS_NAMESPACE}_writer" @@ -1725,9 +1725,9 @@ class BlockchainProcessorService(BlockchainService): def _iter_start_tasks(self): while self.db.db_version < max(self.db.DB_VERSIONS): if self.db.db_version == 7: - from scribe.db.migrators.migrate7to8 import migrate, FROM_VERSION, TO_VERSION + from hub.db.migrators.migrate7to8 import migrate, FROM_VERSION, TO_VERSION elif self.db.db_version == 8: - from scribe.db.migrators.migrate8to9 import migrate, FROM_VERSION, TO_VERSION + from hub.db.migrators.migrate8to9 import migrate, FROM_VERSION, TO_VERSION self.db._index_address_status = self.env.index_address_status else: raise RuntimeError("unknown db version") diff --git a/scribe/blockchain/transaction/__init__.py b/hub/blockchain/transaction/__init__.py similarity index 98% rename from scribe/blockchain/transaction/__init__.py rename to hub/blockchain/transaction/__init__.py index 88d5ce9..3d894fd 100644 --- a/scribe/blockchain/transaction/__init__.py +++ b/hub/blockchain/transaction/__init__.py @@ -3,8 +3,8 @@ import functools import typing from dataclasses import dataclass from struct import Struct -from scribe.schema.claim import Claim -from scribe.common import double_sha256 +from hub.schema.claim import Claim +from hub.common import double_sha256 if (sys.version_info.major, sys.version_info.minor) > (3, 7): cachedproperty = functools.cached_property diff --git a/scribe/blockchain/transaction/deserializer.py b/hub/blockchain/transaction/deserializer.py similarity index 97% rename from scribe/blockchain/transaction/deserializer.py rename to hub/blockchain/transaction/deserializer.py index c9e027b..073f743 100644 --- a/scribe/blockchain/transaction/deserializer.py +++ b/hub/blockchain/transaction/deserializer.py @@ -1,9 +1,9 @@ -from scribe.common import double_sha256 -from scribe.blockchain.transaction import ( +from hub.common import double_sha256 +from hub.blockchain.transaction import ( unpack_le_int32_from, unpack_le_int64_from, unpack_le_uint16_from, unpack_le_uint32_from, unpack_le_uint64_from, Tx, TxInput, TxOutput ) -from scribe.blockchain.transaction.script import txo_script_parser +from hub.blockchain.transaction.script import txo_script_parser class Deserializer: diff --git a/scribe/blockchain/transaction/script.py b/hub/blockchain/transaction/script.py similarity index 97% rename from scribe/blockchain/transaction/script.py rename to hub/blockchain/transaction/script.py index 4be83be..3edd72e 100644 --- a/scribe/blockchain/transaction/script.py +++ b/hub/blockchain/transaction/script.py @@ -1,6 +1,6 @@ import typing -from scribe.blockchain.transaction import NameClaim, ClaimUpdate, ClaimSupport -from scribe.blockchain.transaction import unpack_le_uint16_from, unpack_le_uint32_from, pack_le_uint16, pack_le_uint32 +from hub.blockchain.transaction import NameClaim, ClaimUpdate, ClaimSupport +from hub.blockchain.transaction import unpack_le_uint16_from, unpack_le_uint32_from, pack_le_uint16, pack_le_uint32 class _OpCodes(typing.NamedTuple): diff --git a/scribe/build_info.py b/hub/build_info.py similarity index 100% rename from scribe/build_info.py rename to hub/build_info.py diff --git a/scribe/common.py b/hub/common.py similarity index 100% rename from scribe/common.py rename to hub/common.py diff --git a/scribe/db/__init__.py b/hub/db/__init__.py similarity index 100% rename from scribe/db/__init__.py rename to hub/db/__init__.py diff --git a/scribe/db/common.py b/hub/db/common.py similarity index 99% rename from scribe/db/common.py rename to hub/db/common.py index 23f9164..5c6c438 100644 --- a/scribe/db/common.py +++ b/hub/db/common.py @@ -1,7 +1,7 @@ import typing import enum from typing import Optional -from scribe.error import ResolveCensoredError +from hub.error import ResolveCensoredError @enum.unique diff --git a/scribe/db/db.py b/hub/db/db.py similarity index 98% rename from scribe/db/db.py rename to hub/db/db.py index bcb3cc5..ded2e70 100644 --- a/scribe/db/db.py +++ b/hub/db/db.py @@ -12,19 +12,19 @@ from functools import partial from bisect import bisect_right from collections import defaultdict from concurrent.futures.thread import ThreadPoolExecutor -from scribe import PROMETHEUS_NAMESPACE -from scribe.error import ResolveCensoredError -from scribe.schema.url import URL, normalize_name -from scribe.schema.claim import guess_stream_type -from scribe.schema.result import Censor -from scribe.blockchain.transaction import TxInput -from scribe.common import hash_to_hex_str, hash160, LRUCacheWithMetrics, sha256 -from scribe.db.merkle import Merkle, MerkleCache, FastMerkleCacheItem -from scribe.db.common import ResolveResult, STREAM_TYPES, CLAIM_TYPES, ExpandedResolveResult, DBError, UTXO -from scribe.db.prefixes import PendingActivationValue, ClaimTakeoverValue, ClaimToTXOValue, PrefixDB -from scribe.db.prefixes import ACTIVATED_CLAIM_TXO_TYPE, ACTIVATED_SUPPORT_TXO_TYPE, EffectiveAmountKey -from scribe.db.prefixes import PendingActivationKey, TXOToClaimValue, DBStatePrefixRow, MempoolTXPrefixRow -from scribe.db.prefixes import HashXMempoolStatusPrefixRow +from hub import PROMETHEUS_NAMESPACE +from hub.error import ResolveCensoredError +from hub.schema.url import URL, normalize_name +from hub.schema.claim import guess_stream_type +from hub.schema.result import Censor +from hub.blockchain.transaction import TxInput +from hub.common import hash_to_hex_str, hash160, LRUCacheWithMetrics, sha256 +from hub.db.merkle import Merkle, MerkleCache, FastMerkleCacheItem +from hub.db.common import ResolveResult, STREAM_TYPES, CLAIM_TYPES, ExpandedResolveResult, DBError, UTXO +from hub.db.prefixes import PendingActivationValue, ClaimTakeoverValue, ClaimToTXOValue, PrefixDB +from hub.db.prefixes import ACTIVATED_CLAIM_TXO_TYPE, ACTIVATED_SUPPORT_TXO_TYPE, EffectiveAmountKey +from hub.db.prefixes import PendingActivationKey, TXOToClaimValue, DBStatePrefixRow, MempoolTXPrefixRow +from hub.db.prefixes import HashXMempoolStatusPrefixRow TXO_STRUCT = struct.Struct(b'>LH') diff --git a/scribe/db/interface.py b/hub/db/interface.py similarity index 98% rename from scribe/db/interface.py rename to hub/db/interface.py index 5045705..f3b7094 100644 --- a/scribe/db/interface.py +++ b/hub/db/interface.py @@ -2,8 +2,8 @@ import struct import typing import rocksdb from typing import Optional -from scribe.db.common import DB_PREFIXES, COLUMN_SETTINGS -from scribe.db.revertable import RevertableOpStack, RevertablePut, RevertableDelete +from hub.db.common import DB_PREFIXES, COLUMN_SETTINGS +from hub.db.revertable import RevertableOpStack, RevertablePut, RevertableDelete ROW_TYPES = {} diff --git a/scribe/db/merkle.py b/hub/db/merkle.py similarity index 99% rename from scribe/db/merkle.py rename to hub/db/merkle.py index 3321fa1..2541bf6 100644 --- a/scribe/db/merkle.py +++ b/hub/db/merkle.py @@ -29,7 +29,7 @@ import typing from asyncio import Event from math import ceil, log -from scribe.common import double_sha256 +from hub.common import double_sha256 class Merkle: diff --git a/scribe/db/migrators/__init__.py b/hub/db/migrators/__init__.py similarity index 100% rename from scribe/db/migrators/__init__.py rename to hub/db/migrators/__init__.py diff --git a/scribe/db/migrators/migrate7to8.py b/hub/db/migrators/migrate7to8.py similarity index 97% rename from scribe/db/migrators/migrate7to8.py rename to hub/db/migrators/migrate7to8.py index 58e1627..cfeaae5 100644 --- a/scribe/db/migrators/migrate7to8.py +++ b/hub/db/migrators/migrate7to8.py @@ -3,9 +3,9 @@ import time import array import typing from bisect import bisect_right -from scribe.common import sha256 +from hub.common import sha256 if typing.TYPE_CHECKING: - from scribe.db.db import HubDB + from hub.db.db import HubDB FROM_VERSION = 7 TO_VERSION = 8 diff --git a/scribe/db/migrators/migrate8to9.py b/hub/db/migrators/migrate8to9.py similarity index 100% rename from scribe/db/migrators/migrate8to9.py rename to hub/db/migrators/migrate8to9.py diff --git a/scribe/db/prefixes.py b/hub/db/prefixes.py similarity index 99% rename from scribe/db/prefixes.py rename to hub/db/prefixes.py index 4cb214b..3918652 100644 --- a/scribe/db/prefixes.py +++ b/hub/db/prefixes.py @@ -3,9 +3,9 @@ import struct import array import base64 from typing import Union, Tuple, NamedTuple, Optional -from scribe.db.common import DB_PREFIXES -from scribe.db.interface import BasePrefixDB, ROW_TYPES, PrefixRow -from scribe.schema.url import normalize_name +from hub.db.common import DB_PREFIXES +from hub.db.interface import BasePrefixDB, ROW_TYPES, PrefixRow +from hub.schema.url import normalize_name ACTIVATED_CLAIM_TXO_TYPE = 1 ACTIVATED_SUPPORT_TXO_TYPE = 2 diff --git a/scribe/db/revertable.py b/hub/db/revertable.py similarity index 99% rename from scribe/db/revertable.py rename to hub/db/revertable.py index a982a97..37fbc4e 100644 --- a/scribe/db/revertable.py +++ b/hub/db/revertable.py @@ -3,7 +3,7 @@ import logging from string import printable from collections import defaultdict from typing import Tuple, Iterable, Callable, Optional, List -from scribe.db.common import DB_PREFIXES +from hub.db.common import DB_PREFIXES _OP_STRUCT = struct.Struct('>BLL') log = logging.getLogger(__name__) @@ -58,7 +58,7 @@ class RevertableOp: return str(self) def __str__(self) -> str: - from scribe.db.prefixes import auto_decode_item + from hub.db.prefixes import auto_decode_item k, v = auto_decode_item(self.key, self.value) key = ''.join(c if c in printable else '.' for c in str(k)) val = ''.join(c if c in printable else '.' for c in str(v)) diff --git a/hub/elasticsearch/__init__.py b/hub/elasticsearch/__init__.py new file mode 100644 index 0000000..6138c4c --- /dev/null +++ b/hub/elasticsearch/__init__.py @@ -0,0 +1,2 @@ +from hub.elasticsearch.search import SearchIndex +from hub.elasticsearch.notifier_protocol import ElasticNotifierClientProtocol \ No newline at end of file diff --git a/scribe/elasticsearch/__main__.py b/hub/elasticsearch/__main__.py similarity index 81% rename from scribe/elasticsearch/__main__.py rename to hub/elasticsearch/__main__.py index f968a8c..71e9215 100644 --- a/scribe/elasticsearch/__main__.py +++ b/hub/elasticsearch/__main__.py @@ -2,9 +2,9 @@ import os import logging import traceback import argparse -from scribe.common import setup_logging -from scribe.elasticsearch.env import ElasticEnv -from scribe.elasticsearch.service import ElasticSyncService +from hub.common import setup_logging +from hub.elasticsearch.env import ElasticEnv +from hub.elasticsearch.service import ElasticSyncService def main(): diff --git a/scribe/elasticsearch/constants.py b/hub/elasticsearch/constants.py similarity index 100% rename from scribe/elasticsearch/constants.py rename to hub/elasticsearch/constants.py diff --git a/scribe/elasticsearch/env.py b/hub/elasticsearch/env.py similarity index 99% rename from scribe/elasticsearch/env.py rename to hub/elasticsearch/env.py index 58fcfad..b4a82cc 100644 --- a/scribe/elasticsearch/env.py +++ b/hub/elasticsearch/env.py @@ -1,4 +1,4 @@ -from scribe.env import Env +from hub.env import Env class ElasticEnv(Env): diff --git a/scribe/elasticsearch/fast_ar_trending.py b/hub/elasticsearch/fast_ar_trending.py similarity index 100% rename from scribe/elasticsearch/fast_ar_trending.py rename to hub/elasticsearch/fast_ar_trending.py diff --git a/scribe/elasticsearch/notifier_protocol.py b/hub/elasticsearch/notifier_protocol.py similarity index 100% rename from scribe/elasticsearch/notifier_protocol.py rename to hub/elasticsearch/notifier_protocol.py diff --git a/scribe/elasticsearch/search.py b/hub/elasticsearch/search.py similarity index 98% rename from scribe/elasticsearch/search.py rename to hub/elasticsearch/search.py index 7b77801..6bd68c8 100644 --- a/scribe/elasticsearch/search.py +++ b/hub/elasticsearch/search.py @@ -8,16 +8,16 @@ from operator import itemgetter from typing import Optional, List, Iterable, TYPE_CHECKING from elasticsearch import AsyncElasticsearch, NotFoundError, ConnectionError -from scribe.schema.result import Censor, Outputs -from scribe.schema.tags import clean_tags -from scribe.schema.url import normalize_name -from scribe.error import TooManyClaimSearchParametersError -from scribe.common import LRUCache -from scribe.db.common import CLAIM_TYPES, STREAM_TYPES -from scribe.elasticsearch.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, RANGE_FIELDS -from scribe.db.common import ResolveResult +from hub.schema.result import Censor, Outputs +from hub.schema.tags import clean_tags +from hub.schema.url import normalize_name +from hub.error import TooManyClaimSearchParametersError +from hub.common import LRUCache +from hub.db.common import CLAIM_TYPES, STREAM_TYPES +from hub.elasticsearch.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, RANGE_FIELDS +from hub.db.common import ResolveResult if TYPE_CHECKING: - from scribe.db import HubDB + from hub.db import HubDB class ChannelResolution(str): diff --git a/scribe/elasticsearch/service.py b/hub/elasticsearch/service.py similarity index 97% rename from scribe/elasticsearch/service.py rename to hub/elasticsearch/service.py index 9476d5b..8acaa2b 100644 --- a/scribe/elasticsearch/service.py +++ b/hub/elasticsearch/service.py @@ -5,16 +5,16 @@ import asyncio from collections import defaultdict from elasticsearch import AsyncElasticsearch, NotFoundError from elasticsearch.helpers import async_streaming_bulk -from scribe.schema.result import Censor -from scribe.service import BlockchainReaderService -from scribe.db.revertable import RevertableOp -from scribe.db.common import TrendingNotification, DB_PREFIXES -from scribe.elasticsearch.notifier_protocol import ElasticNotifierProtocol -from scribe.elasticsearch.search import IndexVersionMismatch, expand_query -from scribe.elasticsearch.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS -from scribe.elasticsearch.fast_ar_trending import FAST_AR_TRENDING_SCRIPT +from hub.schema.result import Censor +from hub.service import BlockchainReaderService +from hub.db.revertable import RevertableOp +from hub.db.common import TrendingNotification, DB_PREFIXES +from hub.elasticsearch.notifier_protocol import ElasticNotifierProtocol +from hub.elasticsearch.search import IndexVersionMismatch, expand_query +from hub.elasticsearch.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS +from hub.elasticsearch.fast_ar_trending import FAST_AR_TRENDING_SCRIPT if typing.TYPE_CHECKING: - from scribe.elasticsearch.env import ElasticEnv + from hub.elasticsearch.env import ElasticEnv class ElasticSyncService(BlockchainReaderService): diff --git a/scribe/env.py b/hub/env.py similarity index 99% rename from scribe/env.py rename to hub/env.py index 6ca1146..70ddb40 100644 --- a/scribe/env.py +++ b/hub/env.py @@ -3,7 +3,7 @@ import re import resource import logging from collections import namedtuple -from scribe.blockchain.network import LBCMainNet, LBCTestNet, LBCRegTest +from hub.blockchain.network import LBCMainNet, LBCTestNet, LBCRegTest NetIdentity = namedtuple('NetIdentity', 'host tcp_port ssl_port nick_suffix') diff --git a/scribe/error/Makefile b/hub/error/Makefile similarity index 100% rename from scribe/error/Makefile rename to hub/error/Makefile diff --git a/scribe/error/README.md b/hub/error/README.md similarity index 100% rename from scribe/error/README.md rename to hub/error/README.md diff --git a/scribe/error/__init__.py b/hub/error/__init__.py similarity index 100% rename from scribe/error/__init__.py rename to hub/error/__init__.py diff --git a/scribe/error/base.py b/hub/error/base.py similarity index 100% rename from scribe/error/base.py rename to hub/error/base.py diff --git a/scribe/error/generate.py b/hub/error/generate.py similarity index 100% rename from scribe/error/generate.py rename to hub/error/generate.py diff --git a/scribe/hub/__init__.py b/hub/hub/__init__.py similarity index 100% rename from scribe/hub/__init__.py rename to hub/hub/__init__.py diff --git a/scribe/hub/__main__.py b/hub/hub/__main__.py similarity index 82% rename from scribe/hub/__main__.py rename to hub/hub/__main__.py index 0862e87..f144431 100644 --- a/scribe/hub/__main__.py +++ b/hub/hub/__main__.py @@ -2,9 +2,9 @@ import os import logging import traceback import argparse -from scribe.common import setup_logging -from scribe.hub.env import ServerEnv -from scribe.hub.service import HubServerService +from hub.common import setup_logging +from hub.hub.env import ServerEnv +from hub.hub.service import HubServerService def main(): diff --git a/scribe/hub/common.py b/hub/hub/common.py similarity index 99% rename from scribe/hub/common.py rename to hub/hub/common.py index 7eb2c11..c1b00f9 100644 --- a/scribe/hub/common.py +++ b/hub/hub/common.py @@ -1,7 +1,7 @@ import inspect from collections import namedtuple from functools import lru_cache -from scribe.common import CodeMessageError +from hub.common import CodeMessageError SignatureInfo = namedtuple('SignatureInfo', 'min_args max_args ' diff --git a/scribe/hub/env.py b/hub/hub/env.py similarity index 99% rename from scribe/hub/env.py rename to hub/hub/env.py index 85ada99..da8f997 100644 --- a/scribe/hub/env.py +++ b/hub/hub/env.py @@ -1,5 +1,5 @@ import re -from scribe.env import Env +from hub.env import Env class ServerEnv(Env): diff --git a/scribe/hub/framer.py b/hub/hub/framer.py similarity index 100% rename from scribe/hub/framer.py rename to hub/hub/framer.py diff --git a/scribe/hub/jsonrpc.py b/hub/hub/jsonrpc.py similarity index 99% rename from scribe/hub/jsonrpc.py rename to hub/hub/jsonrpc.py index aae8c4e..d464e35 100644 --- a/scribe/hub/jsonrpc.py +++ b/hub/hub/jsonrpc.py @@ -6,8 +6,8 @@ import asyncio from asyncio import Event from functools import partial from numbers import Number -from scribe.common import RPCError, CodeMessageError -from scribe.hub.common import Notification, Request, Response, Batch, ProtocolError +from hub.common import RPCError, CodeMessageError +from hub.hub.common import Notification, Request, Response, Batch, ProtocolError class JSONRPC: diff --git a/scribe/hub/mempool.py b/hub/hub/mempool.py similarity index 97% rename from scribe/hub/mempool.py rename to hub/hub/mempool.py index a2db139..1359644 100644 --- a/scribe/hub/mempool.py +++ b/hub/hub/mempool.py @@ -6,14 +6,14 @@ import logging from collections import defaultdict from prometheus_client import Histogram, Gauge import rocksdb.errors -from scribe import PROMETHEUS_NAMESPACE -from scribe.common import HISTOGRAM_BUCKETS -from scribe.db.common import UTXO -from scribe.blockchain.transaction.deserializer import Deserializer +from hub import PROMETHEUS_NAMESPACE +from hub.common import HISTOGRAM_BUCKETS +from hub.db.common import UTXO +from hub.blockchain.transaction.deserializer import Deserializer if typing.TYPE_CHECKING: - from scribe.hub.session import SessionManager - from scribe.db import HubDB + from hub.hub.session import SessionManager + from hub.db import HubDB @attr.s(slots=True) diff --git a/scribe/hub/service.py b/hub/hub/service.py similarity index 93% rename from scribe/hub/service.py rename to hub/hub/service.py index ccc4d33..0dfad90 100644 --- a/scribe/hub/service.py +++ b/hub/hub/service.py @@ -1,14 +1,14 @@ import time import typing import asyncio -from scribe.blockchain.daemon import LBCDaemon -from scribe.hub.session import SessionManager -from scribe.hub.mempool import HubMemPool -from scribe.hub.udp import StatusServer -from scribe.service import BlockchainReaderService -from scribe.elasticsearch import ElasticNotifierClientProtocol +from hub.blockchain.daemon import LBCDaemon +from hub.hub.session import SessionManager +from hub.hub.mempool import HubMemPool +from hub.hub.udp import StatusServer +from hub.service import BlockchainReaderService +from hub.elasticsearch import ElasticNotifierClientProtocol if typing.TYPE_CHECKING: - from scribe.hub.env import ServerEnv + from hub.hub.env import ServerEnv class HubServerService(BlockchainReaderService): diff --git a/scribe/hub/session.py b/hub/hub/session.py similarity index 98% rename from scribe/hub/session.py rename to hub/hub/session.py index 3ea3cff..f2e54ce 100644 --- a/scribe/hub/session.py +++ b/hub/hub/session.py @@ -15,22 +15,22 @@ from contextlib import suppress from functools import partial from elasticsearch import ConnectionTimeout from prometheus_client import Counter, Info, Histogram, Gauge -from scribe.schema.result import Outputs -from scribe.error import ResolveCensoredError, TooManyClaimSearchParametersError -from scribe import __version__, PROMETHEUS_NAMESPACE -from scribe.hub import PROTOCOL_MIN, PROTOCOL_MAX, HUB_PROTOCOL_VERSION -from scribe.build_info import BUILD, COMMIT_HASH, DOCKER_TAG -from scribe.elasticsearch import SearchIndex -from scribe.common import sha256, hash_to_hex_str, hex_str_to_hash, HASHX_LEN, version_string, formatted_time -from scribe.common import protocol_version, RPCError, DaemonError, TaskGroup, HISTOGRAM_BUCKETS -from scribe.hub.jsonrpc import JSONRPCAutoDetect, JSONRPCConnection, JSONRPCv2, JSONRPC -from scribe.hub.common import BatchRequest, ProtocolError, Request, Batch, Notification -from scribe.hub.framer import NewlineFramer +from hub.schema.result import Outputs +from hub.error import ResolveCensoredError, TooManyClaimSearchParametersError +from hub import __version__, PROMETHEUS_NAMESPACE +from hub.hub import PROTOCOL_MIN, PROTOCOL_MAX, HUB_PROTOCOL_VERSION +from hub.build_info import BUILD, COMMIT_HASH, DOCKER_TAG +from hub.elasticsearch import SearchIndex +from hub.common import sha256, hash_to_hex_str, hex_str_to_hash, HASHX_LEN, version_string, formatted_time +from hub.common import protocol_version, RPCError, DaemonError, TaskGroup, HISTOGRAM_BUCKETS +from hub.hub.jsonrpc import JSONRPCAutoDetect, JSONRPCConnection, JSONRPCv2, JSONRPC +from hub.hub.common import BatchRequest, ProtocolError, Request, Batch, Notification +from hub.hub.framer import NewlineFramer if typing.TYPE_CHECKING: - from scribe.db import HubDB - from scribe.hub.env import ServerEnv - from scribe.blockchain.daemon import LBCDaemon - from scribe.hub.mempool import HubMemPool + from hub.db import HubDB + from hub.hub.env import ServerEnv + from hub.blockchain.daemon import LBCDaemon + from hub.hub.mempool import HubMemPool BAD_REQUEST = 1 DAEMON_ERROR = 2 diff --git a/scribe/hub/udp.py b/hub/hub/udp.py similarity index 98% rename from scribe/hub/udp.py rename to hub/hub/udp.py index f919324..af83d0c 100644 --- a/scribe/hub/udp.py +++ b/hub/hub/udp.py @@ -3,8 +3,8 @@ import struct from time import perf_counter import logging from typing import Optional, Tuple, NamedTuple -from scribe.schema.attrs import country_str_to_int, country_int_to_str -from scribe.common import LRUCache, is_valid_public_ipv4 +from hub.schema.attrs import country_str_to_int, country_int_to_str +from hub.common import LRUCache, is_valid_public_ipv4 log = logging.getLogger(__name__) diff --git a/scribe/metrics.py b/hub/metrics.py similarity index 100% rename from scribe/metrics.py rename to hub/metrics.py diff --git a/scribe/schema/Makefile b/hub/schema/Makefile similarity index 100% rename from scribe/schema/Makefile rename to hub/schema/Makefile diff --git a/scribe/schema/README.md b/hub/schema/README.md similarity index 100% rename from scribe/schema/README.md rename to hub/schema/README.md diff --git a/scribe/schema/__init__.py b/hub/schema/__init__.py similarity index 100% rename from scribe/schema/__init__.py rename to hub/schema/__init__.py diff --git a/scribe/schema/attrs.py b/hub/schema/attrs.py similarity index 97% rename from scribe/schema/attrs.py rename to hub/schema/attrs.py index a855f42..bd2751f 100644 --- a/scribe/schema/attrs.py +++ b/hub/schema/attrs.py @@ -7,13 +7,13 @@ from string import ascii_letters from decimal import Decimal, ROUND_UP from google.protobuf.json_format import MessageToDict -from scribe.schema.base58 import Base58, b58_encode -from scribe.error import MissingPublishedFileError, EmptyPublishedFileError +from hub.schema.base58 import Base58, b58_encode +from hub.error import MissingPublishedFileError, EmptyPublishedFileError -from scribe.schema.mime_types import guess_media_type -from scribe.schema.base import Metadata, BaseMessageList -from scribe.schema.tags import normalize_tag -from scribe.schema.types.v2.claim_pb2 import ( +from hub.schema.mime_types import guess_media_type +from hub.schema.base import Metadata, BaseMessageList +from hub.schema.tags import normalize_tag +from hub.schema.types.v2.claim_pb2 import ( Fee as FeeMessage, Location as LocationMessage, Language as LanguageMessage diff --git a/scribe/schema/base.py b/hub/schema/base.py similarity index 100% rename from scribe/schema/base.py rename to hub/schema/base.py diff --git a/scribe/schema/base58.py b/hub/schema/base58.py similarity index 100% rename from scribe/schema/base58.py rename to hub/schema/base58.py diff --git a/scribe/schema/bip32.py b/hub/schema/bip32.py similarity index 99% rename from scribe/schema/bip32.py rename to hub/schema/bip32.py index d12ff1b..f98824b 100644 --- a/scribe/schema/bip32.py +++ b/hub/schema/bip32.py @@ -8,7 +8,7 @@ from coincurve.utils import ( pem_to_der, lib as libsecp256k1, ffi as libsecp256k1_ffi ) from coincurve.ecdsa import CDATA_SIG_LENGTH -from scribe.schema.base58 import Base58 +from hub.schema.base58 import Base58 if (sys.version_info.major, sys.version_info.minor) > (3, 7): diff --git a/scribe/schema/claim.py b/hub/schema/claim.py similarity index 97% rename from scribe/schema/claim.py rename to hub/schema/claim.py index a4a46d8..f59a55f 100644 --- a/scribe/schema/claim.py +++ b/hub/schema/claim.py @@ -11,15 +11,15 @@ from hachoir.core.log import log as hachoir_log from hachoir.parser import createParser as binary_file_parser from hachoir.metadata import extractMetadata as binary_file_metadata -from scribe.schema import compat -from scribe.schema.base import Signable -from scribe.schema.mime_types import guess_media_type, guess_stream_type -from scribe.schema.attrs import ( +from hub.schema import compat +from hub.schema.base import Signable +from hub.schema.mime_types import guess_media_type, guess_stream_type +from hub.schema.attrs import ( Source, Playable, Dimmensional, Fee, Image, Video, Audio, LanguageList, LocationList, ClaimList, ClaimReference, TagList ) -from scribe.schema.types.v2.claim_pb2 import Claim as ClaimMessage -from scribe.error import InputValueIsNoneError +from hub.schema.types.v2.claim_pb2 import Claim as ClaimMessage +from hub.error import InputValueIsNoneError hachoir_log.use_print = False diff --git a/scribe/schema/compat.py b/hub/schema/compat.py similarity index 94% rename from scribe/schema/compat.py rename to hub/schema/compat.py index 2dc99b0..46dd72f 100644 --- a/scribe/schema/compat.py +++ b/hub/schema/compat.py @@ -3,9 +3,9 @@ from decimal import Decimal from google.protobuf.message import DecodeError -from scribe.schema.types.v1.legacy_claim_pb2 import Claim as OldClaimMessage -from scribe.schema.types.v1.certificate_pb2 import KeyType -from scribe.schema.types.v1.fee_pb2 import Fee as FeeMessage +from hub.schema.types.v1.legacy_claim_pb2 import Claim as OldClaimMessage +from hub.schema.types.v1.certificate_pb2 import KeyType +from hub.schema.types.v1.fee_pb2 import Fee as FeeMessage def from_old_json_schema(claim, payload: bytes): diff --git a/scribe/schema/mime_types.py b/hub/schema/mime_types.py similarity index 100% rename from scribe/schema/mime_types.py rename to hub/schema/mime_types.py diff --git a/scribe/schema/purchase.py b/hub/schema/purchase.py similarity index 94% rename from scribe/schema/purchase.py rename to hub/schema/purchase.py index 22148e6..cbb9329 100644 --- a/scribe/schema/purchase.py +++ b/hub/schema/purchase.py @@ -1,6 +1,6 @@ from google.protobuf.message import DecodeError from google.protobuf.json_format import MessageToDict -from scribe.schema.types.v2.purchase_pb2 import Purchase as PurchaseMessage +from hub.schema.types.v2.purchase_pb2 import Purchase as PurchaseMessage from .attrs import ClaimReference diff --git a/scribe/schema/result.py b/hub/schema/result.py similarity index 97% rename from scribe/schema/result.py rename to hub/schema/result.py index 2429e93..6acfd3e 100644 --- a/scribe/schema/result.py +++ b/hub/schema/result.py @@ -2,11 +2,11 @@ import base64 from typing import List, TYPE_CHECKING, Union, Optional, Dict, Set, Tuple from itertools import chain -from scribe.error import ResolveCensoredError -from scribe.schema.types.v2.result_pb2 import Outputs as OutputsMessage -from scribe.schema.types.v2.result_pb2 import Error as ErrorMessage +from hub.error import ResolveCensoredError +from hub.schema.types.v2.result_pb2 import Outputs as OutputsMessage +from hub.schema.types.v2.result_pb2 import Error as ErrorMessage if TYPE_CHECKING: - from scribe.db.common import ResolveResult + from hub.db.common import ResolveResult INVALID = ErrorMessage.Code.Name(ErrorMessage.INVALID) NOT_FOUND = ErrorMessage.Code.Name(ErrorMessage.NOT_FOUND) BLOCKED = ErrorMessage.Code.Name(ErrorMessage.BLOCKED) diff --git a/scribe/schema/support.py b/hub/schema/support.py similarity index 78% rename from scribe/schema/support.py rename to hub/schema/support.py index 35f60f6..ccd2cc7 100644 --- a/scribe/schema/support.py +++ b/hub/schema/support.py @@ -1,5 +1,5 @@ -from scribe.schema.base import Signable -from scribe.schema.types.v2.support_pb2 import Support as SupportMessage +from hub.schema.base import Signable +from hub.schema.types.v2.support_pb2 import Support as SupportMessage class Support(Signable): diff --git a/scribe/schema/tags.py b/hub/schema/tags.py similarity index 100% rename from scribe/schema/tags.py rename to hub/schema/tags.py diff --git a/scribe/schema/types/__init__.py b/hub/schema/types/__init__.py similarity index 100% rename from scribe/schema/types/__init__.py rename to hub/schema/types/__init__.py diff --git a/scribe/schema/types/v1/__init__.py b/hub/schema/types/v1/__init__.py similarity index 100% rename from scribe/schema/types/v1/__init__.py rename to hub/schema/types/v1/__init__.py diff --git a/scribe/schema/types/v1/certificate_pb2.py b/hub/schema/types/v1/certificate_pb2.py similarity index 100% rename from scribe/schema/types/v1/certificate_pb2.py rename to hub/schema/types/v1/certificate_pb2.py diff --git a/scribe/schema/types/v1/fee_pb2.py b/hub/schema/types/v1/fee_pb2.py similarity index 100% rename from scribe/schema/types/v1/fee_pb2.py rename to hub/schema/types/v1/fee_pb2.py diff --git a/scribe/schema/types/v1/legacy_claim_pb2.py b/hub/schema/types/v1/legacy_claim_pb2.py similarity index 100% rename from scribe/schema/types/v1/legacy_claim_pb2.py rename to hub/schema/types/v1/legacy_claim_pb2.py diff --git a/scribe/schema/types/v1/metadata_pb2.py b/hub/schema/types/v1/metadata_pb2.py similarity index 100% rename from scribe/schema/types/v1/metadata_pb2.py rename to hub/schema/types/v1/metadata_pb2.py diff --git a/scribe/schema/types/v1/signature_pb2.py b/hub/schema/types/v1/signature_pb2.py similarity index 100% rename from scribe/schema/types/v1/signature_pb2.py rename to hub/schema/types/v1/signature_pb2.py diff --git a/scribe/schema/types/v1/source_pb2.py b/hub/schema/types/v1/source_pb2.py similarity index 100% rename from scribe/schema/types/v1/source_pb2.py rename to hub/schema/types/v1/source_pb2.py diff --git a/scribe/schema/types/v1/stream_pb2.py b/hub/schema/types/v1/stream_pb2.py similarity index 100% rename from scribe/schema/types/v1/stream_pb2.py rename to hub/schema/types/v1/stream_pb2.py diff --git a/scribe/schema/types/v2/__init__.py b/hub/schema/types/v2/__init__.py similarity index 100% rename from scribe/schema/types/v2/__init__.py rename to hub/schema/types/v2/__init__.py diff --git a/scribe/schema/types/v2/claim_pb2.py b/hub/schema/types/v2/claim_pb2.py similarity index 100% rename from scribe/schema/types/v2/claim_pb2.py rename to hub/schema/types/v2/claim_pb2.py diff --git a/scribe/schema/types/v2/hub_pb2.py b/hub/schema/types/v2/hub_pb2.py similarity index 100% rename from scribe/schema/types/v2/hub_pb2.py rename to hub/schema/types/v2/hub_pb2.py diff --git a/scribe/schema/types/v2/hub_pb2_grpc.py b/hub/schema/types/v2/hub_pb2_grpc.py similarity index 100% rename from scribe/schema/types/v2/hub_pb2_grpc.py rename to hub/schema/types/v2/hub_pb2_grpc.py diff --git a/scribe/schema/types/v2/purchase_pb2.py b/hub/schema/types/v2/purchase_pb2.py similarity index 100% rename from scribe/schema/types/v2/purchase_pb2.py rename to hub/schema/types/v2/purchase_pb2.py diff --git a/scribe/schema/types/v2/result_pb2.py b/hub/schema/types/v2/result_pb2.py similarity index 100% rename from scribe/schema/types/v2/result_pb2.py rename to hub/schema/types/v2/result_pb2.py diff --git a/scribe/schema/types/v2/result_pb2_grpc.py b/hub/schema/types/v2/result_pb2_grpc.py similarity index 100% rename from scribe/schema/types/v2/result_pb2_grpc.py rename to hub/schema/types/v2/result_pb2_grpc.py diff --git a/scribe/schema/types/v2/support_pb2.py b/hub/schema/types/v2/support_pb2.py similarity index 100% rename from scribe/schema/types/v2/support_pb2.py rename to hub/schema/types/v2/support_pb2.py diff --git a/scribe/schema/url.py b/hub/schema/url.py similarity index 100% rename from scribe/schema/url.py rename to hub/schema/url.py diff --git a/scribe/service.py b/hub/service.py similarity index 97% rename from scribe/service.py rename to hub/service.py index d2227fd..52ddaf1 100644 --- a/scribe/service.py +++ b/hub/service.py @@ -5,12 +5,12 @@ import signal from concurrent.futures.thread import ThreadPoolExecutor from prometheus_client import Gauge, Histogram -from scribe import __version__, PROMETHEUS_NAMESPACE -from scribe.env import Env -from scribe.db import HubDB -from scribe.db.prefixes import DBState -from scribe.common import HISTOGRAM_BUCKETS -from scribe.metrics import PrometheusServer +from hub import __version__, PROMETHEUS_NAMESPACE +from hub.env import Env +from hub.db import HubDB +from hub.db.prefixes import DBState +from hub.common import HISTOGRAM_BUCKETS +from hub.metrics import PrometheusServer class BlockchainService: diff --git a/scribe/blockchain/__init__.py b/scribe/blockchain/__init__.py deleted file mode 100644 index 8e0dfca..0000000 --- a/scribe/blockchain/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from scribe.blockchain.network import LBCTestNet, LBCRegTest, LBCMainNet diff --git a/scribe/elasticsearch/__init__.py b/scribe/elasticsearch/__init__.py deleted file mode 100644 index 68591c9..0000000 --- a/scribe/elasticsearch/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from scribe.elasticsearch.search import SearchIndex -from scribe.elasticsearch.notifier_protocol import ElasticNotifierClientProtocol \ No newline at end of file diff --git a/setup.py b/setup.py index c546d40..f065699 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ import os -from scribe import __name__, __version__ +from hub import __name__, __version__ from setuptools import setup, find_packages BASE = os.path.dirname(__file__) diff --git a/tests/test_resolve_command.py b/tests/test_resolve_command.py index 6a266df..8d99fb9 100644 --- a/tests/test_resolve_command.py +++ b/tests/test_resolve_command.py @@ -8,7 +8,7 @@ from collections import defaultdict from typing import NamedTuple, List from lbry.testcase import CommandTestCase from lbry.wallet.transaction import Transaction, Output -from scribe.schema.compat import OldClaimMessage +from hub.schema.compat import OldClaimMessage from lbry.crypto.hash import sha256 from lbry.crypto.base58 import Base58 diff --git a/tests/test_revertable.py b/tests/test_revertable.py index 3d566f0..d6b0dce 100644 --- a/tests/test_revertable.py +++ b/tests/test_revertable.py @@ -1,8 +1,8 @@ import unittest import tempfile import shutil -from scribe.db.revertable import RevertableOpStack, RevertableDelete, RevertablePut, OpStackIntegrity -from scribe.db.prefixes import ClaimToTXOPrefixRow, PrefixDB +from hub.db.revertable import RevertableOpStack, RevertableDelete, RevertablePut, OpStackIntegrity +from hub.db.prefixes import ClaimToTXOPrefixRow, PrefixDB class TestRevertableOpStack(unittest.TestCase): diff --git a/tests/testcase.py b/tests/testcase.py index f9d3865..e31dceb 100644 --- a/tests/testcase.py +++ b/tests/testcase.py @@ -20,7 +20,7 @@ from lbry.wallet.util import satoshis_to_coins from lbry.wallet.dewies import lbc_to_dewies from lbry.wallet.orchstr8 import Conductor from lbry.wallet.orchstr8.node import LBCWalletNode, WalletNode, HubNode -from scribe.schema.claim import Claim +from hub.schema.claim import Claim from lbry.extras.daemon.daemon import Daemon, jsonrpc_dumps_pretty from lbry.extras.daemon.components import Component, WalletComponent