IVSoftware.Portable.Disposable.AuthorityEpochProvider 1.0.2

Prefix Reserved
dotnet add package IVSoftware.Portable.Disposable.AuthorityEpochProvider --version 1.0.2
                    
NuGet\Install-Package IVSoftware.Portable.Disposable.AuthorityEpochProvider -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IVSoftware.Portable.Disposable.AuthorityEpochProvider" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IVSoftware.Portable.Disposable.AuthorityEpochProvider" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="IVSoftware.Portable.Disposable.AuthorityEpochProvider" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IVSoftware.Portable.Disposable.AuthorityEpochProvider --version 1.0.2
                    
#r "nuget: IVSoftware.Portable.Disposable.AuthorityEpochProvider, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IVSoftware.Portable.Disposable.AuthorityEpochProvider@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IVSoftware.Portable.Disposable.AuthorityEpochProvider&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=IVSoftware.Portable.Disposable.AuthorityEpochProvider&version=1.0.2
                    
Install as a Cake Tool

AuthorityEpochProvider

Coordinates a shared, reference-counted authority across overlapping scopes.

Problem

Multiple participants need to operate within a shared context, but:

  • The first participant defines the controlling authority
  • Additional participants may join without overriding that authority
  • Cleanup must occur once, when the last participant exits
  • Reentry and cancellation must not corrupt state or leak events

Solution

AuthorityEpochProvider wraps a reference-counted lifetime (DisposableHost) and projects:

  • Stable authority (first requester wins)
  • Scoped participation via IDisposable
  • Deterministic teardown on the 1 → 0 transition
  • Safe cancellation that detaches the current epoch without poisoning the instance

Usage

var aep = new AuthorityEpochProvider();

using (aep.RequestAuthority(MyAuthority.A1))
{
    // A1 is the authority for this epoch

    using (aep.RequestAuthority(MyAuthority.A2))
    {
        // A2 participates, but authority remains A1
    }
}
// FinalDispose raised once here

Key Behaviors

  • Authority is established once (0 → 1 transition)
  • Authority remains stable until all participants exit
  • Nested and overlapping requests do not override authority
  • FinalDispose fires once when the last token is released
  • IsDisposing is true during FinalDispose
  • CancelAuthorityEpoch:
    • Ends the current epoch immediately
    • Suppresses FinalDispose
    • Allows reuse on the next line

An optional shared ephemeral context (see Context below) is available while tokens are active.


Token Ring Mental Model

Authorities can be treated as positions in a logical sequence (e.g., A1 -> A2 -> A3).

  • Any participant may enter the epoch at any position
  • The first entrant defines the starting point
  • Subsequent participants may join at any position without changing the start
  • Downstream logic can interpret authority relative to that starting point

Example:

using (aep.RequestAuthority(A2))
{
    // Epoch starts at A2

    using (aep.RequestAuthority(A3))
    using (aep.RequestAuthority(A1))
    {
        // Participants span the ring, but authority remains A2
    }
}

This enables scenarios where work proceeds in a predictable cycle, anchored to the first participant’s entry point.


Notes

  • HasRequestedAuthority reflects active participation, not history
  • Cancellation detaches the provider from the current epoch; existing scopes complete silently
  • Thread-safe via underlying host

Context (Optional)

AuthorityEpochProvider inherits dictionary semantics from DisposableHost:

  • Participants may contribute key/value pairs during the epoch
  • Values are aggregated across participants
  • A final, immutable snapshot is emitted on FinalDispose

While not required for authority coordination, this enables a powerful pattern: a shared, mutable context that evolves across the epoch and resolves deterministically at teardown.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 45 4/16/2026

Version 1.0.0 - Initial release.

* Introduces IAuthorityEpochProvider for coordinated authority-based epochs.
* Establishes first-wins authority model with ordered participation tracking.
* Integrates with DisposableHost for deterministic FinalDispose semantics.
* Supports cancellation of FinalDispose event without interrupting epoch teardown.

Version 1.0.1

* Adds runtime type enforcement to generic version via Throw pattern.
* Expands test coverage for cancellation, mixed authority scenarios, and lifecycle invariants.
* Validates dictionary-backed context aggregation and FinalDispose snapshot semantics.
* Confirms awaitable behavior aligned with epoch completion.

Version 1.0.2

* Adds a default value for the CancelAuthorityEpoch @throw parameter (@throw = false).
* Promotes generic Authority and Authorities to public members for better discoverability.
* Reduces reliance on explicit interface access for common scenarios.
* No breaking changes.