mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
put WeakKeyDictionary use back
This commit is contained in:
parent
d4f29e7d6c
commit
6eade15b4e
@ -1,4 +1,5 @@
|
|||||||
import os, re, struct, time
|
import os, re, struct, time
|
||||||
|
import weakref
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from foolscap.api import Referenceable
|
from foolscap.api import Referenceable
|
||||||
@ -67,7 +68,7 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
self.incomingdir = os.path.join(sharedir, 'incoming')
|
self.incomingdir = os.path.join(sharedir, 'incoming')
|
||||||
self._clean_incomplete()
|
self._clean_incomplete()
|
||||||
fileutil.make_dirs(self.incomingdir)
|
fileutil.make_dirs(self.incomingdir)
|
||||||
self._active_writers = set()
|
self._active_writers = weakref.WeakKeyDictionary()
|
||||||
log.msg("StorageServer created", facility="tahoe.storage")
|
log.msg("StorageServer created", facility="tahoe.storage")
|
||||||
|
|
||||||
if reserved_space:
|
if reserved_space:
|
||||||
@ -302,7 +303,7 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
if self.no_storage:
|
if self.no_storage:
|
||||||
bw.throw_out_all_data = True
|
bw.throw_out_all_data = True
|
||||||
bucketwriters[shnum] = bw
|
bucketwriters[shnum] = bw
|
||||||
self._active_writers.add(bw)
|
self._active_writers[bw] = 1
|
||||||
if limited:
|
if limited:
|
||||||
remaining_space -= max_space_per_bucket
|
remaining_space -= max_space_per_bucket
|
||||||
else:
|
else:
|
||||||
@ -358,7 +359,7 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
def bucket_writer_closed(self, bw, consumed_size):
|
def bucket_writer_closed(self, bw, consumed_size):
|
||||||
if self.stats_provider:
|
if self.stats_provider:
|
||||||
self.stats_provider.count('storage_server.bytes_added', consumed_size)
|
self.stats_provider.count('storage_server.bytes_added', consumed_size)
|
||||||
self._active_writers.remove(bw)
|
del self._active_writers[bw]
|
||||||
|
|
||||||
def _get_bucket_shares(self, storage_index):
|
def _get_bucket_shares(self, storage_index):
|
||||||
"""Return a list of (shnum, pathname) tuples for files that hold
|
"""Return a list of (shnum, pathname) tuples for files that hold
|
||||||
|
Loading…
x
Reference in New Issue
Block a user