/// <nodoc/> public static DistributionContentHash ToDistributedContentHash(this BondContentHash hash) { if (hash == null) { return(null); } return(new DistributionContentHash { Value = hash, }); }
public static FileDownloadDescriptor Create( BondContentHash content, string url, string traceInfo) { var descriptor = new FileDownloadDescriptor { Id = PipFingerprintEntry.CreateUniqueId(), Content = content, Url = url, TraceInfo = traceInfo, }; return(descriptor); }
public async void AttachCompletedAsync(AttachCompletionInfo attachCompletionInfo) { Contract.Requires(attachCompletionInfo != null); // There is a nearly impossible race condition where the node may still be // in the Starting state (i.e. waiting for ACK of Attach call) so we try to transition // from Starting AND Started var isStatusUpdated = ChangeStatus(WorkerNodeStatus.Starting, WorkerNodeStatus.Attached); isStatusUpdated |= ChangeStatus(WorkerNodeStatus.Started, WorkerNodeStatus.Attached); if (!isStatusUpdated || m_workerClient == null) { // If the status is not changed to Attached due to the current status, // then no need to validate cache connection. // The worker might have already validated the cache and it is running. // Or the worker might have been stopped due to the master termination. return; } m_cacheValidationContentHash = attachCompletionInfo.WorkerCacheValidationContentHash; TotalProcessSlots = attachCompletionInfo.MaxConcurrency; TotalMemoryMb = attachCompletionInfo.AvailableRamMb; var validateCacheSuccess = await ValidateCacheConnection(); if (validateCacheSuccess) { ChangeStatus(WorkerNodeStatus.Attached, WorkerNodeStatus.Running); Volatile.Write(ref m_everAvailable, true); m_sendThread.Start(); } else { await FinishAsync("ValidateCacheConnection failed"); } }