Ejemplo n.º 1
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 = 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)
Ejemplo n.º 2
0
 def start(self):
     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)
     primer = (FullTextRecord, DeltaTextRecord)
     self._new_tree_db = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_TREES_FILTERED_STORE),
         artifact_manager.get_temp_file(
             config.RCS_TREES_FILTERED_INDEX_TABLE), DB_OPEN_NEW,
         PrimedPickleSerializer(primer))
Ejemplo 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))
Ejemplo n.º 4
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,
        )
Ejemplo n.º 5
0
def MetadataDatabase(store_filename, index_table_filename, mode):
  """A Database to store Metadata instances that describe CVSRevisions.

  This database manages a map

      id -> Metadata instance

  where id is a unique identifier for the metadata."""

  return IndexedDatabase(
      store_filename, index_table_filename,
      mode, PrimedPickleSerializer((Metadata,)),
      )
Ejemplo n.º 6
0
 def __init__(self, mode):
   self.mode = mode
   if mode not in (DB_OPEN_NEW, DB_OPEN_READ):
     raise RuntimeError, "Invalid 'mode' argument to PersistenceManager"
   primer = (
       SVNInitialProjectCommit,
       SVNPrimaryCommit,
       SVNPostCommit,
       SVNBranchCommit,
       SVNTagCommit,
       )
   serializer = PrimedPickleSerializer(primer)
   self.svn_commit_db = IndexedDatabase(
       artifact_manager.get_temp_file(config.SVN_COMMITS_INDEX_TABLE),
       artifact_manager.get_temp_file(config.SVN_COMMITS_STORE),
       mode, serializer)
   self.cvs2svn_db = RecordTable(
       artifact_manager.get_temp_file(config.CVS_REVS_TO_SVN_REVNUMS),
       mode, SignedIntegerPacker(SVN_INVALID_REVNUM))
Ejemplo n.º 7
0
    def open(self):
        """Set up the SVNRepositoryMirror and prepare it for SVNCommits."""

        self._key_generator = KeyGenerator()

        self._delegates = []

        # A map from LOD to LODHistory instance for all LODs that have
        # been defines so far:
        self._lod_histories = {}

        # This corresponds to the 'nodes' table in a Subversion fs.  (We
        # don't need a 'representations' or 'strings' table because we
        # only track metadata, not file contents.)
        self._nodes_db = IndexedDatabase(
            artifact_manager.get_temp_file(config.SVN_MIRROR_NODES_STORE),
            artifact_manager.get_temp_file(
                config.SVN_MIRROR_NODES_INDEX_TABLE),
            DB_OPEN_NEW,
            serializer=_NodeSerializer())

        # Start at revision 0 without a root node.  It will be created
        # by _open_writable_root_node.
        self._youngest = 0