
readpath
Index
Variables
ErrUsageLimitSkip is the sentinel a Probe returns when it declined to attempt a backend purely because its usage limit would be exceeded. Failover counts these separately from genuine failures so the final “all backends declined for usage limits” outcome can be reported as core.ErrUsageLimitExceeded rather than as the last underlying error.
func NoopCleanup
NoopCleanup is the cleanup a Probe returns when there is nothing for the orchestrator to release: error paths where the callback already cancelled its own timeout, and the GET success path where the cancel is attached to the body’s Close.
type Core
Core is the subset of *infra.Core the Failover orchestrator needs: backend registry + lookup, and the accounting Recorder that owns the per-backend usage / per-operation metric semantics.
type Failover
Failover orchestrates per-key read failover across backends. One instance per object.Manager; safe for concurrent reads.
func New
New constructs a Failover. When degradedReadsEnabled is false, a DB outage surfaces as ErrServiceUnavailable instead of broadcasting.
func (*Failover) Read
Read runs the full read-with-failover protocol: starts the span, resolves all locations for the key, and tries each backend in turn. On core.ErrDBUnavailable falls back to broadcastRead. Returns the winning backend name and any error.
type LocationCache
LocationCache is the subset of the object-package location cache the orchestrator needs to remember and reuse degraded-mode winners. Declared as an interface here (not *object.LocationCache) to avoid the import cycle that would otherwise form (object imports readpath for Failover).
type Probe
Probe is the per-backend callback the caller provides. loc carries the matching ObjectLocation row so callbacks that need encryption metadata can read it directly without a side-channel lookup; loc is nil in degraded-mode broadcasts where the DB is unreachable. beName is always populated (loc.BackendName during failover, or the degraded-mode caller’s chosen name) so callbacks have a single source for span / usage attribution.
The callback owns its own timeout context and is responsible for releasing it on the error path. On success it returns a cleanup func the orchestrator invokes once the winner is declared; that cleanup either releases the timeout immediately (HEAD - no streaming body) or is a no-op because the callback already attached the cancel to the result body’s Close (GET).
Generated by gomarkdoc