move notifier_protocol.py

This commit is contained in:
Jack Robison 2022-05-18 12:02:08 -04:00
parent 301a0ca66d
commit 30e295ec28
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
7 changed files with 12 additions and 13 deletions

View file

@ -398,3 +398,9 @@ class TaskGroup:
task.cancel() task.cancel()
self.done.set() self.done.set()
self.started.clear() self.started.clear()
class IndexVersionMismatch(Exception):
def __init__(self, got_version, expected_version):
self.got_version = got_version
self.expected_version = expected_version

View file

@ -1,2 +0,0 @@
from hub.elastic_sync.search import SearchIndex
from hub.elastic_sync.notifier_protocol import ElasticNotifierClientProtocol

View file

@ -12,7 +12,7 @@ from hub.schema.result import Censor, Outputs
from hub.schema.tags import clean_tags from hub.schema.tags import clean_tags
from hub.schema.url import normalize_name from hub.schema.url import normalize_name
from hub.error import TooManyClaimSearchParametersError from hub.error import TooManyClaimSearchParametersError
from hub.common import LRUCache from hub.common import LRUCache, IndexVersionMismatch
from hub.db.common import CLAIM_TYPES, STREAM_TYPES from hub.db.common import CLAIM_TYPES, STREAM_TYPES
from hub.elastic_sync.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, RANGE_FIELDS from hub.elastic_sync.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, RANGE_FIELDS
from hub.db.common import ResolveResult from hub.db.common import ResolveResult
@ -32,12 +32,6 @@ class StreamResolution(str):
return LookupError(f'Could not find claim at "{url}".') return LookupError(f'Could not find claim at "{url}".')
class IndexVersionMismatch(Exception):
def __init__(self, got_version, expected_version):
self.got_version = got_version
self.expected_version = expected_version
class SearchIndex: class SearchIndex:
VERSION = 1 VERSION = 1

View file

@ -7,10 +7,11 @@ from elasticsearch import AsyncElasticsearch, NotFoundError
from elasticsearch.helpers import async_streaming_bulk from elasticsearch.helpers import async_streaming_bulk
from hub.schema.result import Censor from hub.schema.result import Censor
from hub.service import BlockchainReaderService from hub.service import BlockchainReaderService
from hub.common import IndexVersionMismatch
from hub.db.revertable import RevertableOp from hub.db.revertable import RevertableOp
from hub.db.common import TrendingNotification, DB_PREFIXES from hub.db.common import TrendingNotification, DB_PREFIXES
from hub.elastic_sync.notifier_protocol import ElasticNotifierProtocol from hub.notifier_protocol import ElasticNotifierProtocol
from hub.elastic_sync.search import IndexVersionMismatch, expand_query from hub.elastic_sync.search import expand_query
from hub.elastic_sync.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS from hub.elastic_sync.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS
from hub.elastic_sync.fast_ar_trending import FAST_AR_TRENDING_SCRIPT from hub.elastic_sync.fast_ar_trending import FAST_AR_TRENDING_SCRIPT
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:

View file

@ -6,7 +6,7 @@ from hub.herald.session import SessionManager
from hub.herald.mempool import HubMemPool from hub.herald.mempool import HubMemPool
from hub.herald.udp import StatusServer from hub.herald.udp import StatusServer
from hub.service import BlockchainReaderService from hub.service import BlockchainReaderService
from hub.elastic_sync import ElasticNotifierClientProtocol from hub.notifier_protocol import ElasticNotifierClientProtocol
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from hub.herald.env import ServerEnv from hub.herald.env import ServerEnv

View file

@ -20,7 +20,7 @@ from hub.error import ResolveCensoredError, TooManyClaimSearchParametersError
from hub import __version__, PROMETHEUS_NAMESPACE from hub import __version__, PROMETHEUS_NAMESPACE
from hub.herald import PROTOCOL_MIN, PROTOCOL_MAX, HUB_PROTOCOL_VERSION from hub.herald import PROTOCOL_MIN, PROTOCOL_MAX, HUB_PROTOCOL_VERSION
from hub.build_info import BUILD, COMMIT_HASH, DOCKER_TAG from hub.build_info import BUILD, COMMIT_HASH, DOCKER_TAG
from hub.elastic_sync import SearchIndex from hub.elastic_sync.search 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 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.common import protocol_version, RPCError, DaemonError, TaskGroup, HISTOGRAM_BUCKETS
from hub.herald.jsonrpc import JSONRPCAutoDetect, JSONRPCConnection, JSONRPCv2, JSONRPC from hub.herald.jsonrpc import JSONRPCAutoDetect, JSONRPCConnection, JSONRPCv2, JSONRPC