MediaAttachment.Size was stored and never summed: nobody, the administrator included, could tell what media took, and nothing bounded it. Counted.Media and MediaOfRoot sum what is kept (not trashed). A login sees what its personas' uploads and pictures take at /clientapi/user/storage (ViewStorage), with its quota when the server sets one; Media:QuotaBytesPerRoot (0, no quota, by default) refuses an upload or a picture over it with 422, whichever persona sends it; the statistics overview gains the media totals, the proxy cache and the trash (ViewMediaTotals). Tests: a login's storage counts what its personas keep and forgets what is trashed; two uploads from two personas of one login are refused together past the quota. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
100 lines
3.0 KiB
C#
100 lines
3.0 KiB
C#
namespace PrivaPub.ClientModels.Admin
|
|
{
|
|
// /clientapi/admin/statistics/overview: the last days' federation at a glance; counters keyed as the ledger keys them
|
|
public class ViewStatisticsOverview
|
|
{
|
|
public int Days { get; set; }
|
|
public Dictionary<string, long> Channels { get; set; } = new();
|
|
public Dictionary<string, long> Inbound { get; set; } = new();
|
|
public Dictionary<string, long> Outbound { get; set; } = new();
|
|
public double? DeliverySuccess { get; set; }
|
|
public ViewLatency DeliveryLatencyMs { get; set; } = new();
|
|
public ViewHostCounts Hosts { get; set; } = new();
|
|
public int Accounts { get; set; }
|
|
public ViewLedgerCounts Ledger { get; set; } = new();
|
|
public ViewMediaTotals Media { get; set; } = new();
|
|
}
|
|
|
|
// what media take on the server: the uploads and pictures kept, the remote media cache, the trash waiting its grace
|
|
public class ViewMediaTotals
|
|
{
|
|
public long MediaBytes { get; set; }
|
|
public long MediaFiles { get; set; }
|
|
public long ProxyCacheBytes { get; set; }
|
|
public long TrashBytes { get; set; }
|
|
}
|
|
|
|
public class ViewLatency
|
|
{
|
|
public int? P50 { get; set; }
|
|
public int? P95 { get; set; }
|
|
}
|
|
|
|
public class ViewHostCounts
|
|
{
|
|
public int Active { get; set; }
|
|
public long Known { get; set; }
|
|
}
|
|
|
|
public class ViewLedgerCounts
|
|
{
|
|
public long Written { get; set; }
|
|
public long Dropped { get; set; }
|
|
public long Failed { get; set; }
|
|
}
|
|
|
|
// /clientapi/admin/statistics/hosts: one page of the servers we exchanged with
|
|
public class ViewHostsPage
|
|
{
|
|
public int Total { get; set; }
|
|
public int Page { get; set; }
|
|
public List<ViewHostRow> Hosts { get; set; } = new();
|
|
public string Attribution { get; set; }
|
|
}
|
|
|
|
public class ViewHostRow
|
|
{
|
|
public string Host { get; set; }
|
|
public string Software { get; set; }
|
|
public string Version { get; set; }
|
|
public long In { get; set; }
|
|
public long Out { get; set; }
|
|
public long Refused { get; set; }
|
|
public long Failures { get; set; }
|
|
public int? LatencyP50 { get; set; }
|
|
public int Accounts { get; set; }
|
|
public DateTime? DescribedAt { get; set; }
|
|
public ViewHostDelivery Delivery { get; set; }
|
|
}
|
|
|
|
public class ViewHostDelivery
|
|
{
|
|
public int ConsecutiveFailures { get; set; }
|
|
public DateTime? UnavailableUntil { get; set; }
|
|
public DateTime? LastSuccessAt { get; set; }
|
|
public DateTime? LastFailureAt { get; set; }
|
|
}
|
|
|
|
// /clientapi/admin/statistics/crawler: how far the crawler got
|
|
public class ViewCrawler
|
|
{
|
|
public bool Enabled { get; set; }
|
|
public long Touched { get; set; }
|
|
public long Crawled { get; set; }
|
|
public long Due { get; set; }
|
|
public long RobotsDisallowed { get; set; }
|
|
public List<ViewCrawledHost> Recent { get; set; } = new();
|
|
}
|
|
|
|
public class ViewCrawledHost
|
|
{
|
|
public string Host { get; set; }
|
|
public string Seen { get; set; }
|
|
public DateTime? LastCrawledAt { get; set; }
|
|
public int? PeersCount { get; set; }
|
|
public bool? RobotsDisallowed { get; set; }
|
|
public string CrawlError { get; set; }
|
|
public string Software { get; set; }
|
|
}
|
|
}
|