Skip to content

Commit

Permalink
chore: prepare for Yggdrasil with deprecations of changing API (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek authored Sep 3, 2024
1 parent bbfbd0f commit 26e5fc2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Unleash/DefaultUnleash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public DefaultUnleash(UnleashSettings settings, params IStrategy[] strategies)
///// <param name="config">Unleash settings</param>
///// <param name="overrideDefaultStrategies">When true, it overrides the default strategies.</param>
///// <param name="strategies">Custom strategies.</param>
[Obsolete("Will be removed in the next major version", false)]
public DefaultUnleash(UnleashSettings settings, bool overrideDefaultStrategies, params IStrategy[] strategies)
{
var currentInstanceNo = Interlocked.Increment(ref InitializedInstanceCount);
Expand All @@ -82,6 +83,7 @@ public DefaultUnleash(UnleashSettings settings, bool overrideDefaultStrategies,
}

/// <inheritdoc />
[Obsolete("This property will be removed in the next major release", false)]
public ICollection<FeatureToggle> FeatureToggles => services.ToggleCollection.Instance.Features;

private EventCallbackConfig EventConfig { get; } = new EventCallbackConfig();
Expand Down Expand Up @@ -269,11 +271,13 @@ public Variant GetVariant(string toggleName, UnleashContext context, Variant def
return evaluationResult.Variant;
}

[Obsolete("Will be removed in the next major version", false)]
public IEnumerable<VariantDefinition> GetVariants(string toggleName)
{
return GetVariants(toggleName, services.ContextProvider.Context);
}

[Obsolete("Will be removed in the next major version", false)]
public IEnumerable<VariantDefinition> GetVariants(string toggleName, UnleashContext context)
{
if (!IsEnabled(toggleName, context)) return null;
Expand Down
3 changes: 3 additions & 0 deletions src/Unleash/IUnleash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface IUnleash : IDisposable
/// <summary>
/// Collection of currently loaded Feature Toggles
/// </summary>
[Obsolete("Will be removed in the next major version", false)]
ICollection<FeatureToggle> FeatureToggles { get; }

/// <summary>
Expand Down Expand Up @@ -73,6 +74,7 @@ public interface IUnleash : IDisposable
/// </summary>
/// <param name="toggleName">The name of the toggle.</param>
/// <returns>A list of available variants.</returns>
[Obsolete("Will be removed in the next major version", false)]
IEnumerable<VariantDefinition> GetVariants(string toggleName);

/// <summary>
Expand All @@ -81,6 +83,7 @@ public interface IUnleash : IDisposable
/// <param name="toggleName">The name of the toggle.</param>
/// /// <param name="context">The Unleash context to evaluate the toggle state against.</param>
/// <returns>A list of available variants.</returns>
[Obsolete("Will be removed in the next major version", false)]
IEnumerable<VariantDefinition> GetVariants(string toggleName, UnleashContext context);

void ConfigureEvents(Action<EventCallbackConfig> config);
Expand Down
1 change: 1 addition & 0 deletions src/Unleash/Internal/IToggleBootstrapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Unleash.Internal
{
public interface IToggleBootstrapProvider
{
[Obsolete("Will be replaced in the next major version", false)]
ToggleCollection Read();
}
}
1 change: 1 addition & 0 deletions src/Unleash/Utilities/ToggleBootstrapFileProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ internal ToggleBootstrapFileProvider(string filePath, UnleashSettings settings)
this.settings = settings;
}

[Obsolete("Will be replaced in the next major version", false)]
public ToggleCollection Read()
{
using (var togglesStream = settings.FileSystem.FileOpenRead(filePath))
Expand Down
2 changes: 1 addition & 1 deletion src/Unleash/Utilities/ToggleBootstrapUrlProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ToggleBootstrapUrlProvider(string path, HttpClient client, UnleashSetting
this.throwOnFail = throwOnFail;
this.customHeaders = customHeaders;
}

[Obsolete("Will be replaced in the next major version", false)]
public ToggleCollection Read()
{
return Task.Run(() => FetchFile()).GetAwaiter().GetResult();
Expand Down

0 comments on commit 26e5fc2

Please sign in to comment.