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"]
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):
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):
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)