logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IGameSaveStore

    Application port for persisting and loading individual, slot-addressed game saves.

    Namespace: Serenity.GameSave.Application.Interfaces.Stores
    Assembly: Serenity.GameSave.Application.dll
    Syntax
    public interface IGameSaveStore
    Remarks

    Implementations decide how and where saves are stored (in-memory, PlayerPrefs, a remote backend, etc.). The business layer depends on this abstraction, never on a concrete backend.

    Methods

    DeleteAsync(SaveSlotId, CancellationToken)

    Deletes the save stored at slotId, if any. Deleting an empty slot is a no-op.

    Declaration
    Task DeleteAsync(SaveSlotId slotId, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    SaveSlotId slotId

    The slot to delete.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task

    ExistsAsync(SaveSlotId, CancellationToken)

    Checks whether a save exists at slotId.

    Declaration
    Task<bool> ExistsAsync(SaveSlotId slotId, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    SaveSlotId slotId

    The slot to check.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>

    GetSlotSummaryAsync(SaveSlotId, CancellationToken)

    Gets a metadata-only summary of the single slot slotId, WITHOUT decoding its section payload. The cheapest correct source callers have for "what tick is currently stored for this slot" — e.g. to reconcile a cold, per-instance tick cache before stamping a new save, without paying for a full LoadAsync(SaveSlotId, CancellationToken).

    Declaration
    Task<SaveSlotSummary> GetSlotSummaryAsync(SaveSlotId slotId, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    SaveSlotId slotId

    The slot to summarize.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<SaveSlotSummary>

    The slot's summary, or null when the slot holds no save.

    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>

    LoadAsync(SaveSlotId, CancellationToken)

    Loads the save stored at slotId.

    Declaration
    Task<SaveDocument> LoadAsync(SaveSlotId slotId, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    SaveSlotId slotId

    The slot to load.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<SaveDocument>

    The stored save, or null when the slot holds no save.

    QuerySummariesAsync(CancellationToken)

    Queries a metadata-only summary of every OCCUPIED slot. Empty slots are never included.

    Declaration
    Task<IReadOnlyList<SaveSlotSummary>> QuerySummariesAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<IReadOnlyList<SaveSlotSummary>>

    SaveAsync(SaveSlotId, SaveDocument, CancellationToken)

    Persists document at slotId. Implementations must only replace an existing row when document's SavedAtUtcTicks is strictly greater than whatever is already stored for that slot, so a stale write can never clobber a newer one; callers are responsible for stamping strictly increasing ticks per slot.

    Declaration
    Task SaveAsync(SaveSlotId slotId, SaveDocument document, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    SaveSlotId slotId

    The slot to persist to.

    SaveDocument document

    The save to persist.

    CancellationToken cancellationToken

    Token used to cancel the operation.

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