Documentation
¶
Overview ¶
Package resource provides ShiftLock's resource fabric foundation: typed resource identities, capability declarations, a Runtime-owned registry, dependency graphs, bundles, health, and monotonic resource epochs.
Adapters live in subpackages (e.g. resource/memory). Optional heavy backends must stay isolated from core — this package uses the Go standard library only.
Capability honesty: never claim Supports* flags a concrete resource cannot honor. Lockdown, when wired by Runtime, blocks protected mutations.
Index ¶
- Constants
- Variables
- func AdvanceEpoch(e ResourceEpoch, reason string) (ResourceEpoch, EpochAdvance, error)
- func EnsureNotDecreased(current, proposed ResourceEpoch) error
- func RegisterCustomKind(k Kind) error
- func ReleaseAll(ctx context.Context, h LeaseHandle, release ReleaseFunc) error
- func SanitizeSnapshotFields(in map[string]string) map[string]string
- func ValidKind(k Kind) bool
- type AcquireFunc
- type Bundle
- type BundleMode
- type DependencyGraph
- func (g *DependencyGraph) Clone() *DependencyGraph
- func (g *DependencyGraph) Define(from, to string) error
- func (g *DependencyGraph) DependenciesOf(from string) []string
- func (g *DependencyGraph) MissingDependencies(from string, entries map[string]*Entry) []string
- func (g *DependencyGraph) StartupOrder(known []string) ([]string, error)
- type Description
- type DimensionHealth
- type DriftAction
- type DriftDetector
- type DriftReport
- type Entry
- type EpochAdvance
- type Error
- type Evidence
- type HealthDimension
- type HealthStatus
- type Kind
- type Lease
- type LeaseHandle
- type LeaseManager
- func (m *LeaseManager) AcquireAll(ctx context.Context, reqs map[string]LeaseRequest) (LeaseHandle, error)
- func (m *LeaseManager) Held(id ResourceID) []Lease
- func (m *LeaseManager) Lease(ctx context.Context, id ResourceID, req LeaseRequest) (Lease, error)
- func (m *LeaseManager) Release(id ResourceID, owner string, mode LeaseMode) error
- func (m *LeaseManager) ReleaseHandle(h LeaseHandle)
- func (m *LeaseManager) SetClock(c func() time.Time)
- type LeaseMode
- type LeaseRequest
- type LockdownChecker
- type Metadata
- type Metrics
- type MetricsSnapshot
- type MutableResource
- type Readiness
- type Registry
- func (r *Registry) Advance(id ResourceID, reason string) (EpochAdvance, error)
- func (r *Registry) BlockedExplanation(ctx context.Context, id ResourceID) string
- func (r *Registry) Close()
- func (r *Registry) Count() int
- func (r *Registry) DefineDependency(from, to ResourceID) error
- func (r *Registry) Dependencies() *DependencyGraph
- func (r *Registry) Get(id ResourceID) (*Entry, error)
- func (r *Registry) List() []*Entry
- func (r *Registry) MaxResources() int
- func (r *Registry) Metrics() MetricsSnapshot
- func (r *Registry) Register(res Resource, meta Metadata) (*Entry, error)
- func (r *Registry) Remove(id ResourceID) error
- func (r *Registry) SetLockdown(c LockdownChecker)
- func (r *Registry) ShutdownOrder() ([]ResourceID, error)
- func (r *Registry) StartupOrder() ([]ResourceID, error)
- type RegistryConfig
- type ReleaseFunc
- type Resource
- type ResourceCapabilities
- type ResourceEpoch
- type ResourceHealth
- type ResourceID
- type ResourceSnapshot
- type Severity
- type SnapshotProvider
Constants ¶
const ( MaxEvidenceAttrs = 32 MaxEvidenceAttrKey = 64 MaxEvidenceAttrValue = 512 MaxEvidenceSummary = 1024 MaxEvidenceBlobBytes = 4096 )
Evidence size limits keep audit/checkpoint payloads bounded.
const DefaultMaxResources = 1024
DefaultMaxResources is the default registry cardinality bound.
Variables ¶
var ( ErrInvalidID = errors.New("resource: invalid id") ErrUnknownKind = errors.New("resource: unknown kind") ErrDuplicate = errors.New("resource: duplicate registration") ErrNotFound = errors.New("resource: not found") ErrBoundExceeded = errors.New("resource: bound exceeded") ErrCycle = errors.New("resource: dependency cycle") ErrCapabilityClaimed = errors.New("resource: capability not supported") ErrEpochOverflow = errors.New("resource: epoch overflow") ErrEpochDecreased = errors.New("resource: epoch must not decrease") ErrLockdown = errors.New("resource: lockdown blocks mutation") ErrClosed = errors.New("resource: registry closed") ErrBundleNotReady = errors.New("resource: bundle not ready") ErrDependencyBlocked = errors.New("resource: dependency blocked") ErrPartialAcquire = errors.New("resource: partial acquire released") ErrEvidenceTooLarge = errors.New("resource: evidence exceeds size limit") ErrInvalidArgument = errors.New("resource: invalid argument") )
Sentinel errors for stable matching via errors.Is.
var ( ErrLeaseHeld = errors.New("resource: lease held") ErrLeaseNotHeld = errors.New("resource: lease not held") ErrLeaseMode = errors.New("resource: incompatible lease mode") ErrFenceRequired = errors.New("resource: fencing token required") ErrStaleFence = errors.New("resource: stale fencing token") )
Lease mode / conflict sentinels.
Functions ¶
func AdvanceEpoch ¶
func AdvanceEpoch(e ResourceEpoch, reason string) (ResourceEpoch, EpochAdvance, error)
AdvanceEpoch increments e when reason is non-empty.
func EnsureNotDecreased ¶
func EnsureNotDecreased(current, proposed ResourceEpoch) error
EnsureNotDecreased returns ErrEpochDecreased if proposed < current.
func RegisterCustomKind ¶
RegisterCustomKind registers an additional kind name (not a global resource registry — only kind vocabulary). Empty or slash-containing names are rejected. Built-in kinds cannot be re-registered.
func ReleaseAll ¶
func ReleaseAll(ctx context.Context, h LeaseHandle, release ReleaseFunc) error
ReleaseAll releases held resources in reverse acquisition order.
func SanitizeSnapshotFields ¶
SanitizeSnapshotFields drops secret-like keys and truncates values.
Types ¶
type AcquireFunc ¶
type AcquireFunc func(ctx context.Context, id ResourceID) error
AcquireFunc attempts to acquire a single resource lease/ownership. Adapters that do not support ownership should return ErrCapabilityClaimed.
type Bundle ¶
type Bundle struct {
Name string `json:"name"`
Mode BundleMode `json:"mode"`
IDs []ResourceID `json:"ids"`
MinRequired int `json:"min_required,omitempty"`
Primary ResourceID `json:"primary,omitempty"`
Fallbacks []ResourceID `json:"fallbacks,omitempty"`
}
Bundle groups resource IDs for activation checks.
func NewBundle ¶
func NewBundle(name string, ids ...ResourceID) Bundle
Bundle constructs a named bundle with the given IDs (default all-required).
func (Bundle) EvaluateReadiness ¶
EvaluateReadiness checks the bundle against the registry.
func (Bundle) WithMinRequired ¶
WithMinRequired sets minimum for BundleMinimumRequired.
func (Bundle) WithMode ¶
func (b Bundle) WithMode(m BundleMode) Bundle
WithMode sets the evaluation mode.
func (Bundle) WithPrimaryFallbacks ¶
func (b Bundle) WithPrimaryFallbacks(primary ResourceID, fallbacks ...ResourceID) Bundle
WithPrimaryFallbacks configures primary-with-fallbacks mode.
type BundleMode ¶
type BundleMode string
BundleMode selects how a bundle evaluates activation readiness.
const ( // BundleAllRequired — every member must be registered and healthy. BundleAllRequired BundleMode = "all-required" // BundleMinimumRequired — at least MinRequired members ready. BundleMinimumRequired BundleMode = "minimum-required" // BundleOptionalDependencies — listed members are optional; Ready if any/none ok. BundleOptionalDependencies BundleMode = "optional-dependencies" // BundlePrimaryWithFallbacks — Primary must be ready, or any Fallback. BundlePrimaryWithFallbacks BundleMode = "primary-with-fallbacks" // BundleOrdered — members must be ready in listed order (prefix readiness). BundleOrdered BundleMode = "ordered" )
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph stores directed edges from → to meaning "from depends on to".
func NewDependencyGraph ¶
func NewDependencyGraph() *DependencyGraph
NewDependencyGraph creates an empty graph.
func (*DependencyGraph) Clone ¶
func (g *DependencyGraph) Clone() *DependencyGraph
Clone returns a deep copy.
func (*DependencyGraph) Define ¶
func (g *DependencyGraph) Define(from, to string) error
Define adds an edge; detects cycles involving the new edge.
func (*DependencyGraph) DependenciesOf ¶
func (g *DependencyGraph) DependenciesOf(from string) []string
DependenciesOf returns sorted dependency keys for from.
func (*DependencyGraph) MissingDependencies ¶
func (g *DependencyGraph) MissingDependencies(from string, entries map[string]*Entry) []string
MissingDependencies returns dependency keys that are absent or unhealthy.
func (*DependencyGraph) StartupOrder ¶
func (g *DependencyGraph) StartupOrder(known []string) ([]string, error)
StartupOrder returns a deterministic topological order over nodes. Dependencies appear before dependents. Nodes with no edges are included from known (sorted lexicographically for stability).
type Description ¶
type Description struct {
DisplayName string `json:"display_name,omitempty"`
Summary string `json:"summary,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Owner string `json:"owner,omitempty"`
}
Description is static metadata returned by Resource.Describe.
type DimensionHealth ¶
type DimensionHealth struct {
Status HealthStatus `json:"status"`
Message string `json:"message,omitempty"`
}
DimensionHealth is one dimension's status.
type DriftAction ¶
type DriftAction string
DriftAction is a recommended response to drift.
const ( DriftActionReport DriftAction = "report" DriftActionBlock DriftAction = "block" DriftActionDegrade DriftAction = "degrade" DriftActionQuarantine DriftAction = "quarantine" DriftActionReconcile DriftAction = "reconcile" DriftActionLockdown DriftAction = "lockdown" )
type DriftDetector ¶
type DriftDetector struct {
DefaultAction DriftAction
}
DriftDetector compares desired maps to observed snapshots.
func (DriftDetector) Compare ¶
func (d DriftDetector) Compare(id ResourceID, expected, observed map[string]string) []DriftReport
Compare builds drift reports for keys that differ. Values must be sanitized (no secrets). Automatic reconciliation is opt-in elsewhere.
type DriftReport ¶
type DriftReport struct {
Resource ResourceID `json:"resource"`
Severity Severity `json:"severity"`
Expected any `json:"expected"`
Observed any `json:"observed"`
Evidence []Evidence `json:"evidence,omitempty"`
DetectedAt time.Time `json:"detected_at"`
Action DriftAction `json:"action,omitempty"`
Field string `json:"field,omitempty"`
}
DriftReport compares expected vs observed resource state.
type Entry ¶
type Entry struct {
Resource Resource
Meta Metadata
Epoch ResourceEpoch
RegisteredAt time.Time
}
Entry is a registry record wrapping a Resource with metadata and epoch.
type EpochAdvance ¶
type EpochAdvance struct {
From ResourceEpoch `json:"from"`
To ResourceEpoch `json:"to"`
Reason string `json:"reason"`
}
EpochAdvance records why an epoch advanced.
type Error ¶
type Error struct {
Op string
ID ResourceID
Err error
Message string
}
Error is a typed resource error with optional context.
type Evidence ¶
type Evidence struct {
Time time.Time `json:"time"`
Event string `json:"event"`
ActorID string `json:"actor_id,omitempty"`
Resource string `json:"resource,omitempty"`
Summary string `json:"summary,omitempty"`
Attrs map[string]string `json:"attrs,omitempty"`
BlobBytes int `json:"blob_bytes,omitempty"` // size of omitted blob; blob itself not stored here
}
Evidence is a sanitized, size-bounded record of an observation or mutation. It intentionally mirrors control/lockdown Evidence shape (time/event/attrs) while adding resource-fabric fields. Secrets must never be placed in Attrs.
func SanitizeEvidence ¶
SanitizeEvidence truncates/drops oversized fields. Returns ErrEvidenceTooLarge only when Attrs count exceeds MaxEvidenceAttrs after truncation is impossible.
type HealthDimension ¶
type HealthDimension string
HealthDimension names a measurable facet of resource health.
const ( DimConnectivity HealthDimension = "connectivity" DimLatency HealthDimension = "latency" DimCapacity HealthDimension = "capacity" DimAuthn HealthDimension = "authn" DimAuthz HealthDimension = "authz" DimConsistency HealthDimension = "consistency" DimReplication HealthDimension = "replication" DimDurability HealthDimension = "durability" DimAvailability HealthDimension = "availability" DimConfiguration HealthDimension = "configuration" DimSecurity HealthDimension = "security" )
func AllHealthDimensions ¶
func AllHealthDimensions() []HealthDimension
AllHealthDimensions lists the standard dimensions.
type HealthStatus ¶
type HealthStatus string
HealthStatus is a per-dimension or overall health signal.
const ( HealthUnknown HealthStatus = "unknown" HealthHealthy HealthStatus = "healthy" HealthDegraded HealthStatus = "degraded" HealthUnhealthy HealthStatus = "unhealthy" HealthBlocked HealthStatus = "blocked" )
type Kind ¶
type Kind string
Kind classifies a resource in the fabric.
const ( KindDatabase Kind = "database" KindQueue Kind = "queue" KindStream Kind = "stream" KindCache Kind = "cache" KindFilesystem Kind = "filesystem" KindObjectStore Kind = "object-store" KindHTTPService Kind = "http-service" KindGRPCService Kind = "grpc-service" KindWorker Kind = "worker" KindScheduler Kind = "scheduler" KindDeployment Kind = "deployment" KindConfiguration Kind = "configuration" KindSecretReference Kind = "secret-reference" KindRateLimit Kind = "rate-limit" KindFeature Kind = "feature" KindCustom Kind = "custom" )
func KnownKinds ¶
func KnownKinds() []Kind
KnownKinds returns built-in plus registered custom kinds (unsorted).
type Lease ¶
type Lease struct {
ID ResourceID
Mode LeaseMode
Owner string
Purpose string
Fence uint64
Epoch ResourceEpoch
ExpiresAt time.Time
AcquiredAt time.Time
}
Lease is a held resource lease.
type LeaseHandle ¶
type LeaseHandle struct {
IDs []ResourceID
Leases []Lease
}
LeaseHandle holds the result of a multi-resource acquire. IDs are in canonical acquisition order. Leases is populated by LeaseManager.AcquireAll.
func AcquireAll ¶
func AcquireAll(ctx context.Context, ids []ResourceID, acquire AcquireFunc, release ReleaseFunc) (LeaseHandle, error)
AcquireAll acquires resources in canonical lexicographic ID order. On any failure it releases the partial set in reverse order and returns ErrPartialAcquire (wrapping the underlying error when present).
Prefer LeaseManager.AcquireAll when using lease modes and fencing tokens.
type LeaseManager ¶
type LeaseManager struct {
// contains filtered or unexported fields
}
LeaseManager tracks in-process leases for registered resources. Distributed lease enforcement remains adapter/backend-specific; this manager coordinates multi-resource acquisition ordering and fencing checks.
func NewLeaseManager ¶
func NewLeaseManager(reg *Registry) *LeaseManager
NewLeaseManager binds to a registry.
func (*LeaseManager) AcquireAll ¶
func (m *LeaseManager) AcquireAll(ctx context.Context, reqs map[string]LeaseRequest) (LeaseHandle, error)
AcquireAll leases multiple resources in canonical order. On failure, releases the partial set. Fencing tokens are taken from reqs[id].
func (*LeaseManager) Held ¶
func (m *LeaseManager) Held(id ResourceID) []Lease
Held returns a copy of active leases for id.
func (*LeaseManager) Lease ¶
func (m *LeaseManager) Lease(ctx context.Context, id ResourceID, req LeaseRequest) (Lease, error)
Lease acquires a single resource lease.
func (*LeaseManager) Release ¶
func (m *LeaseManager) Release(id ResourceID, owner string, mode LeaseMode) error
Release drops a matching lease for owner+mode.
func (*LeaseManager) ReleaseHandle ¶
func (m *LeaseManager) ReleaseHandle(h LeaseHandle)
ReleaseHandle releases all leases in a handle.
func (*LeaseManager) SetClock ¶
func (m *LeaseManager) SetClock(c func() time.Time)
SetClock overrides the clock (tests).
type LeaseRequest ¶
type LeaseRequest struct {
Purpose string
Mode LeaseMode
Owner string
TTL time.Duration
// Fence is required when the resource SupportsFencing and Mode is exclusive/maintenance/migration.
Fence uint64
}
LeaseRequest asks for a resource lease.
type LockdownChecker ¶
type LockdownChecker interface {
// BlocksMutations reports whether protected resource mutations must stop.
BlocksMutations() bool
}
LockdownChecker is a soft dependency so resource never imports control/lockdown.
type Metadata ¶
type Metadata struct {
Labels map[string]string `json:"labels,omitempty"`
Tags []string `json:"tags,omitempty"`
Notes string `json:"notes,omitempty"`
Source string `json:"source,omitempty"`
}
Metadata is operator-facing registry metadata (not secrets).
type Metrics ¶
type Metrics struct {
Registered atomic.Uint64
Removed atomic.Uint64
Duplicates atomic.Uint64
BoundRejects atomic.Uint64
EpochAdvances atomic.Uint64
LockdownBlocks atomic.Uint64
}
Metrics are cheap atomic counters for operators.
type MetricsSnapshot ¶
type MetricsSnapshot struct {
Registered uint64 `json:"registered"`
Removed uint64 `json:"removed"`
Duplicates uint64 `json:"duplicates"`
BoundRejects uint64 `json:"bound_rejects"`
EpochAdvances uint64 `json:"epoch_advances"`
LockdownBlocks uint64 `json:"lockdown_blocks"`
Count int `json:"count"`
}
Snapshot is a point-in-time metrics view.
type MutableResource ¶
type MutableResource interface {
Resource
// Mutate performs a named mutation. Implementations must refuse when
// fencing/epoch checks fail. Returns evidence of the attempt.
Mutate(ctx context.Context, op string, attrs map[string]string) (Evidence, error)
}
MutableResource is an optional extension for adapters that accept mutations. Workflow mutation steps and registry ops consult lockdown before calling Mutate.
type Readiness ¶
type Readiness struct {
Name string `json:"name"`
Ready bool `json:"ready"`
Mode BundleMode `json:"mode"`
ReadyIDs []string `json:"ready_ids,omitempty"`
MissingIDs []string `json:"missing_ids,omitempty"`
BlockedIDs []string `json:"blocked_ids,omitempty"`
Message string `json:"message,omitempty"`
}
Readiness is the activation report for a bundle.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is owned by Runtime — never a process-global singleton.
func NewRegistry ¶
func NewRegistry(cfg RegistryConfig) *Registry
NewRegistry constructs an empty registry.
func (*Registry) Advance ¶
func (r *Registry) Advance(id ResourceID, reason string) (EpochAdvance, error)
Advance advances the resource epoch with a required reason.
func (*Registry) BlockedExplanation ¶
func (r *Registry) BlockedExplanation(ctx context.Context, id ResourceID) string
BlockedExplanation explains why id cannot activate (missing deps / unhealthy).
func (*Registry) DefineDependency ¶
func (r *Registry) DefineDependency(from, to ResourceID) error
DefineDependency records that from depends on to (from → to).
func (*Registry) Dependencies ¶
func (r *Registry) Dependencies() *DependencyGraph
Dependencies returns the dependency graph (copy-safe view).
func (*Registry) Get ¶
func (r *Registry) Get(id ResourceID) (*Entry, error)
Get returns a cloned entry.
func (*Registry) MaxResources ¶
MaxResources returns the configured bound.
func (*Registry) Metrics ¶
func (r *Registry) Metrics() MetricsSnapshot
Metrics returns a snapshot including current cardinality.
func (*Registry) Remove ¶
func (r *Registry) Remove(id ResourceID) error
Remove deletes a resource and its dependency edges.
func (*Registry) SetLockdown ¶
func (r *Registry) SetLockdown(c LockdownChecker)
SetLockdown updates the lockdown checker (Runtime wiring).
func (*Registry) ShutdownOrder ¶
func (r *Registry) ShutdownOrder() ([]ResourceID, error)
ShutdownOrder is the reverse of StartupOrder.
func (*Registry) StartupOrder ¶
func (r *Registry) StartupOrder() ([]ResourceID, error)
StartupOrder returns a deterministic topological order for activation.
type RegistryConfig ¶
type RegistryConfig struct {
MaxResources int
Clock func() time.Time
Lockdown LockdownChecker
}
RegistryConfig configures a Runtime-owned resource registry.
type ReleaseFunc ¶
type ReleaseFunc func(ctx context.Context, id ResourceID) error
ReleaseFunc releases a previously acquired resource.
type Resource ¶
type Resource interface {
ID() ResourceID
Kind() Kind
Describe() Description
Health(ctx context.Context) ResourceHealth
Capabilities() ResourceCapabilities
}
Resource is the fabric adapter contract.
type ResourceCapabilities ¶
type ResourceCapabilities struct {
SupportsOwnership bool `json:"supports_ownership"`
SupportsFencing bool `json:"supports_fencing"`
SupportsDrain bool `json:"supports_drain"`
SupportsHealth bool `json:"supports_health"`
SupportsFailover bool `json:"supports_failover"`
SupportsTransactions bool `json:"supports_transactions"`
SupportsSnapshots bool `json:"supports_snapshots"`
SupportsRecovery bool `json:"supports_recovery"`
SupportsRateLimit bool `json:"supports_rate_limit"`
}
ResourceCapabilities declares what a resource adapter actually supports. Callers and workflows must not assume a capability unless the corresponding flag is true. Adapters must never silently claim unsupported capabilities.
func (ResourceCapabilities) Require ¶
func (c ResourceCapabilities) Require(required ResourceCapabilities) error
Require returns ErrCapabilityClaimed if any required flag is false on c.
type ResourceEpoch ¶
type ResourceEpoch uint64
ResourceEpoch is a monotonic generation for a registered resource. It must never decrease or wrap silently; overflow is a terminal error.
const MaxResourceEpoch ResourceEpoch = ResourceEpoch(^uint64(0) - 1)
MaxResourceEpoch is the last valid epoch before terminal overflow.
func (ResourceEpoch) Next ¶
func (e ResourceEpoch) Next() (ResourceEpoch, error)
Next returns epoch+1 or ErrEpochOverflow.
type ResourceHealth ¶
type ResourceHealth struct {
Overall HealthStatus `json:"overall"`
CheckedAt time.Time `json:"checked_at"`
Message string `json:"message,omitempty"`
Dimensions map[HealthDimension]DimensionHealth `json:"dimensions,omitempty"`
}
ResourceHealth aggregates dimensions into an overall status.
func HealthyReport ¶
func HealthyReport(msg string) ResourceHealth
HealthyReport is a convenience constructor.
func (*ResourceHealth) ComputeOverall ¶
func (h *ResourceHealth) ComputeOverall()
ComputeOverall sets Overall from the worst dimension (unknown if empty).
type ResourceID ¶
type ResourceID struct {
Kind Kind `json:"kind"`
Environment string `json:"environment"`
Service string `json:"service"`
Name string `json:"name"`
}
ResourceID uniquely names a resource in the fabric. Canonical string form: kind/environment/service/name Example: database/production/payments-api/orders
func MustParseResourceID ¶
func MustParseResourceID(s string) ResourceID
MustParseResourceID panics on parse failure (tests/fixtures only).
func ParseResourceID ¶
func ParseResourceID(s string) (ResourceID, error)
ParseResourceID parses kind/environment/service/name.
func (ResourceID) Equal ¶
func (id ResourceID) Equal(o ResourceID) bool
Equal reports structural equality.
func (ResourceID) IsZero ¶
func (id ResourceID) IsZero() bool
IsZero reports whether all fields are empty.
func (ResourceID) String ¶
func (id ResourceID) String() string
String returns the canonical slash-separated form.
func (ResourceID) Validate ¶
func (id ResourceID) Validate() error
Validate checks segment rules without requiring the kind to be registered.
type ResourceSnapshot ¶
type ResourceSnapshot struct {
ID ResourceID `json:"id"`
Epoch ResourceEpoch `json:"epoch"`
Health HealthStatus `json:"health,omitempty"`
CapturedAt time.Time `json:"captured_at"`
Fields map[string]string `json:"fields,omitempty"`
}
ResourceSnapshot is a sanitized point-in-time view.
func CaptureSnapshot ¶
func CaptureSnapshot(ctx context.Context, ent *Entry) (ResourceSnapshot, error)
CaptureSnapshot builds a sanitized snapshot from a registry entry.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache provides shared helpers for cache resource adapters.
|
Package cache provides shared helpers for cache resource adapters. |
|
memory
Package memory provides an in-process cache resource for tests and demos.
|
Package memory provides an in-process cache resource for tests and demos. |
|
redis
Package redis is a thin cache resource adapter.
|
Package redis is a thin cache resource adapter. |
|
database
|
|
|
postgres
Package postgres is a thin database resource adapter.
|
Package postgres is a thin database resource adapter. |
|
Package memory provides in-process resource adapters for tests and local-first demos.
|
Package memory provides in-process resource adapters for tests and local-first demos. |
|
Package queue provides a generic queue resource plus an in-memory adapter for demos and tests.
|
Package queue provides a generic queue resource plus an in-memory adapter for demos and tests. |
|
Package ratelimit provides rate-limit resources (token bucket and concurrency).
|
Package ratelimit provides rate-limit resources (token bucket and concurrency). |
|
service
|
|
|
http
Package httpresource provides HTTP service resource guardrails.
|
Package httpresource provides HTTP service resource guardrails. |
|
storage
|
|
|
filesystem
Package filesystem provides a hardened directory resource adapter.
|
Package filesystem provides a hardened directory resource adapter. |
|
object
Package object defines an object-storage resource abstraction.
|
Package object defines an object-storage resource abstraction. |