예제 #1
0
    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)
예제 #2
0
 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()))
예제 #3
0
    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)
예제 #4
0
 def __init__(self, indexer: DocumentIndexer, logger=None):
     self.logger = default_value(logger, ErtLogger(Print()))
     self.indexer = indexer
     self.idx = self.indexer.idx