Table of Contents

Class ServerBandwidthReportBuilder

Namespace
FishMMO.Database.Data
Assembly
FishMMO-DB.dll

Assembles the bandwidth page from what the report queries return. Pure, so the rules — "no data" is null, a tier sums only servers that reported, a peak is the busiest point of the summed series — are testable without a database.

public static class ServerBandwidthReportBuilder
Inheritance
ServerBandwidthReportBuilder
Inherited Members

Methods

Build(DateTime, ServerBandwidthRange, IEnumerable<ServerBandwidthWindowRow>, IEnumerable<ServerBandwidthPointRow>, IEnumerable<ServerBandwidthPointRow>, IEnumerable<ServerBandwidthKindPointRow>, int, string?, IEnumerable<ServerBandwidthRates>?)

Builds the report. The inputs are not modified.

public static ServerBandwidthReport Build(DateTime nowUtc, ServerBandwidthRange range, IEnumerable<ServerBandwidthWindowRow> windows, IEnumerable<ServerBandwidthPointRow> currents, IEnumerable<ServerBandwidthPointRow> peaks, IEnumerable<ServerBandwidthKindPointRow> kindSeries, int scopeKind, string? scopeName, IEnumerable<ServerBandwidthRates>? serverSeries)

Parameters

nowUtc DateTime

The database clock the rows were read at.

range ServerBandwidthRange

The charted range.

windows IEnumerable<ServerBandwidthWindowRow>

Every server's fixed-window totals.

currents IEnumerable<ServerBandwidthPointRow>

Each server's latest minute, only where it is fresh.

peaks IEnumerable<ServerBandwidthPointRow>

Each server's busiest point of the range.

kindSeries IEnumerable<ServerBandwidthKindPointRow>

Per tier and chart point, the servers' rates summed.

scopeKind int

The chart's tier, or 0.

scopeName string

The chart's server, or null.

serverSeries IEnumerable<ServerBandwidthRates>

The scoped server's own points, when scopeName is set.

Returns

ServerBandwidthReport

Busiest(IEnumerable<ServerBandwidthRates>)

The point with the most UDP payload sent per second — the measured egress figure — or null when there are no points. Ties go to the earlier point.

public static ServerBandwidthRates? Busiest(IEnumerable<ServerBandwidthRates> points)

Parameters

points IEnumerable<ServerBandwidthRates>

Returns

ServerBandwidthRates

Sum(int, IReadOnlyCollection<ServerBandwidthServerSummary>)

Adds servers together. A window is null when no member has it, and the current rate is the sum over the members that reported one: a silent server contributes nothing rather than a zero that would read as "idle".

public static ServerBandwidthTierSummary Sum(int kind, IReadOnlyCollection<ServerBandwidthServerSummary> members)

Parameters

kind int
members IReadOnlyCollection<ServerBandwidthServerSummary>

Returns

ServerBandwidthTierSummary

SumSeries(IEnumerable<ServerBandwidthKindPointRow>)

The per-tier points summed per bucket, oldest first.

public static List<ServerBandwidthRates> SumSeries(IEnumerable<ServerBandwidthKindPointRow> kindSeries)

Parameters

kindSeries IEnumerable<ServerBandwidthKindPointRow>

Returns

List<ServerBandwidthRates>