[multi-sources-removal] drop repository entities_modified_since public api
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 17 Jun 2013 00:07:35 +0200
changeset 9449 287a05ec7ab1
parent 9448 3e7cad3967c5
child 9450 af4b93bc38a5
[multi-sources-removal] drop repository entities_modified_since public api actually only used by pyrorql/zmqrql sources which have been dropped. This will allow to drop a bunch of system meta-data (eg deleted_entities) Related to #2919300
server/repository.py
server/sources/__init__.py
server/test/unittest_repository.py
--- a/server/repository.py	Tue Jan 21 18:11:30 2014 +0100
+++ b/server/repository.py	Mon Jun 17 00:07:35 2013 +0200
@@ -883,25 +883,6 @@
         finally:
             session.free_cnxset()
 
-    # public (inter-repository) interface #####################################
-
-    def entities_modified_since(self, etypes, mtime):
-        """function designed to be called from an external repository which
-        is using this one as a rql source for synchronization, and return a
-        3-uple containing :
-        * the local date
-        * list of (etype, eid) of entities of the given types which have been
-          modified since the given timestamp (actually entities whose full text
-          index content has changed)
-        * list of (etype, eid) of entities of the given types which have been
-          deleted since the given timestamp
-        """
-        with self.internal_session() as session:
-            updatetime = datetime.utcnow()
-            modentities, delentities = self.system_source.modified_entities(
-                session, etypes, mtime)
-            return updatetime, modentities, delentities
-
     # session handling ########################################################
 
     def close_sessions(self):
--- a/server/sources/__init__.py	Tue Jan 21 18:11:30 2014 +0100
+++ b/server/sources/__init__.py	Mon Jun 17 00:07:35 2013 +0200
@@ -470,16 +470,6 @@
         """
         raise NotImplementedError(self)
 
-    def modified_entities(self, session, etypes, mtime):
-        """return a 2-uple:
-        * list of (etype, eid) of entities of the given types which have been
-          modified since the given timestamp (actually entities whose full text
-          index content has changed)
-        * list of (etype, eid) of entities of the given types which have been
-          deleted since the given timestamp
-        """
-        raise NotImplementedError(self)
-
     def index_entity(self, session, entity):
         """create an operation to [re]index textual content of the given entity
         on commit
--- a/server/test/unittest_repository.py	Tue Jan 21 18:11:30 2014 +0100
+++ b/server/test/unittest_repository.py	Mon Jun 17 00:07:35 2013 +0200
@@ -709,38 +709,6 @@
 
 class FTITC(CubicWebTC):
 
-    def test_reindex_and_modified_since(self):
-        self.repo.system_source.multisources_etypes.add('Personne')
-        eidp = self.execute('INSERT Personne X: X nom "toto", X prenom "tutu"')[0][0]
-        self.commit()
-        ts = datetime.now()
-        self.assertEqual(len(self.execute('Personne X WHERE X has_text "tutu"')), 1)
-        self.session.set_cnxset()
-        cu = self.session.system_sql('SELECT mtime, eid FROM entities WHERE eid = %s' % eidp)
-        omtime = cu.fetchone()[0]
-        # our sqlite datetime adapter is ignore seconds fraction, so we have to
-        # ensure update is done the next seconds
-        time.sleep(1 - (ts.second - int(ts.second)))
-        self.execute('SET X nom "tata" WHERE X eid %(x)s', {'x': eidp})
-        self.commit()
-        self.assertEqual(len(self.execute('Personne X WHERE X has_text "tutu"')), 1)
-        self.session.set_cnxset()
-        cu = self.session.system_sql('SELECT mtime FROM entities WHERE eid = %s' % eidp)
-        mtime = cu.fetchone()[0]
-        self.assertTrue(omtime < mtime)
-        self.commit()
-        date, modified, deleted = self.repo.entities_modified_since(('Personne',), omtime)
-        self.assertEqual(modified, [('Personne', eidp)])
-        self.assertEqual(deleted, [])
-        date, modified, deleted = self.repo.entities_modified_since(('Personne',), mtime)
-        self.assertEqual(modified, [])
-        self.assertEqual(deleted, [])
-        self.execute('DELETE Personne X WHERE X eid %(x)s', {'x': eidp})
-        self.commit()
-        date, modified, deleted = self.repo.entities_modified_since(('Personne',), omtime)
-        self.assertEqual(modified, [])
-        self.assertEqual(deleted, [('Personne', eidp)])
-
     def test_fulltext_container_entity(self):
         assert self.schema.rschema('use_email').fulltext_container == 'subject'
         req = self.request()