Documentation
¶
Overview ¶
Package cache provides shared helpers for cache resource adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type EpochAdvancer ¶
type EpochAdvancer interface {
Advance(id resource.ResourceID, reason string) (resource.EpochAdvance, error)
}
EpochAdvancer optionally advances a registry epoch after activation.
type FlowOptions ¶
type FlowOptions struct {
ResourceID resource.ResourceID
Build BuildFunc
Verify VerifyFunc
Retire RetireFunc
Epochs EpochAdvancer
DryRun bool
}
FlowOptions configures a generation rebuild flow.
type FlowResult ¶
type FlowResult struct {
Previous uint64 `json:"previous"`
Reserved uint64 `json:"reserved"`
Activated uint64 `json:"activated,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Epoch resource.EpochAdvance `json:"epoch,omitempty"`
Retired bool `json:"retired,omitempty"`
}
FlowResult is a sanitized outcome (no cache values).
func RunGenerationFlow ¶
func RunGenerationFlow(ctx context.Context, ctrl GenerationController, opts FlowOptions) (FlowResult, error)
RunGenerationFlow executes reserve → build → verify → activate → epoch → retire. On any failure after reserve, AbortGeneration is called.
type GenerationController ¶
type GenerationController interface {
BuildGeneration(ctx context.Context) (uint64, error)
ActivateGeneration(gen uint64, seed map[string]string) error
AbortGeneration()
Generation() uint64
}
GenerationController is implemented by memory (and similar) cache adapters.
type RetireFunc ¶
RetireFunc cleans up prior generation artifacts after activation.
Click to show internal directories.
Click to hide internal directories.