Esempio n. 1
0
  def __init__(self):
    self.cvs_file_db = Ctx()._cvs_file_db
    self.db = IndexedDatabase(
        artifact_manager.get_temp_file(config.MIRROR_NODES_STORE),
        artifact_manager.get_temp_file(config.MIRROR_NODES_INDEX_TABLE),
        DB_OPEN_NEW, serializer=MarshalSerializer(),
        )

    # A list of the maximum node_id stored by each call to
    # write_new_nodes():
    self._max_node_ids = [0]

    # A map {node_id : {cvs_path : node_id}}:
    self._cache = {}

    # The number of directories in the repository:
    num_dirs = len([
        cvs_path
        for cvs_path in self.cvs_file_db.itervalues()
        if isinstance(cvs_path, CVSDirectory)
        ])

    self._cache_max_size = max(
        int(self.CACHE_SIZE_MULTIPLIER * num_dirs),
        self.MIN_CACHE_LIMIT,
        )
Esempio n. 2
0
    def start(self):
        self._delta_db = IndexedDatabase(
            artifact_manager.get_temp_file(config.RCS_DELTAS_STORE),
            artifact_manager.get_temp_file(config.RCS_DELTAS_INDEX_TABLE),
            DB_OPEN_READ,
        )
        self._delta_db.__delitem__ = lambda id: None
        self._tree_db = IndexedDatabase(
            artifact_manager.get_temp_file(config.RCS_TREES_STORE),
            artifact_manager.get_temp_file(config.RCS_TREES_INDEX_TABLE),
            DB_OPEN_READ,
        )
        serializer = MarshalSerializer()
        if self._compress:
            serializer = CompressingSerializer(serializer)
        self._co_db = self._Database(
            artifact_manager.get_temp_file(config.CVS_CHECKOUT_DB),
            DB_OPEN_NEW,
            serializer,
        )

        # The set of CVSFile instances whose TextRecords have already been
        # read:
        self._loaded_files = set()

        # A map { CVSFILE : _FileTree } for files that currently have live
        # revisions:
        self._text_record_db = TextRecordDatabase(self._delta_db, self._co_db)
Esempio n. 3
0
 def start(self):
     ser = MarshalSerializer()
     if self._compress:
         ser = CompressingSerializer(ser)
     self._rcs_deltas = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_DELTAS_STORE),
         artifact_manager.get_temp_file(config.RCS_DELTAS_INDEX_TABLE),
         DB_OPEN_NEW, ser)
     primer = (FullTextRecord, DeltaTextRecord)
     self._rcs_trees = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_TREES_STORE),
         artifact_manager.get_temp_file(config.RCS_TREES_INDEX_TABLE),
         DB_OPEN_NEW, PrimedPickleSerializer(primer))
Esempio n. 4
0
 def loads(self, s):
   return self._load(MarshalSerializer.loads(self, s))
Esempio n. 5
0
 def dumps(self, node):
   return MarshalSerializer.dumps(self, self._dump(node))
Esempio n. 6
0
 def loadf(self, f):
   return self._load(MarshalSerializer.loadf(self, f))
Esempio n. 7
0
 def dumpf(self, f, node):
   MarshalSerializer.dumpf(self, f, self._dump(node))
Esempio n. 8
0
 def loads(self, s):
     return self._load(MarshalSerializer.loads(self, s))
Esempio n. 9
0
 def loadf(self, f):
     return self._load(MarshalSerializer.loadf(self, f))
Esempio n. 10
0
 def dumps(self, node):
     return MarshalSerializer.dumps(self, self._dump(node))
Esempio n. 11
0
 def dumpf(self, f, node):
     MarshalSerializer.dumpf(self, f, self._dump(node))