[CalendarServer-changes] [7623] CalendarServer/branches/users/glyph/quota
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 20 11:45:24 PDT 2011
Revision: 7623
http://trac.macosforge.org/projects/calendarserver/changeset/7623
Author: glyph at apple.com
Date: 2011-06-20 11:45:24 -0700 (Mon, 20 Jun 2011)
Log Message:
-----------
add quota argument, documentation to store constructors
Modified Paths:
--------------
CalendarServer/branches/users/glyph/quota/calendarserver/tap/util.py
CalendarServer/branches/users/glyph/quota/txdav/common/datastore/file.py
CalendarServer/branches/users/glyph/quota/txdav/common/datastore/sql.py
Modified: CalendarServer/branches/users/glyph/quota/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/quota/calendarserver/tap/util.py 2011-06-20 18:45:12 UTC (rev 7622)
+++ CalendarServer/branches/users/glyph/quota/calendarserver/tap/util.py 2011-06-20 18:45:24 UTC (rev 7623)
@@ -190,11 +190,15 @@
if txnFactory is not None:
return CommonSQLDataStore(
txnFactory, notifierFactory, FilePath(config.AttachmentsRoot),
- config.EnableCalDAV, config.EnableCardDAV
+ config.EnableCalDAV, config.EnableCardDAV,
+ quota=config.UserQuota
)
else:
- return CommonFileDataStore(FilePath(config.DocumentRoot),
- notifierFactory, config.EnableCalDAV, config.EnableCardDAV)
+ return CommonFileDataStore(
+ FilePath(config.DocumentRoot),
+ notifierFactory, config.EnableCalDAV, config.EnableCardDAV,
+ quota=config.UserQuota
+ )
Modified: CalendarServer/branches/users/glyph/quota/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/quota/txdav/common/datastore/file.py 2011-06-20 18:45:12 UTC (rev 7622)
+++ CalendarServer/branches/users/glyph/quota/txdav/common/datastore/file.py 2011-06-20 18:45:24 UTC (rev 7623)
@@ -75,15 +75,21 @@
class CommonDataStore(DataStore):
"""
- An implementation of data store.
+ Shared logic for SQL-based data stores, between calendar and addressbook
+ storage.
@ivar _path: A L{CachingFilePath} referencing a directory on disk that
stores all calendar and addressbook data for a group of UIDs.
+
+ @ivar quota: the amount of space granted to each calendar home (in bytes)
+ for storing attachments.
+
+ @type quota: C{int}
"""
implements(ICalendarStore)
def __init__(self, path, notifierFactory, enableCalendars=True,
- enableAddressBooks=True):
+ enableAddressBooks=True, quota=(2 ** 20)):
"""
Create a store.
@@ -96,6 +102,7 @@
self.enableAddressBooks = enableAddressBooks
self._notifierFactory = notifierFactory
self._transactionClass = CommonStoreTransaction
+ self.quota = quota
def newTransaction(self, name='no name', migrating=False):
Modified: CalendarServer/branches/users/glyph/quota/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/quota/txdav/common/datastore/sql.py 2011-06-20 18:45:12 UTC (rev 7622)
+++ CalendarServer/branches/users/glyph/quota/txdav/common/datastore/sql.py 2011-06-20 18:45:24 UTC (rev 7623)
@@ -93,12 +93,39 @@
}
class CommonDataStore(Service, object):
+ """
+ Shared logic for SQL-based data stores, between calendar and addressbook
+ storage.
+ @ivar sqlTxnFactory: A 0-arg factory callable that produces an
+ L{IAsyncTransaction}.
+
+ @ivar notifierFactory: a L{twistedcaldav.notify.NotifierFactory} (or
+ similar) that produces new notifiers for homes and collections.
+
+ @ivar attachmentsPath: a L{FilePath} indicating a directory where
+ attachments may be stored.
+
+ @ivar enableCalendars: a boolean, C{True} if this data store should provide
+ L{ICalendarStore}, C{False} if not.
+
+ @ivar enableAddressBooks: a boolean, C{True} if this data store should
+ provide L{IAddressbookStore}, C{False} if not.
+
+ @ivar label: A string, used for tagging debug messages in the case where
+ there is more than one store. (Useful mostly for unit tests.)
+
+ @ivar quota: the amount of space granted to each calendar home (in bytes)
+ for storing attachments.
+
+ @type quota: C{int}
+ """
+
implements(ICalendarStore)
def __init__(self, sqlTxnFactory, notifierFactory, attachmentsPath,
enableCalendars=True, enableAddressBooks=True,
- label="unlabeled"):
+ label="unlabeled", quota=(2 ** 20)):
assert enableCalendars or enableAddressBooks
self.sqlTxnFactory = sqlTxnFactory
@@ -107,6 +134,7 @@
self.enableCalendars = enableCalendars
self.enableAddressBooks = enableAddressBooks
self.label = label
+ self.quota = quota
def eachCalendarHome(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110620/cab64d7a/attachment.html>
More information about the calendarserver-changes
mailing list