Пример #1
0
 def __init__(self, manager=None):
     if manager is None:
         manager = MockTransactionManager()
     self._manager = manager
     self._tid = 1
     self.modified = {}
     self.request = None
     self._strategy = getMultiAdapter(
         (manager._storage, self), ITransactionStrategy,
         name=manager._storage._transaction_strategy)
     self._cache = DummyCache(manager._storage, self)
Пример #2
0
    def __init__(self,
                 utility,
                 context,
                 response=noop_response,
                 force=False,
                 log_details=False,
                 memory_tracking=False,
                 request=None,
                 bulk_size=40,
                 full=False,
                 reindex_security=False,
                 mapping_only=False):
        self.utility = utility
        self.conn = utility.conn
        self.context = context
        self.response = response
        self.force = force
        self.full = full
        self.log_details = log_details
        self.memory_tracking = memory_tracking
        self.bulk_size = bulk_size
        self.reindex_security = reindex_security
        if mapping_only and full:
            raise Exception(
                'Can not do a full reindex and a mapping only migration')
        self.mapping_only = mapping_only

        if request is None:
            self.request = get_current_request()
            self.request._db_write_enabled = False
        else:
            self.request = request
        # make sure that we don't cache requests...
        self.request._txn._cache = DummyCache(self.request._txn)
        self.container = self.request.container
        self.interaction = IInteraction(self.request)
        self.indexer = Indexer()

        self.batch = {}
        self.indexed = 0
        self.processed = 0
        self.missing = []
        self.orphaned = []
        self.existing = []
        self.errors = []
        self.mapping_diff = {}
        self.start_time = self.index_start_time = time.time()
        self.reindex_futures = []
        self.status = 'started'
        self.active_task_id = None

        self.copied_docs = 0

        self.work_index_name = None
Пример #3
0
 def __init__(self, manager=None):
     if manager is None:
         manager = MockTransactionManager()
     self._manager = manager
     self._tid = 1
     self.modified = {}
     self.request = None
     self._strategy = get_adapter(
         self, ITransactionStrategy,
         name=manager._storage._transaction_strategy)
     self._cache = DummyCache(self)
     self._lock = asyncio.Lock()
     self._status = 'started'
Пример #4
0
 def __init__(self, manager=None):
     if manager is None:
         manager = MockTransactionManager()
     self._manager = self.manager = manager
     self._tid = 1
     self.modified = OrderedDict()
     self.added = OrderedDict()
     self.request = None
     self._strategy = query_adapter(
         self, ITransactionStrategy, name=manager._storage._transaction_strategy
     )
     self._cache = DummyCache(self)
     self._lock = asyncio.Lock()
     self._status = "started"
     self._db_conn = None
     self.storage = MockStorage()
Пример #5
0
    def __init__(
        self,
        utility,
        context,
        response=noop_response,
        force=False,
        log_details=False,
        memory_tracking=False,
        request=None,
        bulk_size=40,
        full=False,
        reindex_security=False,
        mapping_only=False,
        index_manager=None,
        children_only=False,
        lookup_index=False,
        cache=True,
    ):
        self.utility = utility
        self.context = context
        self.response = response
        self.force = force
        self.full = full
        self.log_details = log_details
        self.memory_tracking = memory_tracking
        self.bulk_size = bulk_size
        self.reindex_security = reindex_security
        self.children_only = children_only
        self.lookup_index = lookup_index
        if mapping_only and full:
            raise Exception("Can not do a full reindex and a mapping only migration")
        self.mapping_only = mapping_only

        self.txn = get_current_transaction()
        if not cache:
            # make sure that we don't cache requests...
            self.txn._cache = DummyCache(self.txn)

        self.request = request
        self.container = get_current_container()
        self.conn = utility.get_connection()

        if index_manager is None:
            self.index_manager = get_adapter(self.container, IIndexManager)
        else:
            self.index_manager = index_manager

        self.user = get_authenticated_user()
        self.policy = get_security_policy(self.user)
        self.indexer = Indexer()

        self.batch = {}
        self.indexed = 0
        self.processed = 0
        self.missing = []
        self.orphaned = []
        self.existing = []
        self.errors = []
        self.mapping_diff = {}
        self.start_time = self.index_start_time = time.time()
        self.reindex_futures = []
        self.status = "started"
        self.active_task_id = None

        self.copied_docs = 0

        self.work_index_name = None
        self.sub_indexes = []