Class PlotUpdateService
Records when plots change, so scene servers hosting other channels can notice.
public sealed class PlotUpdateService : BaseService<PlotUpdateEntity>, IPlotUpdateService
- Inheritance
-
PlotUpdateService
- Implements
- Inherited Members
Remarks
The same polling shape guilds use, for the same reason: a plot is visible from every scene server hosting a channel of its scene, and the server that processed a claim is not the one that has to redraw the foundation everywhere else.
Constructors
PlotUpdateService(INpgsqlDbContextFactory)
public PlotUpdateService(INpgsqlDbContextFactory dbContextFactory)
Parameters
dbContextFactoryINpgsqlDbContextFactory
Methods
DeleteAsync(long, CancellationToken)
Removes the update record for a plot.
public Task<DatabaseResult<int>> DeleteAsync(long plotID, CancellationToken cancellationToken = default)
Parameters
plotIDlongcancellationTokenCancellationToken
Returns
FetchAsync(List<long>, DateTime, CancellationToken)
Fetches the plots among plotIDs that changed at or after
lastFetch, and the database time the read was taken at.
public Task<DatabaseResult<PlotUpdatePollData>> FetchAsync(List<long> plotIDs, DateTime lastFetch, CancellationToken cancellationToken = default)
Parameters
plotIDsList<long>The plots to watch. May be empty: the poll still reports its time.
lastFetchDateTimeWhere the window starts, on the DATABASE clock — a previous poll's AsOfUtc, less a margin for writes committed after their stamp — or MinValue for every mark there is.
cancellationTokenCancellationToken
Returns
Remarks
Marks are stamped by the database clock, so the window has to be measured on it too. A window measured on the poller's own clock lost every change stamped within however far that clock ran ahead.
PersistAsync(long, CancellationToken)
Marks a plot as changed as of now.
public Task<DatabaseResult> PersistAsync(long plotID, CancellationToken cancellationToken = default)
Parameters
plotIDlongcancellationTokenCancellationToken