Documentation
¶
Index ¶
- func GetTimeout() time.Duration
- func Remove(id ID)
- func Reset()
- func RunAfter(reg *Registry, key string, value []byte, committed bool, writeErr error)
- func RunBefore(reg *Registry, key string, value []byte) ([]byte, error)
- func SetTimeout(d time.Duration)
- type Abort
- type ID
- type Observer
- type ObserverAfter
- type Registry
- type Transform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTimeout ¶
GetTimeout returns the current per-hook execution timeout.
func Remove ¶
func Remove(id ID)
Remove unregisters the hook with the given id. Unknown or zero ids are ignored. When the last hook is removed the registry snapshot becomes nil again so the no-hook path stays zero-cost.
func RunBefore ¶
RunBefore runs Abort, Transform, and Observer hooks (in that order) against the incoming value and returns the final transformed value.
func SetTimeout ¶
SetTimeout sets the per-hook execution timeout. Values <= 0 disable timeouts (hooks then run with panic recovery only).
Types ¶
type ID ¶
type ID uint64
ID uniquely identifies a registered hook. The zero value is never assigned.
func AddObserver ¶
func AddObserverAfter ¶
func AddObserverAfter(h ObserverAfter) ID
func AddTransform ¶
type ObserverAfter ¶
ObserverAfter inspects the write outcome after commit (fail-open).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is an immutable snapshot of all registered hooks.
func Snapshot ¶
func Snapshot() *Registry
Snapshot returns the current hook registry, or nil when no hooks are registered, keeping the no-hook path zero-cost.