Bundle: redb-tsak / src/redb.Tsak.Contracts (src.redb.Tsak.Contracts.txt), 22 files
Snapshot: development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Index: https://redbase.app/src/dev-2026-12-06/redb-tsak/_index.txt
====
Path: redb-tsak/src/redb.Tsak.Contracts/AuditModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/AuditModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Response for GET /api/audit: a newest-first page of admin audit entries.
/// is false when Tsak runs without a database — in that mode
/// the audit trail lives in the log, not in a queryable table.
///
public sealed record AuditQueryResult
{
public required bool Available { get; init; }
public int? Count { get; init; }
public int? Limit { get; init; }
public int? Offset { get; init; }
public string? Error { get; init; }
public AuditEntry[] Entries { get; init; } = [];
}
/// A single persisted admin audit entry.
public sealed record AuditEntry
{
public required string EventId { get; init; }
public required DateTimeOffset Timestamp { get; init; }
public required string Action { get; init; }
public string? ControllerType { get; init; }
public string? ActorPrincipal { get; init; }
public string? ActorKeyId { get; init; }
public string? RemoteIp { get; init; }
public string? UserAgent { get; init; }
public string? HttpMethod { get; init; }
public string? RequestPath { get; init; }
public string? TargetResource { get; init; }
public int StatusCode { get; init; }
public double DurationMs { get; init; }
public string? ExceptionType { get; init; }
public string? ExceptionMessage { get; init; }
public string? Payload { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/AuditSensitiveAttribute.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/AuditSensitiveAttribute.cs
----
namespace redb.Tsak.Contracts;
///
/// Marks a property of a wire DTO as containing sensitive data (passwords, secrets, API keys,
/// tokens). The admin-audit filter replaces the value with the literal string "***" in the
/// persisted audit payload. Lives in Contracts — the DTOs that need the mark are here, and
/// Contracts cannot reference Core (review 2026-09-02, К2: the attribute existed in Core and was
/// therefore applied to nothing, so plaintext passwords reached the audit trail).
///
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class AuditSensitiveAttribute : Attribute
{
}
Path: redb-tsak/src/redb.Tsak.Contracts/AuthModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/AuthModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record ApiKeyCreatedResponse
{
public required string Id { get; init; }
public required string Key { get; init; }
public required string Name { get; init; }
public required string Roles { get; init; }
public string? UserId { get; init; }
public required DateTimeOffset CreatedAt { get; init; }
public DateTimeOffset? ExpiresAt { get; init; }
public string? Message { get; init; }
}
public sealed record ApiKeyInfo
{
public required string Id { get; init; }
public required string Name { get; init; }
public required string Roles { get; init; }
public string? UserId { get; init; }
public required DateTimeOffset CreatedAt { get; init; }
public DateTimeOffset? ExpiresAt { get; init; }
public required bool Revoked { get; init; }
public required bool IsValid { get; init; }
}
public sealed record ApiKeyRevokedResponse
{
public required string Id { get; init; }
public required bool Revoked { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/ClusterModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/ClusterModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record ClusterStatusResponse
{
public required bool Enabled { get; init; }
public string? NodeId { get; init; }
public bool? IsLeader { get; init; }
public long? CurrentEpoch { get; init; }
}
public sealed record ClusterNodesResponse
{
public required bool Enabled { get; init; }
public required ClusterNodeInfo[] Nodes { get; init; }
}
public sealed record ClusterNodeInfo
{
public required string NodeId { get; init; }
public required string Hostname { get; init; }
public required int Status { get; init; }
public required DateTimeOffset StartedAt { get; init; }
public required DateTimeOffset LastHeartbeat { get; init; }
public string? ApiEndpoint { get; init; }
/// True when the node is cordoned (takes on no new work; draining/drained).
public bool Cordoned { get; init; }
}
public sealed record ClusterCordonResponse
{
public required string NodeId { get; init; }
public required bool Cordoned { get; init; }
}
public sealed record ClusterRebalanceResponse
{
public required bool Rebalanced { get; init; }
public required long CurrentEpoch { get; init; }
}
public sealed record ClusterNodeRemovedResponse
{
public required string NodeId { get; init; }
public required bool Removed { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/ClusterTopology.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/ClusterTopology.cs
----
namespace redb.Tsak.Contracts;
/// Snapshot of the entire cluster state read from redb.
public class ClusterTopology
{
public string ClusterName { get; set; } = "unknown";
public List Groups { get; set; } = [];
public List Nodes { get; set; } = [];
///
/// Leader of the FIRST group with one — kept for wire compatibility. Leadership is
/// per-group; use (review 2026-09-02, С14: a single field rendered an
/// arbitrary group's leader for the whole cluster).
///
public LeaderInfo? Leader { get; set; }
/// Per-group leaders, keyed by group name.
public Dictionary Leaders { get; set; } = [];
public List Assignments { get; set; } = [];
}
/// Cluster group (geographic or logical partition).
public class GroupInfo
{
public string GroupName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
/// Information about a single node in the topology.
public class NodeInfo
{
public string NodeId { get; set; } = string.Empty;
public string Hostname { get; set; } = string.Empty;
public string GroupName { get; set; } = string.Empty;
///
/// The cluster the node belongs to. A database can hold several clusters with equal group names and
/// node ids; a record written before cluster isolation (4.0.x) carries none.
///
public string? ClusterName { get; set; }
public NodeStatus Status { get; set; }
public DateTimeOffset LastHeartbeat { get; set; }
public DateTimeOffset StartedAt { get; set; }
public string ApiEndpoint { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public string Capabilities { get; set; } = string.Empty;
/// Cordoned = takes on no new work (draining/drained). Orthogonal to status.
public bool Cordoned { get; set; }
///
/// Freshness window for . The topology provider sets it from the
/// cluster's actual dead-node timeout — a hardcoded 60s rendered healthy nodes "Stale"
/// whenever an operator legitimately widened the heartbeat cadence
/// (review 2026-09-02, С17).
///
public int AliveWindowSeconds { get; set; } = 60;
/// Node is online and its heartbeat is fresh (within ).
public bool IsAlive => Status == NodeStatus.Online
&& LastHeartbeat > DateTimeOffset.UtcNow.AddSeconds(-AliveWindowSeconds);
}
/// Current cluster leader information.
public class LeaderInfo
{
public string NodeId { get; set; } = string.Empty;
public long Epoch { get; set; }
public DateTimeOffset AcquiredAt { get; set; }
public DateTimeOffset ExpiresAt { get; set; }
}
/// Module-to-node assignment in the cluster.
public class AssignmentInfo
{
public string ModuleName { get; set; } = string.Empty;
public string NodeId { get; set; } = string.Empty;
public int State { get; set; }
public DateTimeOffset AssignedAt { get; set; }
public string GroupName { get; set; } = string.Empty;
}
Path: redb-tsak/src/redb.Tsak.Contracts/ContextModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/ContextModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record ContextSummary
{
public required string Name { get; init; }
public required string Status { get; init; }
public required int EndpointCount { get; init; }
public bool IsAnonymous { get; init; }
public int RouteCount { get; init; }
}
public sealed record ContextDetail
{
public required string Name { get; init; }
public required string Status { get; init; }
public required int EndpointCount { get; init; }
public required bool AutoStart { get; init; }
public bool IsAnonymous { get; init; }
public string[] Components { get; init; } = [];
public TsakRouteInfo[] Routes { get; init; } = [];
public TsakEndpointInfo[] Endpoints { get; init; } = [];
public DateTimeOffset? StartedAt { get; init; }
}
public sealed record ContextActionResponse
{
public required string Name { get; init; }
public string? Status { get; init; }
public bool? Removed { get; init; }
/// In-flight exchange count at the moment stop/restart was initiated.
public int? InflightBefore { get; init; }
/// In-flight exchange count after drain completed (0 = fully drained).
public int? InflightAfter { get; init; }
/// Time spent draining in-flight exchanges (ms).
public long? DrainTimeMs { get; init; }
}
public sealed record TsakRouteInfo
{
public required string RouteId { get; init; }
public required string FromUri { get; init; }
public required string Status { get; init; }
public bool AutoStart { get; init; }
public int InflightCount { get; init; }
/// True if the route is managed by a cluster policy (distributed lock).
public bool IsCluster { get; init; }
///
/// Effective cluster-policy resolution captured at route compile time. Surfaces
/// whether .Cluster(true) was requested and which policy (if any) was attached.
/// May be null on older Route runtimes that do not expose the descriptor yet.
///
public RoutePolicyInfo? Policy { get; init; }
}
///
/// Compact projection of RoutePolicyDescriptor for API serialization, decoupled
/// from the redb.Route assembly to keep redb.Tsak.Contracts dependency-free.
///
public sealed record RoutePolicyInfo
{
/// True if the route declared .Cluster(true).
public required bool RequestedCluster { get; init; }
/// One of: "AllNodes", "ClusterLeader", "Custom".
public required string EffectivePolicy { get; init; }
/// Fully-qualified factory type name, or null when no factory was used.
public string? PolicyFactoryType { get; init; }
/// Human-readable explanation.
public required string Reason { get; init; }
}
///
/// Detailed per-route information including inflight exchanges.
/// Returned by GET /api/contexts/{ctx}/routes/{routeId}.
///
public sealed record RouteDetail
{
public required string RouteId { get; init; }
public required string FromUri { get; init; }
public required string Status { get; init; }
public bool AutoStart { get; init; }
public int InflightCount { get; init; }
public TsakEndpointInfo[] Endpoints { get; init; } = [];
/// Policy-specific metadata (e.g., cluster/leader info). Null if no policy.
public IReadOnlyDictionary? PolicyMetadata { get; init; }
}
///
/// Snapshot of an in-flight exchange exposed via the REST API.
///
public sealed record InflightExchangeDto
{
public required string ExchangeId { get; init; }
public required string RouteId { get; init; }
public required DateTime StartedAt { get; init; }
public required double ElapsedMs { get; init; }
public required int ThreadId { get; init; }
public string? FromEndpoint { get; init; }
}
///
/// Response for route start/stop operations.
///
public sealed record RouteActionResponse
{
public required string RouteId { get; init; }
public required string Status { get; init; }
}
public sealed record TsakEndpointInfo
{
public required string Uri { get; init; }
public required string Scheme { get; init; }
public bool IsConsumer { get; init; }
public bool IsProducer { get; init; }
public long MessagesIn { get; init; }
public long MessagesOut { get; init; }
public long Errors { get; init; }
public long Warnings { get; init; }
public long BytesIn { get; init; }
public long BytesOut { get; init; }
///
/// Requests shed by an admission limit (e.g. maxConcurrentRequests) before a pipeline
/// ran — the transport answered 429/503, no exchange was created, so they are counted in
/// neither nor .
///
public long Rejected { get; init; }
///
/// Requests refused as the caller's fault (a message the endpoint does not accept: a bad signature, a broken
/// envelope, an unknown agreement). Counted apart from : the endpoint is fine, the sender is not.
///
public long Refused { get; init; }
/// When the last request was refused; null when none was.
public DateTimeOffset? LastRefusalTime { get; init; }
/// Why the last request was refused; null when none was.
public string? LastRefusalMessage { get; init; }
public double ThroughputPerSecond { get; init; }
public string HealthStatus { get; init; } = "Healthy";
public string? HealthReason { get; init; }
public DateTimeOffset? LastActivity { get; init; }
public DateTimeOffset? StartedAt { get; init; }
public TimeSpan Uptime { get; init; }
public TimeSpan AverageProcessingTime { get; init; }
public string? LastErrorMessage { get; init; }
public DateTimeOffset? LastErrorTime { get; init; }
public string? LastWarningMessage { get; init; }
public DateTimeOffset? LastWarningTime { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/DeployAdviceModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/DeployAdviceModels.cs
----
namespace redb.Tsak.Contracts;
///
/// How to deploy a new package on a node, from GET /api/health/deploy: the status code says it alone (200
/// , 409 ). The endpoint only advises; the
/// orchestrator deploys.
///
public sealed record DeployAdviceResponse
{
/// The node that answers: the cluster node id, or the machine name outside a cluster.
public required string NodeId { get; init; }
/// or .
public required string Verdict { get; init; }
/// Why a cold deploy, as codes of ; empty for a hot swap.
public IReadOnlyList Reasons { get; init; } = [];
/// Module load contexts in memory.
public int ModuleContextsAlive { get; init; }
/// Module load contexts in memory after their modules were replaced or removed.
public int OrphanedModuleContexts { get; init; }
/// The limit of (Tsak:HotReload:MaxOrphanedContexts).
public int MaxOrphanedModuleContexts { get; init; }
/// The working set of the process, in MB.
public double WorkingSetMb { get; init; }
/// The limit of (Tsak:HotReload:MaxWorkingSetMb); null when none is set.
public double? MaxWorkingSetMb { get; init; }
/// Whether replaced module versions are unloaded (Tsak:HotReload:Collectible).
public bool Collectible { get; init; }
/// When the advice was taken.
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
}
///
/// The same advice for every alive node of the cluster, from GET /api/health/deploy/cluster on any node: it asks
/// each node of the registry at its API endpoint. 200 only when every node says ,
/// 409 otherwise. Outside a cluster the list holds the answering node alone.
///
public sealed record ClusterDeployAdviceResponse
{
/// when every node says so, else .
public required string Verdict { get; init; }
/// The node that answered the call.
public required string AnsweredBy { get; init; }
/// One advice per alive node.
public IReadOnlyList Nodes { get; init; } = [];
}
/// The two verdicts of a deploy advice.
public static class DeployVerdicts
{
/// Drop the package into modules/ of the running node.
public const string HotSwap = "hot-swap";
/// Cordon the node, stop it, replace the packages in modules/, start it, wait for ready, uncordon.
public const string ColdDeploy = "cold-deploy";
}
/// Why a deploy advice says .
public static class DeployReasons
{
/// More module contexts stay in memory than Tsak:HotReload:MaxOrphanedContexts allows.
public const string OrphanedContextsAboveLimit = "orphaned-contexts-above-limit";
/// With Collectible=false the next hot swap leaves one more context and goes above the limit.
public const string NextSwapExceedsLimit = "next-swap-exceeds-limit";
/// The working set is above Tsak:HotReload:MaxWorkingSetMb.
public const string WorkingSetAboveLimit = "working-set-above-limit";
/// The node is cordoned: it is in maintenance.
public const string NodeCordoned = "node-cordoned";
/// The node has not finished its start (the startup probe would answer 503).
public const string StartupNotFinished = "startup-not-finished";
/// Cluster form: the node is alive in the registry, but its advice could not be read from its API endpoint.
public const string NodeUnreachable = "node-unreachable";
}
Path: redb-tsak/src/redb.Tsak.Contracts/DiagnosticModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/DiagnosticModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Full system diagnostic dump — analogous to a JVM thread dump,
/// adapted for .NET (no per-thread stacks).
///
public sealed record DiagnosticDump
{
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
public IReadOnlyList InflightExchanges { get; init; } = [];
public required ThreadPoolDiagnostics ThreadPool { get; init; }
public required GcDiagnostics GarbageCollector { get; init; }
public IReadOnlyList Contexts { get; init; } = [];
public IReadOnlyList ActiveAlerts { get; init; } = [];
public IReadOnlyList RecentEvents { get; init; } = [];
public SystemMetricsSnapshot? SystemMetrics { get; init; }
}
///
/// Per-context summary in the diagnostic dump.
///
public sealed record DiagnosticContextSummary
{
public required string ContextName { get; init; }
public bool IsStarted { get; init; }
public int RouteCount { get; init; }
public int EndpointCount { get; init; }
public int InflightCount { get; init; }
}
///
/// Thread pool snapshot for diagnostics.
///
public sealed record ThreadPoolDiagnostics
{
public long PendingWorkItems { get; init; }
public int WorkerThreadsAvailable { get; init; }
public int WorkerThreadsMin { get; init; }
public int WorkerThreadsMax { get; init; }
public int IoThreadsAvailable { get; init; }
public int IoThreadsMin { get; init; }
public int IoThreadsMax { get; init; }
}
///
/// GC statistics snapshot for diagnostics.
///
public sealed record GcDiagnostics
{
public int Gen0Collections { get; init; }
public int Gen1Collections { get; init; }
public int Gen2Collections { get; init; }
public double TotalMemoryMB { get; init; }
}
///
/// Diagnostic dump for a single route.
///
public sealed record RouteDiagnosticDump
{
public required string RouteId { get; init; }
public required string FromUri { get; init; }
public required string Status { get; init; }
public bool AutoStart { get; init; }
public IReadOnlyList InflightExchanges { get; init; } = [];
public RouteMetricsSummary? Metrics { get; init; }
public IReadOnlyList RecentErrors { get; init; } = [];
public IReadOnlyList LifecycleHistory { get; init; } = [];
}
Path: redb-tsak/src/redb.Tsak.Contracts/DlqModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/DlqModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Response for GET /api/exchanges/failed: a newest-first page of dead-lettered exchanges.
/// is false when the node runs without a database (the DLQ needs a
/// durable store).
///
public sealed record FailedExchangeQueryResult
{
public required bool Available { get; init; }
public int? Count { get; init; }
public int? Limit { get; init; }
public int? Offset { get; init; }
public string? Error { get; init; }
public FailedExchangeEntry[] Entries { get; init; } = [];
}
/// A single dead-lettered exchange captured at a route checkpoint.
public sealed record FailedExchangeEntry
{
public required string EntryId { get; init; }
public required DateTimeOffset OccurredAt { get; init; }
public required string ContextName { get; init; }
public required string RouteId { get; init; }
public required string MarkerName { get; init; }
public string Status { get; init; } = "pending";
public string? ExceptionType { get; init; }
public string? ExceptionMessage { get; init; }
public string? CorrelationId { get; init; }
/// Body kind: bytes / string / json / none.
public string BodyKind { get; init; } = "none";
/// Whether this entry can be replayed after a restart (body/state round-trips).
public bool Replayable { get; init; }
public DateTimeOffset? ReplayedAt { get; init; }
}
/// Result of POST /api/exchanges/{id}/replay.
public sealed record ExchangeReplayResult
{
public required bool Success { get; init; }
public required string Message { get; init; }
public string? EntryId { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/IModuleHealthContributor.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/IModuleHealthContributor.cs
----
namespace redb.Tsak.Contracts;
///
/// Per-module health probe SPI. Modules register an implementation via DI to surface their own
/// status into the aggregated /api/health/{startup,live,ready} endpoints, without coupling
/// to the host-internal IHealthContributor (which sees the whole evaluation bag).
///
/// Lives in redb.Tsak.Contracts — the lightweight contract assembly — precisely so a
/// module (e.g. redb.Identity) can implement it without taking a compile-time dependency on the
/// full redb.Tsak.Core host and its transitive graph. is the
/// only type it touches, and it lives here too.
///
///
/// Each contributor's status is added to the evaluation under the key "module:{ModuleName}".
/// Exceptions thrown from are translated to
/// by the host so a misbehaving probe cannot crash the
/// health endpoint.
///
///
public interface IModuleHealthContributor
{
///
/// Stable, short name used as the entry key in the health evaluation bag (e.g. "orders" →
/// "module:orders"). Should be unique across registered contributors; ties are merged
/// by taking the worst status.
///
string ModuleName { get; }
///
/// Returns the current health status of the module. Implementations should be fast (single-digit
/// ms target) and must respect .
///
Task CheckHealthAsync(CancellationToken ct);
}
Path: redb-tsak/src/redb.Tsak.Contracts/LifecycleModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/LifecycleModels.cs
----
using System.Text.Json.Serialization;
namespace redb.Tsak.Contracts;
///
/// A single lifecycle event recorded by the audit trail.
///
public sealed record LifecycleEvent(
DateTime Timestamp,
string ContextName,
string? RouteId,
LifecycleEventType EventType,
string? Details);
///
/// Types of lifecycle events tracked by the audit trail.
///
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum LifecycleEventType
{
ContextStarted,
ContextStopped,
ContextRemoved,
RouteStarted,
RouteStopped,
RouteSuspended,
RouteErrored,
ExchangeTimedOut,
ExchangeHung,
WatchdogAutoRestart
}
Path: redb-tsak/src/redb.Tsak.Contracts/LogModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/LogModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Logs query response.
///
public sealed record LogsResponse
{
public required bool Available { get; init; }
public int? Count { get; init; }
public int? TotalBuffered { get; init; }
public int? BufferCapacity { get; init; }
public LogEntry[]? Entries { get; init; }
}
///
/// Individual log entry with monotonic ID for incremental fetch.
///
public sealed record LogEntry
{
public required long Id { get; init; }
public required DateTimeOffset Timestamp { get; init; }
public required string Level { get; init; }
public required string Message { get; init; }
public string? Source { get; init; }
public string? Exception { get; init; }
}
///
/// Log file info for file listing.
///
public sealed record LogFileInfo
{
public required string Name { get; init; }
public required long Size { get; init; }
public required DateTimeOffset LastModified { get; init; }
}
///
/// Log files listing response.
///
public sealed record LogFilesResponse
{
public required bool Available { get; init; }
public LogFileInfo[]? Files { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/MetricsModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/MetricsModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Per-route metrics summary, derived from the route's consumer endpoint statistics.
///
public sealed record RouteMetricsSummary
{
///
/// The context the route belongs to. A route id is unique only inside its context, so without this the
/// dashboard cannot turn a row of this summary into a link to that route — which is the whole point of
/// listing the busiest and the error-prone ones.
///
public string ContextName { get; init; } = "";
public required string RouteId { get; init; }
public required string Status { get; init; }
public int InflightCount { get; init; }
public long MessagesProcessed { get; init; }
public long Errors { get; init; }
///
/// Requests shed by an admission limit (e.g. maxConcurrentRequests) BEFORE a pipeline
/// ran: the transport answered 429/503 and no exchange was created, so these are counted in
/// neither nor . A growing value with zero
/// errors means the service is healthy but under-provisioned (or facing a surge).
///
public long Rejected { get; init; }
///
/// Requests the route's consumer refused as the caller's fault (a bad signature, a broken envelope, an unknown
/// agreement), counted apart from : the route is fine, the sender is not.
///
public long Refused { get; init; }
/// When the last request was refused; null when none was.
public DateTime? LastRefusalTime { get; init; }
/// Why the last request was refused; null when none was.
public string? LastRefusal { get; init; }
public long Warnings { get; init; }
public double AvgProcessingMs { get; init; }
public double ThroughputPerSecond { get; init; }
public DateTime? LastActivity { get; init; }
public string? LastError { get; init; }
public DateTime? LastErrorTime { get; init; }
public string? LastWarning { get; init; }
public DateTime? LastWarningTime { get; init; }
public string? Uptime { get; init; }
}
///
/// Aggregated dashboard snapshot for the web UI.
///
public sealed record DashboardSnapshot
{
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
public int TotalContexts { get; init; }
public int RunningContexts { get; init; }
public int TotalInflight { get; init; }
public IReadOnlyList BusiestRoutes { get; init; } = [];
public IReadOnlyList ErrorProneRoutes { get; init; } = [];
///
/// Routes currently shedding load: > 0.
/// Deliberately separate from — a route sitting at its
/// concurrency ceiling with zero errors is healthy but under-provisioned, and the operator
/// response (raise the limit, add nodes) differs from bug-hunting.
///
public IReadOnlyList SheddingRoutes { get; init; } = [];
///
/// Routes whose consumer refused requests as the caller's fault: > 0.
/// Apart from as well: the answer is a word with the sender, not a fix here.
///
public IReadOnlyList RefusingRoutes { get; init; } = [];
public IReadOnlyList ActiveAlerts { get; init; } = [];
public SystemMetricsSnapshot? SystemMetrics { get; init; }
}
///
/// Lightweight system metrics for the dashboard.
///
public sealed record SystemMetricsSnapshot
{
public double CpuPercent { get; init; }
public double MemoryMB { get; init; }
public int ThreadCount { get; init; }
public int Gen2Collections { get; init; }
/// Module load contexts in memory ().
public int ModuleContextsAlive { get; init; }
/// Module load contexts in memory after their modules went ().
public int OrphanedModuleContexts { get; init; }
/// Null within the limit; above it, what the node needs ().
public string? ModuleContextsNotice { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/ModuleModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/ModuleModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record ModuleInfo
{
public required string ModuleName { get; init; }
public string? Version { get; init; }
public string? Description { get; init; }
public required string Status { get; init; }
public required bool CanInitialize { get; init; }
public required string[] Dependencies { get; init; }
}
public sealed record ModuleRemovedResponse
{
public required string ModuleName { get; init; }
public required bool Removed { get; init; }
}
/// Result of a module upload or rollback.
public sealed record ModuleDeployResponse
{
public required bool Success { get; init; }
public required string Message { get; init; }
public string? ModuleName { get; init; }
public string? Version { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/NodeStatus.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/NodeStatus.cs
----
namespace redb.Tsak.Contracts;
///
/// Status of a node (cluster or standalone).
/// Canonical source — all other code references this enum.
///
public enum NodeStatus
{
/// Node is running and sending heartbeats.
Online,
/// Node gracefully shut down.
Offline,
/// Node missed heartbeat threshold — considered dead.
Dead
}
Path: redb-tsak/src/redb.Tsak.Contracts/README.md
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/README.md
----
# redb.Tsak.Contracts
> Documentation and articles:
Shared DTO (Data Transfer Object) library for the [redb.Tsak](../../README.md) management API. Contains all request and response types that flow between the Tsak Worker (server) and consumers: the typed HTTP client (`redb.Tsak.Client`), the CLI (`redb.Tsak.CLI`), the Web dashboard, and any third-party integration.
## Why a dedicated contracts assembly?
- **Zero external dependencies** — no NuGet packages beyond the .NET SDK. Can be referenced anywhere without pulling in server-side dependencies.
- **Shared source of truth** — both `redb.Tsak.Core` (server controllers) and `redb.Tsak.Client` (HTTP client) reference this single assembly, eliminating DTO drift.
- **Stable API surface** — the types in this assembly form the public REST API contract. Additive changes are backwards-compatible; breaking changes follow semver.
## Install
```bash
dotnet add package redb.Tsak.Contracts
```
Usually you do not reference this package directly. It is pulled in transitively by `redb.Tsak.Client`.
## Model reference
All types are `sealed record` with `init`-only properties, serialized with `System.Text.Json` (case-insensitive, enum-as-string).
### Auth (`AuthModels.cs`)
| Type | Description |
|---|---|
| `ApiKeyCreatedResponse` | Result of key creation — includes the raw key (shown once only) |
| `ApiKeyInfo` | Key metadata: ID, name, roles, expiry, validity |
| `ApiKeyRevokedResponse` | Confirmation of revocation |
```csharp
public sealed record ApiKeyCreatedResponse
{
public required string Id { get; init; }
public required string Key { get; init; } // raw key — save it now
public required string Name { get; init; }
public required string Roles { get; init; }
public string? UserId { get; init; }
public required DateTimeOffset CreatedAt { get; init; }
public DateTimeOffset? ExpiresAt { get; init; }
public string? Message { get; init; }
}
```
### Cluster (`ClusterModels.cs`, `ClusterTopology.cs`, `NodeStatus.cs`)
| Type | Description |
|---|---|
| `ClusterStatusResponse` | Enabled flag, node ID, leader flag, current epoch |
| `ClusterNodesResponse` | `Enabled` flag + `Nodes` list |
| `ClusterNodeInfo` | Node ID, hostname, status (`NodeStatus` enum), started-at, last-heartbeat |
| `ClusterRebalanceResponse` | New epoch after rebalance |
| `ClusterNodeRemovedResponse` | Confirmation of node removal |
| `NodeStatus` | Enum: `Unknown`, `Active`, `Offline`, `Dead` |
| `ClusterTopology` | redb-backed topology map (context → node assignments) |
### Contexts (`ContextModels.cs`)
| Type | Description |
|---|---|
| `ContextSummary` | Name, status, endpoint count, anonymous flag, route count |
| `ContextDetail` | Full context view: routes, endpoints, components, autostart, started-at |
| `ContextActionResponse` | Result of start/stop/restart/remove; includes drain metrics |
| `TsakRouteInfo` | Route ID, from-URI, status, autostart, inflight count, cluster policy |
| `TsakEndpointInfo` | Endpoint URI and type |
| `RouteDetail` | Full route view: endpoints, policy metadata |
| `RoutePolicyInfo` | Cluster policy: requested flag, effective policy, factory type, reason |
| `RouteActionResponse` | Result of a route lifecycle operation |
| `InflightExchangeDto` | Snapshot of one in-flight exchange (ID, route, age, body preview) |
`ContextActionResponse` carries drain telemetry useful for capacity planning:
```csharp
public sealed record ContextActionResponse
{
public required string Name { get; init; }
public string? Status { get; init; }
public bool? Removed { get; init; }
public int? InflightBefore { get; init; } // exchanges at stop initiation
public int? InflightAfter { get; init; } // exchanges after drain (0 = fully drained)
public long? DrainTimeMs { get; init; } // time spent draining
}
```
### Diagnostics (`DiagnosticModels.cs`)
| Type | Description |
|---|---|
| `DiagnosticDump` | Full system snapshot: inflight exchanges, ThreadPool, GC, context summaries, watchdog alerts, lifecycle events |
| `DiagnosticContextSummary` | Per-context counts in the dump |
| `ThreadPoolDiagnostics` | Pending work items, worker thread pool min/max/available |
| `GcDiagnostics` | Gen0/1/2 collection counts, total managed memory (MB) |
| `RouteDiagnosticDump` | Single-route dump: inflight, metrics, recent errors, lifecycle history |
### Lifecycle (`LifecycleModels.cs`)
| Type | Description |
|---|---|
| `LifecycleEvent` | Timestamp, context name, route ID, event type, details string |
| `LifecycleEventType` | Enum: `ContextStarted`, `ContextStopped`, `RouteStarted`, `RouteStopped`, `RouteError`, `ModuleLoaded`, `ModuleUnloaded`, … |
### Logs (`LogModels.cs`)
| Type | Description |
|---|---|
| `LogsResponse` | `Available` flag, `Entries` list, optional continuation ID |
| `LogEntry` | Timestamp, level, source, message |
| `LogFilesResponse` | `Available` flag, list of `LogFileInfo` (name, size, last-modified) |
### Metrics (`MetricsModels.cs`)
| Type | Description |
|---|---|
| `MetricsResponse` | `Available` flag, latest `SystemMetricsSnapshot`, stored point count |
| `MetricsHistoryResponse` | Time-windowed list of `SystemMetricsSnapshot` |
| `SystemMetricsSnapshot` | System metrics of the diagnostic dump and the dashboard: CPU, memory, threads, Gen2 collections, module contexts in memory and orphaned ones, notice |
| `RouteMetricsSummary` | Per-route: processed count, error count, avg/max latency (ms) |
| `DashboardSnapshot` | Aggregated view: system metrics + context/route states |
### Modules (`ModuleModels.cs`)
| Type | Description |
|---|---|
| `ModuleInfo` | Module name, version, description, status, `CanInitialize` flag, dependencies |
| `ModuleRemovedResponse` | Confirmation of removal |
### Scheduler (`SchedulerModels.cs`)
| Type | Description |
|---|---|
| `SchedulerStatusResponse` | Status string, scheduler name, instance ID, started/standby/shutdown flags, job counts |
| `ScheduledJobsResponse` | List of `ScheduledJobInfo` |
| `ScheduledJobInfo` | Job name, group, trigger state, cron expression, next/previous fire time |
| `RunningJobsResponse` | List of `RunningJobInfo` |
| `RunningJobInfo` | Job name, group, fire time, runtime (ms) |
| `SchedulerActionResponse` | Message string from start/standby/pause/resume |
### System (`SystemModels.cs`)
| Type | Description |
|---|---|
| `SystemInfoResponse` | Version, started-at, uptime string, context count, module count, machine name, CPU count, working set (MB), module contexts in memory and orphaned ones with their limit and notice |
| `HealthCheckResult` | Status enum, description, per-check dictionary, timestamp |
### Users (`UserModels.cs`)
| Type | Description |
|---|---|
| `TsakUserInfo` | Login, display name, email, roles, created-at |
| `TsakCreateUserRequest` | Login, display name, email, password, roles |
| `TsakUpdateUserRequest` | Display name, email, password, roles (all optional) |
### Watchdog (`WatchdogModels.cs`)
| Type | Description |
|---|---|
| `WatchdogState` | Last check time, suspected/hung exchange counts, auto-restart count, enabled flag, active alerts list |
| `WatchdogAlert` | Exchange ID, route ID, context name, level (`Suspected`/`Hung`), detected-at, elapsed seconds |
## Serialization conventions
All types are designed for `System.Text.Json` with these settings (applied by `TsakApiClient`):
```csharp
new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
Converters = { new JsonStringEnumConverter() }
}
```
Enum values serialize as their string names (e.g. `"Active"`, not `2`). All date/time values use `DateTimeOffset` (UTC).
## Versioning
This assembly follows [Semantic Versioning](https://semver.org):
- **Additive changes** (new optional properties, new enum members) → patch/minor bump, fully backwards-compatible.
- **Renames or removals** → major version bump, coordinated with `redb.Tsak.Core` and `redb.Tsak.Client`.
Current version: **1.0.4**
## Related projects
| Project | Role |
|---|---|
| [redb.Tsak.Client](../redb.Tsak.Client/README.md) | Typed HTTP client that returns these types |
| [redb.Tsak.Core](../redb.Tsak.Core/README.md) | Server-side controllers that produce these types |
| [redb.Tsak.CLI](../redb.Tsak.CLI/README.md) | CLI tool that consumes these types via the client |
| [redb.Tsak](../../README.md) | Full project overview |
Path: redb-tsak/src/redb.Tsak.Contracts/SchedulerModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/SchedulerModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record SchedulerStatusResponse
{
public required bool IsStarted { get; init; }
public required bool InStandbyMode { get; init; }
public required bool IsShutdown { get; init; }
public required string SchedulerName { get; init; }
public required string SchedulerInstanceId { get; init; }
public required int TotalJobs { get; init; }
public required int RunningJobs { get; init; }
public required string Status { get; init; }
public required DateTime Timestamp { get; init; }
///
/// One entry per route context that has a Quartz scheduler — each context owns one. The fields above summarize
/// them for the node: the counts are sums, means all are started,
/// that at least one is in standby, is the common prefix.
///
public SchedulerContextStatus[] Schedulers { get; init; } = [];
}
/// The Quartz scheduler of one route context.
public sealed record SchedulerContextStatus
{
public required string Context { get; init; }
public required string SchedulerName { get; init; }
public required string SchedulerInstanceId { get; init; }
public required bool IsStarted { get; init; }
public required bool InStandbyMode { get; init; }
public required bool IsShutdown { get; init; }
public required int TotalJobs { get; init; }
public required int RunningJobs { get; init; }
public required string Status { get; init; }
}
public sealed record ScheduledJobsResponse
{
public required int TotalScheduledJobs { get; init; }
public required ScheduledJobInfo[] Jobs { get; init; }
}
public sealed record ScheduledJobInfo
{
public required string JobKey { get; init; }
public required string JobName { get; init; }
public required string JobGroup { get; init; }
public required string JobType { get; init; }
public required string TriggerKey { get; init; }
public required string TriggerState { get; init; }
public string? CronExpression { get; init; }
public DateTime? NextFireTime { get; init; }
public DateTime? PreviousFireTime { get; init; }
public required int Priority { get; init; }
/// The route context whose scheduler holds the job; a job key is unique within it only.
public string? Context { get; init; }
}
public sealed record RunningJobsResponse
{
public required int TotalRunningJobs { get; init; }
public required RunningJobInfo[] Jobs { get; init; }
}
public sealed record RunningJobInfo
{
public required string JobKey { get; init; }
public required string JobName { get; init; }
public required string JobGroup { get; init; }
public required string JobType { get; init; }
public required string TriggerKey { get; init; }
public required DateTime FireTime { get; init; }
public required long RunTimeMs { get; init; }
public required int RefireCount { get; init; }
/// The route context whose scheduler runs the job.
public string? Context { get; init; }
}
public sealed record SchedulerActionResponse
{
public required bool Success { get; init; }
public required string Message { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/StorageModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/StorageModels.cs
----
namespace redb.Tsak.Contracts;
///
/// One redb instance the node can reach: the host's own storage, or an instance a context declares in its
/// Redb section. What the engine behind it can report differs, and the dashboard hides what it cannot
/// answer instead of printing empty columns — hence the capability flags rather than "the value came back null".
///
public sealed record RedbInstanceInfo
{
/// Instance name; empty for the host's own storage.
public string Name { get; init; } = "";
/// Context that declares the instance; null for the host's own storage.
public string? ContextName { get; init; }
/// Provider as configured: postgres, mssql or sqlite.
public string Provider { get; init; } = "";
/// Whether the instance runs the Pro tier.
public bool UsePro { get; init; }
///
/// Whether the context named this instance as its active one. A non-active instance is registered but
/// never connected on start, so asking it for statistics is what opens its connection.
///
public bool IsActive { get; init; }
///
/// Short fingerprint of provider and connection string: instances that share it address the same database.
/// Identity alone declares the same three databases in five contexts, which listed one row each is fifteen
/// rows of the same three things — the dashboard groups by this instead of guessing from the name, which
/// two contexts may well reuse for different databases. The connection string itself never leaves the node.
///
public string Fingerprint { get; init; } = "";
/// Whether the engine has schemas at all (SQLite does not).
public bool SupportsSchemas { get; init; }
/// Whether the engine counts index usage (SQLite does not).
public bool SupportsUsageCounters { get; init; }
/// Whether the engine records when statistics were last refreshed (SQLite does not).
public bool SupportsAnalyzeTimestamps { get; init; }
}
/// Everything one instance reports in a single read: the counter window, its tables and its indexes.
public sealed record RedbStorageStats
{
/// Instance the numbers came from; empty for the host's own storage.
public string Instance { get; init; } = "";
/// Context of that instance; null for the host's own storage.
public string? ContextName { get; init; }
///
/// Since when the usage counters have been counting: a statistics reset, or the server start. Null when
/// the engine does not say — and then a zero counter means nothing at all.
///
public DateTimeOffset? CountersSince { get; init; }
/// Whether this node is a replica, so the counters describe reads served here and nowhere else.
public bool? IsReplica { get; init; }
/// Tables of the database, redb's own and everyone else's.
public IReadOnlyList Tables { get; init; } = [];
/// Indexes of those tables.
public IReadOnlyList Indexes { get; init; } = [];
}
/// One table as the database catalogs report it. Null means the engine does not say.
public sealed record RedbTableInfo
{
/// Schema of the table; null on an engine without schemas.
public string? Schema { get; init; }
/// Table name.
public string Table { get; init; } = "";
/// Whether the table belongs to redb itself rather than to the application.
public bool IsRedbOwned { get; init; }
/// Row estimate.
public long? EstimatedRows { get; init; }
/// Size of the data, without the indexes.
public long? DataSizeBytes { get; init; }
/// Size of every index of this table together.
public long? IndexesSizeBytes { get; init; }
/// Dead rows awaiting vacuum (PostgreSQL).
public long? DeadRows { get; init; }
/// When statistics were last refreshed by hand.
public DateTimeOffset? LastAnalyze { get; init; }
/// When the engine last refreshed them on its own.
public DateTimeOffset? LastAutoAnalyze { get; init; }
/// When the table was last vacuumed (PostgreSQL).
public DateTimeOffset? LastVacuum { get; init; }
/// Whether statistics exist at all; the only answer SQLite can give about them.
public bool? HasStatistics { get; init; }
}
/// One index as the database catalogs report it. Null means the engine does not say.
public sealed record RedbIndexInfo
{
/// Schema of the table; null on an engine without schemas.
public string? Schema { get; init; }
/// Table the index belongs to.
public string Table { get; init; } = "";
/// Index name.
public string Name { get; init; } = "";
/// Whether the index is unique.
public bool? IsUnique { get; init; }
/// Key columns, in index order.
public IReadOnlyList Columns { get; init; } = [];
/// Columns carried but not keyed on (SQL Server), which is what makes an index covering.
public IReadOnlyList IncludedColumns { get; init; } = [];
/// Whether the index backs the primary key.
public bool IsPrimaryKey { get; init; }
/// Whether the index enforces a uniqueness constraint.
public bool IsUniqueConstraint { get; init; }
/// Whether the index is clustered (SQL Server).
public bool? IsClustered { get; init; }
/// Whether a foreign key relies on the index.
public bool BacksForeignKey { get; init; }
/// Whether the index belongs to a table of redb itself.
public bool IsRedbOwned { get; init; }
///
/// Whether removing the index would break the engine or a constraint. Such an index is shown and never
/// offered for removal: some of them read zero because they hold a key, not because nobody uses them.
///
public bool IsSystemCritical { get; init; }
/// Why the index is critical: RedbMetadata, RedbSecurity, RedbData, PrimaryKey, Unique, ForeignKey or None.
public string CriticalReason { get; init; } = "None";
/// On-disk size.
public long? SizeBytes { get; init; }
/// Row estimate of the index.
public long? EstimatedRows { get; init; }
/// Point lookups; on PostgreSQL the engine's single combined scan counter.
public long? Seeks { get; init; }
/// Range and full scans, where the engine splits the counter.
public long? Scans { get; init; }
/// Maintenance writes into the index (SQL Server).
public long? Updates { get; init; }
/// When the index last served a read.
public DateTimeOffset? LastUsed { get; init; }
}
/// Result of refreshing planner statistics.
public sealed record RedbAnalyzeResult
{
/// Instance that was analyzed; empty for the host's own storage.
public string Instance { get; init; } = "";
/// Table that was analyzed; null when the whole database was.
public string? Table { get; init; }
/// Schema of that table.
public string? Schema { get; init; }
/// How long the refresh took.
public long ElapsedMs { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/SystemModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/SystemModels.cs
----
using System.Text.Json.Serialization;
namespace redb.Tsak.Contracts;
///
/// Effective (merged, resolved) configuration for this node, from GET /api/system/config.
/// Flat key → value map over the Tsak:* and ConnectionStrings:* sections, with secrets
/// redacted. Answers "what settings is this node actually running with" on an incident.
///
public sealed record EffectiveConfigResult
{
public required bool Available { get; init; }
public int RedactedCount { get; init; }
public IReadOnlyDictionary Values { get; init; } =
new Dictionary();
}
///
/// Health check states.
///
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum HealthStatus
{
Healthy,
Degraded,
Unhealthy
}
///
/// Result of a health check evaluation.
///
public sealed record HealthCheckResult
{
public HealthStatus Status { get; init; }
public string Description { get; init; } = "";
public Dictionary Checks { get; init; } = new();
/// What a check that is not healthy found, by its key in ; empty when none explains itself.
public Dictionary Details { get; init; } = new();
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
}
///
/// System metrics response.
///
public sealed record MetricsResponse
{
public required bool Available { get; init; }
public int? StoredPoints { get; init; }
public MetricSnapshot? Latest { get; init; }
}
///
/// Metrics history response (array of snapshots over a time window).
///
public sealed record MetricsHistoryResponse
{
public required bool Available { get; init; }
public MetricSnapshot[] Points { get; init; } = [];
}
///
/// A single snapshot of process and system metrics at a point in time.
///
public sealed record MetricSnapshot
{
public DateTime Timestamp { get; init; }
public long TimestampMs { get; init; }
public CpuMetrics Cpu { get; init; } = new();
public MemoryMetrics Memory { get; init; } = new();
public ThreadingMetrics Threading { get; init; } = new();
public GcMetrics GarbageCollector { get; init; } = new();
}
public sealed record CpuMetrics
{
public double ProcessUsage { get; init; }
public double SystemUsage { get; init; }
}
public sealed record MemoryMetrics
{
public double WorkingSetMB { get; init; }
public double PrivateMemoryMB { get; init; }
public double VirtualMemoryMB { get; init; }
public double GCMemoryMB { get; init; }
public double SystemMemoryUsageMB { get; init; }
}
public sealed record ThreadingMetrics
{
public int ActiveThreads { get; init; }
public long ThreadPoolPendingWork { get; init; }
}
public sealed record GcMetrics
{
public int Gen0Collections { get; init; }
public int Gen1Collections { get; init; }
public int Gen2Collections { get; init; }
public double TotalMemoryMB { get; init; }
}
///
/// System information response.
///
public sealed record SystemInfoResponse
{
public required string Version { get; init; }
///
/// Informational (SemVer) version of the host process, e.g. "3.7.2" — the same value the
/// startup banner prints, unlike the four-part assembly ("3.7.2.0").
/// Null when the host assembly carries no informational version.
///
public string? InformationalVersion { get; init; }
public required DateTime StartedAt { get; init; }
public required string Uptime { get; init; }
public required int ContextCount { get; init; }
public required int ModuleCount { get; init; }
public required string MachineName { get; init; }
public required int ProcessorCount { get; init; }
public required double WorkingSetMb { get; init; }
/// Module load contexts in memory: the live modules, their rollback history and the orphaned ones.
public int ModuleContextsAlive { get; init; }
///
/// Module load contexts that stay in memory after their modules were replaced or removed: with
/// Tsak:HotReload:Collectible false every one let go, with it true the ones that did not unload.
///
public int OrphanedModuleContexts { get; init; }
/// The limit above which the hotreload health check is Degraded (Tsak:HotReload:MaxOrphanedContexts).
public int MaxOrphanedModuleContexts { get; init; }
/// Null within the limit; above it, what the node needs (a restart to reclaim the memory).
public string? ModuleContextsNotice { get; init; }
}
///
/// One assembly loaded in a node's process, from GET /api/system/assemblies.
/// Source tells where it came from: "shared" (byte-loaded from the shared layer),
/// "bin" (app output), "runtime" (.NET), or "in-memory".
///
public sealed record LoadedAssemblyInfo
{
public required string Name { get; init; }
public string? Version { get; init; }
public required string Source { get; init; }
public required string Location { get; init; }
}
///
/// Response of GET /api/system/assemblies — which assemblies are REALLY running on a
/// node (Admin only). Redb is the interesting subset (redb.* assemblies) surfaced first.
///
public sealed record AssembliesResponse
{
public required int Count { get; init; }
public required int RedbCount { get; init; }
public IReadOnlyList Redb { get; init; } = [];
public IReadOnlyList All { get; init; } = [];
}
///
/// Standard API error response.
///
public sealed record ApiErrorResponse
{
public required string Error { get; init; }
public required string Message { get; init; }
public required int StatusCode { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/UserModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/UserModels.cs
----
namespace redb.Tsak.Contracts;
public sealed record TsakUserInfo
{
public required long Id { get; init; }
public required string Login { get; init; }
public required string Name { get; init; }
public required string Role { get; init; }
public required bool Enabled { get; init; }
public DateTimeOffset? DateRegister { get; init; }
}
public sealed record TsakCreateUserRequest
{
public required string Login { get; init; }
[AuditSensitive] public required string Password { get; init; }
public required string Name { get; init; }
public string Role { get; init; } = "viewer";
}
public sealed record TsakUpdateUserRequest
{
[AuditSensitive] public string? Password { get; init; }
public string? Name { get; init; }
public string? Role { get; init; }
public bool? Enabled { get; init; }
}
public sealed record TsakUserActionResponse
{
public required string Login { get; init; }
public required string Action { get; init; }
public bool Success { get; init; } = true;
}
Path: redb-tsak/src/redb.Tsak.Contracts/WatchdogModels.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/WatchdogModels.cs
----
namespace redb.Tsak.Contracts;
///
/// Snapshot of the Route Watchdog state, returned by the watchdog API.
///
public sealed record WatchdogState
{
public DateTime LastCheckAt { get; init; }
public int SuspectedExchanges { get; init; }
public int HungExchanges { get; init; }
public int AutoRestartsPerformed { get; init; }
public bool Enabled { get; init; }
public IReadOnlyList ActiveAlerts { get; init; } = [];
}
///
/// A single watchdog alert for a suspected or hung exchange.
///
public sealed record WatchdogAlert
{
public required string ExchangeId { get; init; }
public required string RouteId { get; init; }
public required string ContextName { get; init; }
/// "Suspected" or "Hung".
public required string Level { get; init; }
public DateTime DetectedAt { get; init; }
public double ElapsedSeconds { get; init; }
}
/// Alert-delivery status: whether delivery is active and which channels are enabled.
public sealed record AlertDeliveryStatus
{
public required bool Active { get; init; }
public string MinLevel { get; init; } = "";
public IReadOnlyList Channels { get; init; } = [];
}
/// Result of POST /api/watchdog/test-alert: per-channel delivery outcome.
public sealed record AlertTestResult
{
public required bool Delivered { get; init; }
public string? Message { get; init; }
public IReadOnlyList Channels { get; init; } = [];
}
/// Outcome of delivering the test alert to one channel.
public sealed record AlertChannelOutcome
{
public required string Channel { get; init; }
public required bool Success { get; init; }
public string? Error { get; init; }
}
Path: redb-tsak/src/redb.Tsak.Contracts/redb.Tsak.Contracts.csproj
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/redb.Tsak.Contracts.csproj
----
redb.Tsak.Contracts
redb.Tsak.Contracts
Shared DTO models for the redb.Tsak management API. Referenced by Core (server) and Client.
redb;tsak;contracts;dto;api
README.md