25 lines
1.3 KiB
C#
25 lines
1.3 KiB
C#
namespace Outnumbered.Data;
|
|
|
|
// Hides the SQL dialect so SQLite (dev) -> PostgreSQL (prod) is a provider swap,
|
|
// not a logic change (spec §10). All methods run OFF the game thread.
|
|
public interface IPlayerRepository
|
|
{
|
|
Task EnsureSchemaAsync();
|
|
Task<LoadedPlayer?> LoadAsync(ulong steamId);
|
|
Task SaveAsync(PersistPlayer player);
|
|
Task SaveManyAsync(IReadOnlyList<PersistPlayer> players);
|
|
Task<IReadOnlyList<TopPlayer>> GetTopAsync(int count);
|
|
|
|
// Records (site leaderboards): improve-only writes kept OUT of the SaveMany upsert's column list, so a normal
|
|
// save can never clobber them and they need no LoadedPlayer/PlayerData round-trip (write-only from the plugin).
|
|
Task TryImproveBestWavesAsync(IReadOnlyList<ulong> steamIds, int wave); // higher wave wins
|
|
Task TryImproveGgBestAsync(ulong steamId, long elapsedMs); // lower time wins
|
|
Task<IReadOnlyList<TopWave>> GetTopWavesAsync(int count);
|
|
Task<IReadOnlyList<TopGgTime>> GetTopGgAsync(int count);
|
|
|
|
// Per-match stats (RAM-first; persisted only on disconnect/shutdown, wiped on round end).
|
|
Task<MatchState?> LoadMatchAsync(ulong steamId);
|
|
Task SaveMatchAsync(MatchState state);
|
|
Task SaveManyMatchAsync(IReadOnlyList<MatchState> states);
|
|
Task WipeMatchAsync();
|
|
}
|