]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix bugs in Accountant.
authorDaira Hopwood <daira@jacaranda.org>
Wed, 12 Dec 2012 06:54:02 +0000 (06:54 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 17 Apr 2015 21:31:02 +0000 (22:31 +0100)
Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
src/allmydata/storage/accountant.py

index 6521ee4ded584c0c539f1aeac98d1602982933ae..e7c53ccfe6af8d8451c80204512c80340bc10dc3 100644 (file)
@@ -1,15 +1,12 @@
 
 """
 This file contains the cross-account management code. It creates per-client
-Account objects for the FURLification dance, as well as the 'anonymous
-account for use until the server admin decides to make accounting mandatory.
-It also provides usage statistics and reports for the status UI. This will
-also implement the backend of the control UI (once we figure out how to
-express that: maybe a CLI command, or tahoe.cfg settings, or a web frontend),
-for things like enabling/disabling accounts and setting quotas.
-
-The name 'accountant.py' could be better, preferably something that doesn't
-share a prefix with 'account.py' so my tab-autocomplete will work nicely.
+Account objects, as well as the "anonymous account" for use until a future
+version of Tahoe-LAFS implements the FURLification dance. It also provides
+usage statistics and reports for the status UI. This will also implement the
+backend of the control UI (once we figure out how to express that: maybe a
+CLI command, or tahoe.cfg settings, or a web frontend), for things like
+enabling/disabling accounts and setting quotas.
 """
 
 import weakref
@@ -22,17 +19,17 @@ from allmydata.storage.account import Account
 
 
 class Accountant(service.MultiService):
-    def __init__(self, storage_server, dbfile, statefile):
+    def __init__(self, storage_server, dbfile, statefile, clock=None):
         service.MultiService.__init__(self)
-        self.storage_server = storage_server
+        self._storage_server = storage_server
         self._leasedb = LeaseDB(dbfile)
         self._active_accounts = weakref.WeakValueDictionary()
         self._anonymous_account = Account(LeaseDB.ANONYMOUS_ACCOUNTID, None,
-                                          self.storage_server, self._leasedb)
+                                          self._storage_server, self._leasedb)
         self._starter_account = Account(LeaseDB.STARTER_LEASE_ACCOUNTID, None,
-                                        self.storage_server, self._leasedb)
+                                        self._storage_server, self._leasedb)
 
-        crawler = AccountingCrawler(storage_server, statefile, self._leasedb)
+        crawler = AccountingCrawler(self._storage_server.backend, statefile, self._leasedb, clock=clock)
         self._accounting_crawler = crawler
         crawler.setServiceParent(self)