Table of Contents

Class BulkWriteReporting

Namespace
FishMMO.Server.Core
Assembly
FishMMO.Server.dll

Turns a bulk write's outcome into the log line it deserves, and answers the only two questions a caller actually has about one.

public static class BulkWriteReporting
Inheritance
BulkWriteReporting
Inherited Members

Remarks

A batched write reports three counts rather than a boolean — see BulkWriteResult — and the two ways rows go missing want opposite treatment. A superseded row is the database telling us it already holds something newer, which is routine under concurrency and not worth a warning on every periodic save. A filtered row is the service telling us it could not act on what we asked for at all, which is never routine and was, before this, entirely silent.

Centralised so that every call site classifies a discrepancy the same way. Spread across twenty hand-written checks, the distinction would survive in some and quietly rot in the rest — which is how it came to be missing in the first place.

Methods

ReportAsync(string, string, DatabaseResult<BulkWriteResult>, string)

Reports a best-effort bulk write: one where the database legitimately holding newer data is an acceptable outcome.

public static Task<bool> ReportAsync(string tag, string operation, DatabaseResult<BulkWriteResult> result, string context = null)

Parameters

tag string

Log source.

operation string

What was being written, for the log line.

result DatabaseResult<BulkWriteResult>

The write's outcome.

context string

Optional extra identification, such as a character ID.

Returns

Task<bool>

True if the write succeeded, whether or not every row landed.

Remarks

The right call for periodic and despawn saves. A superseded row there means another writer got to it first with a fresher snapshot, so the stored value is the better of the two and there is nothing to repair.

RequireCompleteAsync(string, string, DatabaseResult<BulkWriteResult>, string)

Reports a bulk write that must land in full, failing the caller if it did not.

public static Task<bool> RequireCompleteAsync(string tag, string operation, DatabaseResult<BulkWriteResult> result, string context = null)

Parameters

tag string

Log source.

operation string

What was being written, for the log line.

result DatabaseResult<BulkWriteResult>

The write's outcome.

context string

Optional extra identification, such as a character ID.

Returns

Task<bool>

True only if the write succeeded and every supplied row was written.

Remarks

The right call for rows that are being created for the first time — a new character's starting inventory, factions and abilities. Nothing newer can exist to supersede them, so a shortfall is not a race: it means rows were dropped, and continuing would hand the player a character that is quietly missing part of itself.