Change QuotaholderSync to QuotaholderSerial
authorSofia Papagiannaki <papagian@gmail.com>
Tue, 11 Sep 2012 12:50:21 +0000 (15:50 +0300)
committerSofia Papagiannaki <papagian@gmail.com>
Tue, 11 Sep 2012 12:50:21 +0000 (15:50 +0300)
snf-pithos-backend/pithos/backends/lib/sqlalchemy/__init__.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/quotaholder_serials.py [moved from snf-pithos-backend/pithos/backends/lib/sqlalchemy/quotaholder_sync.py with 95% similarity]
snf-pithos-backend/pithos/backends/lib/sqlite/__init__.py
snf-pithos-backend/pithos/backends/lib/sqlite/quotaholder_serials.py [moved from snf-pithos-backend/pithos/backends/lib/sqlite/quotaholder_sync.py with 54% similarity]
snf-pithos-backend/pithos/backends/modular.py

index ef73907..20b38d6 100644 (file)
@@ -35,8 +35,8 @@ from dbwrapper import DBWrapper
 from node import Node, ROOTNODE, SERIAL, HASH, SIZE, TYPE, MTIME, MUSER, UUID, CHECKSUM, CLUSTER, MATCH_PREFIX, MATCH_EXACT
 from permissions import Permissions, READ, WRITE
 from config import Config
-from quotaholder_sync import QuotaholderSync
+from quotaholder_serials import QuotaholderSerial
 
 __all__ = ["DBWrapper",
            "Node", "ROOTNODE", "SERIAL", "HASH", "SIZE", "TYPE", "MTIME", "MUSER", "UUID", "CHECKSUM", "CLUSTER", "MATCH_PREFIX", "MATCH_EXACT",
-           "Permissions", "READ", "WRITE", "Config", "QuotaholderSync"]
+           "Permissions", "READ", "WRITE", "Config", "QuotaholderSerial"]
@@ -47,8 +47,8 @@ def create_tables(engine):
     metadata.create_all(engine)
     return metadata.sorted_tables
 
-class QuotaholderSync(DBWorker):
-    """QuotaholderSync are entries for syncing with quota holder.
+class QuotaholderSerial(DBWorker):
+    """QuotaholderSerial keeps track of quota holder serials.
     """
 
     def __init__(self, **params):
index 04201c2..67516e6 100644 (file)
@@ -35,8 +35,8 @@ from dbwrapper import DBWrapper
 from node import Node, ROOTNODE, SERIAL, HASH, SIZE, TYPE, MTIME, MUSER, UUID, CHECKSUM, CLUSTER, MATCH_PREFIX, MATCH_EXACT
 from permissions import Permissions, READ, WRITE
 from config import Config
-from quotaholder_sync import QuotaholderSync
+from quotaholder_serials import QuotaholderSerial
 
 __all__ = ["DBWrapper",
            "Node", "ROOTNODE", "SERIAL", "HASH", "SIZE", "TYPE", "MTIME", "MUSER", "UUID", "CHECKSUM", "CLUSTER", "MATCH_PREFIX", "MATCH_EXACT",
-           "Permissions", "READ", "WRITE", "Config", "QuotaholderSync"]
\ No newline at end of file
+           "Permissions", "READ", "WRITE", "Config", "QuotaholderSerial"]
\ No newline at end of file
 
 from dbworker import DBWorker
 
-
-class Public(DBWorker):
-    """Paths can be marked as public."""
-
-    def __init__(self, **params):
-        DBWorker.__init__(self, **params)
-        execute = self.execute
-
-        execute(""" create table if not exists public
-                          ( public_id integer primary key autoincrement,
-                            path      text not null,
-                            active    boolean not null default 1 ) """)
-        execute(""" create unique index if not exists idx_public_path
-                    on public(path) """)
-
-    def public_set(self, path):
-        q = "insert or ignore into public (path) values (?)"
-        self.execute(q, (path,))
-        q = "update public set active = 1 where path = ?"
-        self.execute(q, (path,))
-
-    def public_unset(self, path):
-        q = "update public set active = 0 where path = ?"
-        self.execute(q, (path,))
-
-    def public_unset_bulk(self, paths):
-        placeholders = ','.join('?' for path in paths)
-        q = "update public set active = 0 where path in (%s)" % placeholders
-        self.execute(q, paths)
-
-    def public_get(self, path):
-        q = "select public_id from public where path = ? and active = 1"
-        self.execute(q, (path,))
-        row = self.fetchone()
-        if row:
-            return row[0]
-        return None
-
-    def public_list(self, prefix):
-        q = "select path, public_id from public where path like ? escape '\\' and active = 1"
-        self.execute(q, (self.escape_like(prefix) + '%',))
-        return self.fetchall()
-
-    def public_path(self, public):
-        q = "select path from public where public_id = ? and active = 1"
-        self.execute(q, (public,))
-        row = self.fetchone()
-        if row:
-            return row[0]
-        return None
-
-class QuotaholderSync(DBWorker):
-    """QuotaholderSync are entries for syncing with quota holder.
+class QuotaholderSerial(DBWorker):
+    """QuotaholderSerial keeps track of quota holder serials.
     """
 
     def __init__(self, **params):
index d8a2455..8d4899c 100644 (file)
@@ -154,7 +154,7 @@ class ModularBackend(BaseBackend):
         params = {'wrapper': self.wrapper}
         self.permissions = self.db_module.Permissions(**params)
         self.config = self.db_module.Config(**params)
-        self.quotaholder_sync = self.db_module.QuotaholderSync(**params)
+        self.quotaholder_serials = self.db_module.QuotaholderSerial(**params)
         for x in ['READ', 'WRITE']:
             setattr(self, x, getattr(self.db_module, x))
         self.node = self.db_module.Node(**params)