readers->reader

This commit is contained in:
Jack Robison 2022-03-08 21:09:24 -05:00
parent cd72c8b080
commit bcb0dedad1
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
9 changed files with 14 additions and 23 deletions

View file

@ -4,9 +4,9 @@ Scribe maintains a rocksdb database containing the [LBRY blockchain](https://git
* Protobuf schema for encoding and decoding metadata stored on the blockchain ([scribe.schema](https://github.com/lbryio/scribe/tree/master/scribe/schema)). * Protobuf schema for encoding and decoding metadata stored on the blockchain ([scribe.schema](https://github.com/lbryio/scribe/tree/master/scribe/schema)).
* Blockchain processor that maintains an up to date rocksdb database ([scribe.blockchain](https://github.com/lbryio/scribe/tree/master/scribe/blockchain)) * Blockchain processor that maintains an up to date rocksdb database ([scribe.blockchain](https://github.com/lbryio/scribe/tree/master/scribe/blockchain))
* Rocksdb based database containing the blockchain data ([scribe.db](https://github.com/lbryio/scribe/tree/master/scribe/db)) * Rocksdb based database containing the blockchain data ([scribe.db](https://github.com/lbryio/scribe/tree/master/scribe/db))
* Interface for python services to implement in order for them maintain a read only view of the blockchain data ([scribe.readers.interface](https://github.com/lbryio/scribe/tree/master/scribe/readers/interface.py)) * Interface for python services to implement in order for them maintain a read only view of the blockchain data ([scribe.reader.interface](https://github.com/lbryio/scribe/tree/master/scribe/reader/interface.py))
* Electrum based server for thin-wallet clients like lbry-sdk ([scribe.readers.hub_server](https://github.com/lbryio/scribe/tree/master/scribe/readers/hub_server.py)) * Electrum based server for thin-wallet clients like lbry-sdk ([scribe.reader.hub_server](https://github.com/lbryio/scribe/tree/master/scribe/reader/hub_server.py))
* Elasticsearch sync utility to index all the claim metadata in the blockchain into an easily searchable form ([scribe.readers.elastic_sync](https://github.com/lbryio/scribe/tree/master/scribe/readers/elastic_sync.py)) * Elasticsearch sync utility to index all the claim metadata in the blockchain into an easily searchable form ([scribe.reader.elastic_sync](https://github.com/lbryio/scribe/tree/master/scribe/reader/elastic_sync.py))
## Installation ## Installation

View file

@ -3,7 +3,7 @@ import traceback
import argparse import argparse
from scribe.env import Env from scribe.env import Env
from scribe.blockchain.block_processor import BlockProcessor from scribe.blockchain.block_processor import BlockProcessor
from scribe.readers import BlockchainReaderServer, ElasticWriter from scribe.reader import BlockchainReaderServer, ElasticWriter
def get_arg_parser(name): def get_arg_parser(name):

View file

@ -1,16 +1,7 @@
import logging
import itertools
import time
import json
import typing
import asyncio
import inspect import inspect
from asyncio import Event
from collections import namedtuple from collections import namedtuple
from functools import partial, lru_cache from functools import lru_cache
from numbers import Number from scribe.common import CodeMessageError
from asyncio import Queue
from scribe.common import RPCError, CodeMessageError
HISTOGRAM_BUCKETS = ( HISTOGRAM_BUCKETS = (

View file

@ -21,7 +21,6 @@ from scribe.base58 import Base58Error
from scribe.error import ResolveCensoredError, TooManyClaimSearchParametersError from scribe.error import ResolveCensoredError, TooManyClaimSearchParametersError
from scribe import __version__, PROTOCOL_MIN, PROTOCOL_MAX, PROMETHEUS_NAMESPACE from scribe import __version__, PROTOCOL_MIN, PROTOCOL_MAX, PROMETHEUS_NAMESPACE
from scribe.build_info import BUILD, COMMIT_HASH, DOCKER_TAG from scribe.build_info import BUILD, COMMIT_HASH, DOCKER_TAG
from scribe.db import HubDB
from scribe.elasticsearch import SearchIndex 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 sha256, hash_to_hex_str, hex_str_to_hash, HASHX_LEN, version_string, formatted_time
from scribe.common import protocol_version, RPCError, DaemonError, TaskGroup from scribe.common import protocol_version, RPCError, DaemonError, TaskGroup
@ -29,6 +28,7 @@ from scribe.hub.jsonrpc import JSONRPCAutoDetect, JSONRPCConnection, JSONRPCv2,
from scribe.hub.common import BatchRequest, ProtocolError, Request, Batch, Notification from scribe.hub.common import BatchRequest, ProtocolError, Request, Batch, Notification
from scribe.hub.framer import NewlineFramer from scribe.hub.framer import NewlineFramer
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from scribe.db import HubDB
from scribe.env import Env from scribe.env import Env
from scribe.blockchain.daemon import LBCDaemon from scribe.blockchain.daemon import LBCDaemon
from scribe.hub.mempool import MemPool from scribe.hub.mempool import MemPool
@ -249,7 +249,7 @@ class SessionManager:
namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS
) )
def __init__(self, env: 'Env', db: HubDB, mempool: 'MemPool', history_cache, resolve_cache, resolve_outputs_cache, def __init__(self, env: 'Env', db: 'HubDB', mempool: 'MemPool', history_cache, resolve_cache, resolve_outputs_cache,
daemon: 'LBCDaemon', shutdown_event: asyncio.Event, daemon: 'LBCDaemon', shutdown_event: asyncio.Event,
on_available_callback: typing.Callable[[], None], on_unavailable_callback: typing.Callable[[], None]): on_available_callback: typing.Callable[[], None], on_unavailable_callback: typing.Callable[[], None]):
env.max_send = max(350000, env.max_send) env.max_send = max(350000, env.max_send)
@ -1144,7 +1144,7 @@ class LBRYElectrumX(SessionBase):
self.protocol_tuple = self.PROTOCOL_MIN self.protocol_tuple = self.PROTOCOL_MIN
self.protocol_string = None self.protocol_string = None
self.daemon = self.session_manager.daemon self.daemon = self.session_manager.daemon
self.db: HubDB = self.session_manager.db self.db: 'HubDB' = self.session_manager.db
@classmethod @classmethod
def protocol_min_max_strings(cls): def protocol_min_max_strings(cls):

View file

@ -0,0 +1,3 @@
from scribe.reader.interface import BaseBlockchainReader
from scribe.reader.hub_server import BlockchainReaderServer
from scribe.reader.elastic_sync import ElasticWriter

View file

@ -17,7 +17,7 @@ from scribe.elasticsearch.notifier_protocol import ElasticNotifierProtocol
from scribe.elasticsearch.search import IndexVersionMismatch, expand_query from scribe.elasticsearch.search import IndexVersionMismatch, expand_query
from scribe.elasticsearch.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS from scribe.elasticsearch.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS
from scribe.elasticsearch.fast_ar_trending import FAST_AR_TRENDING_SCRIPT from scribe.elasticsearch.fast_ar_trending import FAST_AR_TRENDING_SCRIPT
from scribe.readers import BaseBlockchainReader from scribe.reader import BaseBlockchainReader
from scribe.db.revertable import RevertableOp from scribe.db.revertable import RevertableOp
from scribe.db.common import TrendingNotification, DB_PREFIXES from scribe.db.common import TrendingNotification, DB_PREFIXES

View file

@ -3,7 +3,7 @@ import asyncio
import typing import typing
from scribe import __version__ from scribe import __version__
from scribe.blockchain.daemon import LBCDaemon from scribe.blockchain.daemon import LBCDaemon
from scribe.readers import BaseBlockchainReader from scribe.reader import BaseBlockchainReader
from scribe.elasticsearch import ElasticNotifierClientProtocol from scribe.elasticsearch import ElasticNotifierClientProtocol
from scribe.hub.session import SessionManager from scribe.hub.session import SessionManager
from scribe.hub.mempool import MemPool from scribe.hub.mempool import MemPool

View file

@ -1,3 +0,0 @@
from scribe.readers.interface import BaseBlockchainReader
from scribe.readers.hub_server import BlockchainReaderServer
from scribe.readers.elastic_sync import ElasticWriter