def __init__( self, collection_name: str, dhf: DHTFacade, own_guid_hex, key_composer=None, logger=None, ): self.collection_name = collection_name self.collection_name_present = '.%s.present' % collection_name self.collection_name_deleted = '.%s.deleted' % collection_name self.model_class_name = '.%s.model' % collection_name self.own_guid_hex = own_guid_hex self.dhf = dhf self._key_compose = key_composer self.logger = default_value(logger, ErtLogger(logger=Print())) self.dl_deleted = instance_dl( dhf=dhf, hex=self.own_guid_hex, collection_name=self.collection_name_deleted) self.dl_present = instance_dl( dhf=dhf, hex=self.own_guid_hex, collection_name=self.collection_name_present)
def __init__(self, document_indexer: DocumentIndexer, logger=None): if logger: self.logger = logger else: self.logger = ErtLogger(Print()) self.idx = document_indexer.idx self.idx_store = document_indexer.idx.index_store
def __init__( self, db_name, table_name, logger=None, ): self.db = InvIndexTimestampSQLite( db_name=db_name, table_name=table_name, ) self.idx = ResourceIndexingEngine(self.db) self.logger = default_value(logger, ErtLogger(logger=Print()))
def __init__( self, store_handler: DHTStoreHandlerOne, logger=None, data_dir=None, ): self.logger = default_value(logger, ErtLogger(Print())) self.store_handler = store_handler self.store_handler.on_pull_handle = self.on_pull self.store_handler.on_push_handle = self.on_push self.data_dir = data_dir if not data_dir: raise ValueError('Setup data dir for EventHandle index db files') self.doc_indexers = DocModelIndexers(data_dir=self.data_dir)
from .bucketset import BucketSet # from .hashing import hash_function, random_id # from .hashing import random_id # from toolkit.kadmini_codec import hash_function from .peer import Peer, PeerC # from .storage import Shelve from .shortlist import Shortlist # from . import hashing from toolkit import kadmini_codec from ert_profile import EthearnalProfileController import config cdx = kadmini_codec from toolkit.tools import Print, ErtLogger logger = ErtLogger(Print()) # k = 20 # alpha = 3 # id_bits = 128 id_bits = kadmini_codec.id_bits # iteration_sleep = 0.1 # all the things have to be bson encoded class DHTFacade(object):
def __init__(self, indexer: DocumentIndexer, logger=None): self.logger = default_value(logger, ErtLogger(Print())) self.indexer = indexer self.idx = self.indexer.idx