/// <summary>Initialize a reference to an on-disk object directory.</summary> /// <remarks>Initialize a reference to an on-disk object directory.</remarks> /// <param name="cfg">configuration this directory consults for write settings.</param> /// <param name="dir">the location of the <code>objects</code> directory.</param> /// <param name="alternatePaths">a list of alternate object directories</param> /// <param name="fs"> /// the file system abstraction which will be necessary to perform /// certain file system operations. /// </param> /// <exception cref="System.IO.IOException">an alternate object cannot be opened.</exception> public ObjectDirectory(Config cfg, FilePath dir, FilePath[] alternatePaths, FS fs ) { config = cfg; objects = dir; infoDirectory = new FilePath(objects, "info"); packDirectory = new FilePath(objects, "pack"); alternatesFile = new FilePath(infoDirectory, "alternates"); cachedPacksFile = new FilePath(infoDirectory, "cached-packs"); packList = new AtomicReference <ObjectDirectory.PackList>(NO_PACKS); cachedPacks = new AtomicReference <ObjectDirectory.CachedPackList>(); unpackedObjectCache = new UnpackedObjectCache(); this.fs = fs; alternates = new AtomicReference <FileObjectDatabase.AlternateHandle[]>(); if (alternatePaths != null) { FileObjectDatabase.AlternateHandle[] alt; alt = new FileObjectDatabase.AlternateHandle[alternatePaths.Length]; for (int i = 0; i < alternatePaths.Length; i++) { alt[i] = OpenAlternate(alternatePaths[i]); } alternates.Set(alt); } }
/// <summary>Initialize a reference to an on-disk object directory.</summary> /// <remarks>Initialize a reference to an on-disk object directory.</remarks> /// <param name="cfg">configuration this directory consults for write settings.</param> /// <param name="dir">the location of the <code>objects</code> directory.</param> /// <param name="alternatePaths">a list of alternate object directories</param> /// <param name="fs"> /// the file system abstraction which will be necessary to perform /// certain file system operations. /// </param> /// <exception cref="System.IO.IOException">an alternate object cannot be opened.</exception> public ObjectDirectory(Config cfg, FilePath dir, FilePath[] alternatePaths, FS fs ) { config = cfg; objects = dir; infoDirectory = new FilePath(objects, "info"); packDirectory = new FilePath(objects, "pack"); alternatesFile = new FilePath(infoDirectory, "alternates"); cachedPacksFile = new FilePath(infoDirectory, "cached-packs"); packList = new AtomicReference<ObjectDirectory.PackList>(NO_PACKS); cachedPacks = new AtomicReference<ObjectDirectory.CachedPackList>(); unpackedObjectCache = new UnpackedObjectCache(); this.fs = fs; alternates = new AtomicReference<FileObjectDatabase.AlternateHandle[]>(); if (alternatePaths != null) { FileObjectDatabase.AlternateHandle[] alt; alt = new FileObjectDatabase.AlternateHandle[alternatePaths.Length]; for (int i = 0; i < alternatePaths.Length; i++) { alt[i] = OpenAlternate(alternatePaths[i]); } alternates.Set(alt); } }