コード例 #1
0
ファイル: BlobContentSession.cs プロジェクト: socat/BuildXL
 /// <summary>
 /// Initializes a new instance of the <see cref="BlobContentSession" /> 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="tracer">A tracer for tracking blob content calls</param>
 /// <param name="downloadBlobsThroughBlobStore">
 /// If true, gets blobs through BlobStore. If false, gets blobs from the Azure
 /// Uri.
 /// </param>
 public BlobContentSession(
     IAbsFileSystem fileSystem,
     string name,
     ImplicitPin implicitPin,
     IBlobStoreHttpClient blobStoreHttpClient,
     TimeSpan timeToKeepContent,
     BackingContentStoreTracer tracer,
     bool downloadBlobsThroughBlobStore)
     : base(fileSystem, name, implicitPin, blobStoreHttpClient, timeToKeepContent, tracer, downloadBlobsThroughBlobStore)
 {
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DedupContentSession"/> class.
 /// </summary>
 public DedupContentSession(
     Context context,
     IAbsFileSystem fileSystem,
     string name,
     ImplicitPin implicitPin,
     IDedupStoreHttpClient dedupStoreHttpClient,
     TimeSpan timeToKeepContent,
     BackingContentStoreTracer tracer,
     int maxConnections = DefaultMaxConnections)
     : base(fileSystem, name, implicitPin, dedupStoreHttpClient, timeToKeepContent, tracer, maxConnections)
 {
     _artifactFileSystem = VstsFileSystem.Instance;
     _uploadSession      = DedupStoreClient.CreateUploadSession(
         DedupStoreClient,
         new KeepUntilBlobReference(EndDateTime),
         new AppTraceSourceContextAdapter(context, "CreateUploadSession", SourceLevels.All),
         _artifactFileSystem);
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BackingContentStore"/> class.
 /// </summary>
 /// <param name="fileSystem">Filesystem used to read/write files.</param>
 /// <param name="artifactHttpClientFactory">Backing Store HTTP client factory.</param>
 /// <param name="timeToKeepContent">Minimum time-to-live for accessed content.</param>
 /// <param name="backingStoreContentTracer">A tracer for tracking calls to the backing Content Store.</param>
 /// <param name="downloadBlobsThroughBlobStore">Flag for BlobStore: If enabled, gets blobs through BlobStore. If false, gets blobs from the Azure Uri.</param>
 /// <param name="useDedupStore">Determines whether or not DedupStore is used for content. Must be used in tandem with Dedup hashes.</param>
 public BackingContentStore(
     IAbsFileSystem fileSystem,
     IArtifactHttpClientFactory artifactHttpClientFactory,
     TimeSpan timeToKeepContent,
     BackingContentStoreTracer backingStoreContentTracer,
     bool downloadBlobsThroughBlobStore = false,
     bool useDedupStore = false)
 {
     Contract.Requires(fileSystem != null);
     Contract.Requires(artifactHttpClientFactory != null);
     Contract.Requires(backingStoreContentTracer != null);
     _fileSystem = fileSystem;
     _artifactHttpClientFactory     = artifactHttpClientFactory;
     _timeToKeepContent             = timeToKeepContent;
     _downloadBlobsThroughBlobStore = downloadBlobsThroughBlobStore;
     _backingStoreContentTracer     = backingStoreContentTracer;
     _useDedupStore = useDedupStore;
 }
コード例 #4
0
        /// <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="dedupStoreHttpClient">Backing DedupStore http client.</param>
        /// <param name="timeToKeepContent">Minimum time-to-live for accessed content.</param>
        /// <param name="tracer">A tracer for tracking blob content session calls.</param>
        /// <param name="maxConnections">The maximum number of outboud connections to VSTS.</param>
        public DedupReadOnlyContentSession(
            IAbsFileSystem fileSystem,
            string name,
            ImplicitPin implicitPin,
            IDedupStoreHttpClient dedupStoreHttpClient,
            TimeSpan timeToKeepContent,
            BackingContentStoreTracer tracer,
            int maxConnections = DefaultMaxConnections)
        {
            Contract.Requires(fileSystem != null);
            Contract.Requires(name != null);
            Contract.Requires(dedupStoreHttpClient != null);

            Name             = name;
            ImplicitPin      = implicitPin;
            DedupStoreClient = new DedupStoreClient(dedupStoreHttpClient, DefaultMaxParallelism);
            Tracer           = tracer;
            FileSystem       = fileSystem;
            TempDirectory    = new DisposableDirectory(fileSystem);
            ConnectionGate   = new SemaphoreSlim(maxConnections);
            EndDateTime      = DateTime.UtcNow + timeToKeepContent;
        }
コード例 #5
0
        /// <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="tracer">A tracer for tracking blob content session calls.</param>
        /// <param name="downloadBlobsThroughBlobStore">If true, gets blobs through BlobStore. If false, gets blobs from the Azure Uri.</param>
        public BlobReadOnlyContentSession(
            IAbsFileSystem fileSystem,
            string name,
            ImplicitPin implicitPin,
            IBlobStoreHttpClient blobStoreHttpClient,
            TimeSpan timeToKeepContent,
            BackingContentStoreTracer tracer,
            bool downloadBlobsThroughBlobStore)
        {
            Contract.Requires(fileSystem != null);
            Contract.Requires(name != null);
            Contract.Requires(blobStoreHttpClient != null);

            Name                           = name;
            ImplicitPin                    = implicitPin;
            BlobStoreHttpClient            = blobStoreHttpClient;
            TimeToKeepContent              = timeToKeepContent;
            Tracer                         = tracer;
            _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);
            BuildXL.Native.IO.FileUtilities.CreateDirectory(TempDirectory.Path.Path);
        }