Abstraction of arbitrary object storage. An object database stores one or more Git objects, indexed by their unique ObjectId. Optionally an object database can reference one or more alternates; other ObjectDatabase instances that are searched in addition to the current database. Databases are usually divided into two halves: a half that is considered to be fast to search, and a half that is considered to be slow to search. When alternates are present the fast half is fully searched (recursively through all alternates) before the slow half is considered.
Inheritance: IDisposable
Ejemplo n.º 1
0
        protected override ObjectDatabase[] loadAlternates()
        {
            ObjectDatabase[] loaded = wrapped.getAlternates();
            var result = new ObjectDatabase[loaded.Length];

            for (int i = 0; i < loaded.Length; i++)
            {
                result[i] = loaded[i].newCachedDatabase();
            }
            return(result);
        }
Ejemplo n.º 2
0
 /// <param name="alternateRepository">the alternate repository to wrap and export.</param>
 public AlternateRepositoryDatabase(Repository alternateRepository)
 {
     _repository     = alternateRepository;
     _objectDatabase = _repository.ObjectDatabase;
 }
Ejemplo n.º 3
0
 /**
  * Close the list of alternates returned by {@link #loadAlternates()}.
  *
  * @param alt
  *            the alternate list, from {@link #loadAlternates()}.
  */
 protected void closeAlternates(ObjectDatabase[] alt)
 {
     foreach (ObjectDatabase d in alt)
     {
         d.Dispose();
     }
 }
Ejemplo n.º 4
0
 protected override ObjectDatabase[] loadAlternates() {
     ObjectDatabase[] loaded = wrapped.getAlternates();
     var result = new ObjectDatabase[loaded.Length];
     for (int i = 0; i < loaded.Length; i++) {
         result[i] = loaded[i].newCachedDatabase();
     }
     return result;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create the delegating database instance
 /// </summary>
 /// <param name="wrapped">the wrapped object database</param>
 public CachedObjectDatabase(ObjectDatabase wrapped) {
     this.wrapped = wrapped;
 }
 public AlternateRepositoryDatabase(Repository alternateRepository)
 {
     _repository = alternateRepository;
     _objectDatabase = _repository.ObjectDatabase;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create the delegating database instance
 /// </summary>
 /// <param name="wrapped">the wrapped object database</param>
 public CachedObjectDatabase(ObjectDatabase wrapped)
 {
     this.wrapped = wrapped;
 }