Interface IGuildLogService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
Service interface for the append-only guild activity log.
public interface IGuildLogService
Remarks
Deliberately does not implement the shared IPersistAction/IFetchManyByKeyAction
shapes. Those describe a row that is written, re-read and updated under a version; a log row
is written once and never touched again, and its read is "the most recent N", which the
key-based fetch contracts have no way to express.
Methods
AppendAsync(GuildLogData, CancellationToken)
Appends one row to a guild's activity log.
Task<DatabaseResult> AppendAsync(GuildLogData entry, CancellationToken cancellationToken = default)
Parameters
entryGuildLogDataThe event to record.
IDis ignored.cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult>
A DatabaseResult indicating success or failure.
FetchRecentAsync(long, int, CancellationToken)
Fetches a guild's most recent log rows, newest first.
Task<DatabaseResult<IReadOnlyList<GuildLogData>>> FetchRecentAsync(long guildId, int limit, CancellationToken cancellationToken = default)
Parameters
guildIdlongGuild ID.
limitintMaximum rows to return.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult<IReadOnlyList<GuildLogData>>>
The most recent rows, newest first.
PruneAsync(long, int, CancellationToken)
Deletes log rows beyond the most recent keep for one guild.
Task<DatabaseResult<int>> PruneAsync(long guildId, int keep, CancellationToken cancellationToken = default)
Parameters
guildIdlongGuild ID.
keepintNumber of newest rows to retain.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult<int>>
The number of rows removed.
Remarks
An unbounded append-only table attached to a long-lived guild grows without limit and nothing else in the schema would ever remove from it. Trimming to a fixed depth is what makes the feature safe to leave running for a year.