logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IAchievementStore

    Application port for persisting and querying achievement unlocks and progress.

    Namespace: Serenity.Achievements.Application.Interfaces.Repositories
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public interface IAchievementStore
    Remarks

    Implementations decide how and where achievement data is stored (in-memory, player prefs, local file, HTTP, SQL, document store). The business layer depends on this abstraction, never on a concrete backend. Rows are keyed by (player, achievement) and ordered by Revision: an upsert carrying an older revision than the stored row must lose, so a late screenshot attachment never overwrites a newer state.

    Methods

    ClearAsync(PlayerId, CancellationToken)

    Removes every unlock and progress row stored for a player.

    Declaration
    Task ClearAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to clear.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task

    EnsureSchemaAsync(CancellationToken)

    Creates whatever schema the backend needs before its first read or write.

    Declaration
    Task EnsureSchemaAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task

    GetProgressAsync(PlayerId, CancellationToken)

    Gets every progress row stored for a player.

    Declaration
    Task<IReadOnlyList<AchievementProgress>> GetProgressAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to query.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<IReadOnlyList<AchievementProgress>>

    GetUnlocksAsync(PlayerId, CancellationToken)

    Gets every unlock record stored for a player.

    Declaration
    Task<IReadOnlyList<AchievementUnlockRecord>> GetUnlocksAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to query.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<IReadOnlyList<AchievementUnlockRecord>>

    HealthCheckAsync(CancellationToken)

    Checks whether the backing store is reachable and healthy.

    Declaration
    Task<bool> HealthCheckAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>

    UpsertProgressAsync(PlayerId, AchievementProgress, CancellationToken)

    Writes a progress row, keeping whichever version carries the higher revision.

    Declaration
    Task UpsertProgressAsync(PlayerId player, AchievementProgress progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player the progress belongs to.

    AchievementProgress progress

    The progress row to write.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task

    UpsertUnlockAsync(AchievementUnlockRecord, CancellationToken)

    Writes an unlock record, keeping whichever version carries the higher revision.

    Declaration
    Task UpsertUnlockAsync(AchievementUnlockRecord record, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    AchievementUnlockRecord record

    The record to write.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task
    In this article
    © 2026 Serenity. All Rights Reserved