This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #483 from NuGet/dev
[ReleasePrep][2018.07.16]RI of dev into master
- Loading branch information
Showing
55 changed files
with
1,546 additions
and
236 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/NuGet.Services.Revalidate/Configuration/RevalidationConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public class RevalidationConfiguration | ||
{ | ||
/// <summary> | ||
/// The time before the revalidation job restarts itself. | ||
/// </summary> | ||
public TimeSpan ShutdownWaitInterval { get; set; } = TimeSpan.FromDays(1); | ||
|
||
/// <summary> | ||
/// How long the revalidation job should wait if a revalidation cannot be processed at this time. | ||
/// </summary> | ||
public TimeSpan RetryLaterSleep { get; set; } = TimeSpan.FromMinutes(5); | ||
|
||
/// <summary> | ||
/// The configurations used to initialize the revalidation state. | ||
/// </summary> | ||
public InitializationConfiguration Initialization { get; set; } | ||
|
||
/// <summary> | ||
/// The configurations used by the in-memory queue of revalidations to start. | ||
/// </summary> | ||
public RevalidationQueueConfiguration Queue { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/NuGet.Services.Revalidate/Configuration/RevalidationQueueConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public class RevalidationQueueConfiguration | ||
{ | ||
/// <summary> | ||
/// The maximum times that the <see cref="RevalidationQueue"/> should look for a revalidation | ||
/// before giving up. | ||
/// </summary> | ||
public int MaximumAttempts { get; set; } = 5; | ||
|
||
/// <summary> | ||
/// The time to sleep after an initialized revalidation is deemed completed. | ||
/// </summary> | ||
public TimeSpan SleepBetweenAttempts { get; set; } = TimeSpan.FromSeconds(5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public class HealthService : IHealthService | ||
{ | ||
public Task<bool> IsHealthyAsync() | ||
{ | ||
// TODO: | ||
// We are software gods that never make mistakes. | ||
return Task.FromResult(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public interface IHealthService | ||
{ | ||
/// <summary> | ||
/// Determine whether the NuGet service is healthy. | ||
/// </summary> | ||
/// <returns>Whether the NuGet service is healthy.</returns> | ||
Task<bool> IsHealthyAsync(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/NuGet.Services.Revalidate/Services/IRevalidationQueue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
using NuGet.Services.Validation; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public interface IRevalidationQueue | ||
{ | ||
/// <summary> | ||
/// Fetch the next package to revalidate. | ||
/// </summary> | ||
/// <returns>The next package to revalidate, or null if there are no packages to revalidate at this time.</returns> | ||
Task<PackageRevalidation> NextOrNullAsync(); | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
....Services.Revalidate/ITelemetryService.cs → ...validate/Services/IRevalidationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public interface ITelemetryService | ||
public interface IRevalidationService | ||
{ | ||
Task RunAsync(); | ||
|
||
Task<RevalidationResult> StartNextRevalidationAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/NuGet.Services.Revalidate/Services/IRevalidationThrottler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public interface IRevalidationThrottler | ||
{ | ||
/// <summary> | ||
/// Check whether the revalidation capacity has been reached. | ||
/// </summary> | ||
/// <returns>If true, no more revalidations should be performed.</returns> | ||
Task<bool> IsThrottledAsync(); | ||
|
||
/// <summary> | ||
/// Reset the capacity to the configured minimum value. Call this when the service's status is degraded to | ||
/// throttle the revalidations. | ||
/// </summary> | ||
/// <returns>A task that completes once the capacity theshold has been reset.</returns> | ||
Task ResetCapacityAsync(); | ||
|
||
/// <summary> | ||
/// Increase the revalidation capacity by one revalidation per minute. | ||
/// </summary> | ||
/// <returns>A task taht completes once the capacity has been increased.</returns> | ||
Task IncreaseCapacityAsync(); | ||
|
||
/// <summary> | ||
/// Delay the current task to achieve the desired revalidation rate. | ||
/// </summary> | ||
/// <returns>Delay the task to ensure the desired revalidation rate.</returns> | ||
Task DelayUntilNextRevalidationAsync(); | ||
|
||
/// <summary> | ||
/// Delay the current task until when a revalidation can be retried. | ||
/// </summary> | ||
/// <returns>Delay the task until when revalidations can be retried.</returns> | ||
Task DelayUntilRevalidationRetryAsync(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/NuGet.Services.Revalidate/Services/ISingletonService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
/// <summary> | ||
/// Used to ensure that only one instance of this service is running at once. | ||
/// </summary> | ||
public interface ISingletonService | ||
{ | ||
/// <summary> | ||
/// Determines whether this is the only instance of the service running. | ||
/// </summary> | ||
/// <returns>True if this service is the only instance of the service running.</returns> | ||
Task<bool> IsSingletonAsync(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/NuGet.Services.Revalidate/Services/ITelemetryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace NuGet.Services.Revalidate | ||
{ | ||
public interface ITelemetryService | ||
{ | ||
IDisposable TrackDurationToStartNextRevalidation(); | ||
|
||
void TrackPackageRevalidationMarkedAsCompleted(string packageId, string normalizedVersion); | ||
|
||
void TrackPackageRevalidationStarted(string packageId, string normalizedVersion); | ||
} | ||
} |
Oops, something went wrong.