Skip to content
ModularityKit.Mutator ModularityKit.Mutator Docs
  • Home
  • Core
  • Governance
  • Redis
  • API
Search Results for

    Show / Hide Table of Contents

    Interface IMutationHistoryStore

    Represents store for persisting and retrieving mutation history entries.

    Namespace: ModularityKit.Mutator.Abstractions.History
    Assembly: ModularityKit.Mutator.dll
    Syntax
    public interface IMutationHistoryStore
    Remarks

    Mutation history stores provide durable records of all mutations applied to a given state object. This interface allows storing, querying by state ID, retrieving recent mutations, or querying a time range. Typical implementations include database-backed stores, event-sourced logs, or in-memory caches for testing.

    Examples
    var historyStore: IMutationHistoryStore = new SqlMutationHistoryStore(connectionString);
    
    // Storing a history entry
    await historyStore.StoreAsync(historyEntry);
    
    // Retrieving full history
    var fullHistory = await historyStore.GetHistoryAsync("user-123");
    
    // Retrieving recent 10 mutations
    var recent = await historyStore.GetRecentAsync("user-123", 10);
    
    // Retrieving history in a specific time range
    var range = await historyStore.GetHistoryRangeAsync("user-123", DateTimeOffset.UtcNow.AddDays(-7), DateTimeOffset.UtcNow);

    Methods

    | Edit this page View Source

    GetHistoryAsync(string, CancellationToken)

    Retrieves the complete mutation history for the specified state ID.

    Declaration
    Task<MutationHistory> GetHistoryAsync(string stateId, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string stateId

    The unique identifier of the state object.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<MutationHistory>

    A MutationHistory containing all entries.

    | Edit this page View Source

    GetHistoryRangeAsync(string, DateTimeOffset, DateTimeOffset, CancellationToken)

    Retrieves mutation history for a given state ID within a specific time range.

    Declaration
    Task<MutationHistory> GetHistoryRangeAsync(string stateId, DateTimeOffset from, DateTimeOffset to, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string stateId

    The unique identifier of the state object.

    DateTimeOffset from

    Start of the time range (inclusive).

    DateTimeOffset to

    End of the time range (inclusive).

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<MutationHistory>

    A MutationHistory containing entries within the specified range.

    | Edit this page View Source

    GetRecentAsync(string, int, CancellationToken)

    Retrieves the most recent N mutation entries for a given state ID.

    Declaration
    Task<IReadOnlyList<MutationHistoryEntry>> GetRecentAsync(string stateId, int count, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string stateId

    The unique identifier of the state object.

    int count

    Number of recent entries to retrieve.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<IReadOnlyList<MutationHistoryEntry>>

    A read-only list of the most recent mutation history entries.

    | Edit this page View Source

    StoreAsync(MutationHistoryEntry, CancellationToken)

    Persists a mutation history entry.

    Declaration
    Task StoreAsync(MutationHistoryEntry entry, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MutationHistoryEntry entry

    The mutation history entry to store.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task
    • Edit this page
    • View Source
    In this article
    ModularityKit.Mutator Generated from XML docs and published from main. Back to top