logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class StructuredStoreLeaderboardAdapter

    ILeaderboardStore implementation that translates every leaderboard operation into calls against the generic IStructuredStore contract, via LeaderboardRecordMapping. The single adapter every leaderboard backend (key-value, HTTP, and — pass 2 — Postgres/MySql/Mongo) shares, so ranking/retention/tie-break policy is expressed exactly once instead of once per backend.

    Inheritance
    object
    StructuredStoreLeaderboardAdapter
    Implements
    ILeaderboardStore
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Leaderboard.Infrastructure
    Assembly: Serenity.Leaderboard.Infrastructure.dll
    Syntax
    public class StructuredStoreLeaderboardAdapter : ILeaderboardStore
    Remarks

    PersistenceStoreException failures from the underlying store are re-wrapped as LeaderboardStoreException (itself a PersistenceStoreException) so callers keep catching the leaderboard-specific type; OperationCanceledException always propagates unwrapped, matching every other ILeaderboardStore backend.

    Constructors

    StructuredStoreLeaderboardAdapter(IStructuredStore, IReadOnlyDictionary<BoardId, LeaderboardDefinition>, StoreTable, ILogService)

    Initializes a new instance of the StructuredStoreLeaderboardAdapter class.

    Declaration
    public StructuredStoreLeaderboardAdapter(IStructuredStore store, IReadOnlyDictionary<BoardId, LeaderboardDefinition> boards, StoreTable table, ILogService logService)
    Parameters
    Type Name Description
    IStructuredStore store

    The generic structured store backing every leaderboard operation.

    IReadOnlyDictionary<BoardId, LeaderboardDefinition> boards

    Registered leaderboard definitions, keyed by their board identifier.

    StoreTable table

    The table/collection leaderboard entries are stored in.

    ILogService logService

    Logging service used to report failures. May be null.

    Methods

    ClearAsync(BoardId, CancellationToken)

    Declaration
    public Task ClearAsync(BoardId board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    CountAsync(BoardId, CancellationToken)

    Declaration
    public Task<int> CountAsync(BoardId board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<int>

    GetAroundAsync(BoardId, PlayerId, int, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetAroundAsync(BoardId board, PlayerId player, int radius, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    int radius
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    GetPlayerBestAsync(BoardId, PlayerId, CancellationToken)

    Declaration
    public Task<LeaderboardEntry?> GetPlayerBestAsync(BoardId board, PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<LeaderboardEntry?>

    GetRankAsync(BoardId, PlayerId, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<int> GetRankAsync(BoardId board, PlayerId player, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<int>

    GetTopAsync(BoardId, int, LeaderboardSortDirection, LeaderboardRankingMode, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetTopAsync(BoardId board, int count, LeaderboardSortDirection direction, LeaderboardRankingMode rankingMode, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    int count
    LeaderboardSortDirection direction
    LeaderboardRankingMode rankingMode
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    GetTopAsync(BoardId, int, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetTopAsync(BoardId board, int count, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    int count
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    HealthCheckAsync(CancellationToken)

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

    Never throws — passes through to the underlying HealthCheckAsync(CancellationToken), itself a never-throw contract.

    SubmitAsync(LeaderboardEntry, LeaderboardDefinition, CancellationToken)

    Declaration
    public Task SubmitAsync(LeaderboardEntry entry, LeaderboardDefinition board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    LeaderboardEntry entry
    LeaderboardDefinition board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    Implements

    ILeaderboardStore
    In this article
    © 2026 Serenity. All Rights Reserved