Exemple #1
0
 def __init__(self,
              allow_writes,
              node_size,
              codec,
              dirname=None,
              upload_max=1024,
              lru_size=500,
              vfs=None,
              format=None):
     tracing.trace('new NodeStoreDisk: %s', dirname)
     assert dirname is not None
     if format is not None:
         tracing.trace('forcing format_base: %s', format)
         self.format_base = format
     larch.NodeStore.__init__(self,
                              allow_writes=allow_writes,
                              node_size=node_size,
                              codec=codec)
     self.dirname = dirname
     self.metadata_name = os.path.join(dirname, 'metadata')
     self.metadata = None
     self.rs = larch.RefcountStore(self)
     self.cache_size = lru_size
     self.cache = larch.LRUCache(self.cache_size)
     self.upload_max = upload_max
     self.upload_queue = larch.UploadQueue(self._really_put_node,
                                           self.upload_max)
     self.vfs = vfs if vfs != None else LocalFS()
     self.journal = larch.Journal(allow_writes, self.vfs, dirname)
     self.idpath = larch.IdPath(os.path.join(dirname, self.nodedir),
                                DIR_DEPTH, DIR_BITS, DIR_SKIP)
Exemple #2
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp()
     self.depth = 3
     bits = 1
     skip = 0
     self.idpath = larch.IdPath(self.tempdir, self.depth, bits, skip)
Exemple #3
0
 def _setup_chunks(self):
     self._prev_chunk_id = None
     self._chunk_idpath = larch.IdPath(
         'chunks', self._idpath_depth, self._idpath_bits,
         self._idpath_skip)