public BlobReadOnlyContentSession( IAbsFileSystem fileSystem, string name, ImplicitPin implicitPin, IBlobStoreHttpClient blobStoreHttpClient, TimeSpan timeToKeepContent, bool downloadBlobsThroughBlobStore, CounterTracker?counterTracker = null) : base(name, counterTracker) { Contract.Requires(fileSystem != null); Contract.Requires(name != null); Contract.Requires(blobStoreHttpClient != null); ImplicitPin = implicitPin; BlobStoreHttpClient = blobStoreHttpClient; TimeToKeepContent = timeToKeepContent; _downloadBlobsThroughBlobStore = downloadBlobsThroughBlobStore; _parallelSegmentDownloadConfig = ParallelHttpDownload.Configuration.GetParallelSegmentDownloadConfig(EnvironmentVariablePrefix); TempDirectory = new DisposableDirectory(fileSystem); _counters = CounterTracker.CreateCounterCollection <BackingContentStore.SessionCounters>(counterTracker); _blobCounters = CounterTracker.CreateCounterCollection <Counters>(counterTracker); }
/// <summary> /// Initializes a new instance of the <see cref="BlobReadOnlyContentSession"/> class. /// </summary> /// <param name="fileSystem">Filesystem used to read/write files.</param> /// <param name="name">Session name.</param> /// <param name="implicitPin">Policy determining whether or not content should be automatically pinned on adds or gets.</param> /// <param name="blobStoreHttpClient">Backing BlobStore http client.</param> /// <param name="timeToKeepContent">Minimum time-to-live for accessed content.</param> /// <param name="downloadBlobsThroughBlobStore">If true, gets blobs through BlobStore. If false, gets blobs from the Azure Uri.</param> /// <param name="counterTracker">Parent counters to track the session.</param> public BlobReadOnlyContentSession( IAbsFileSystem fileSystem, string name, ImplicitPin implicitPin, IBlobStoreHttpClient blobStoreHttpClient, TimeSpan timeToKeepContent, bool downloadBlobsThroughBlobStore, CounterTracker counterTracker = null) : base(name, counterTracker) { Contract.Requires(fileSystem != null); Contract.Requires(name != null); Contract.Requires(blobStoreHttpClient != null); ImplicitPin = implicitPin; BlobStoreHttpClient = blobStoreHttpClient; TimeToKeepContent = timeToKeepContent; _downloadBlobsThroughBlobStore = downloadBlobsThroughBlobStore; _parallelSegmentDownloadConfig = new ParallelHttpDownload .Configuration( segmentDownloadTimeout: TimeSpan.FromMinutes(int.Parse( Environment.GetEnvironmentVariable(EnvironmentVariablePrefix + "SegmentDownloadTimeoutInMinutes") ?? DefaultSegmentDownloadTimeoutInMinutes.ToString())), segmentSizeInBytes: int.Parse( Environment.GetEnvironmentVariable(EnvironmentVariablePrefix + "ParallelDownloadSegmentSizeInBytes") ?? DefaultParallelDownloadSegmentSizeInBytes.ToString()), maxParallelSegmentDownloadsPerFile: int.Parse( Environment.GetEnvironmentVariable(EnvironmentVariablePrefix + "MaxParallelSegmentDownloadsPerFile") ?? DefaultMaxParallelSegmentDownloadsPerFile.ToString()), maxSegmentDownloadRetries: int.Parse( Environment.GetEnvironmentVariable(EnvironmentVariablePrefix + "MaxSegmentDownloadRetries") ?? DefaultMaxSegmentDownloadRetries.ToString())); TempDirectory = new DisposableDirectory(fileSystem); Native.IO.FileUtilities.CreateDirectory(TempDirectory.Path.Path); _counters = CounterTracker.CreateCounterCollection <BackingContentStore.SessionCounters>(counterTracker); _blobCounters = CounterTracker.CreateCounterCollection <Counters>(counterTracker); }