Documentation
¶
Overview ¶
Package store provides registries keyed by native handle for the callback registrations of taskers, controllers, and resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TaskerStore = New[TaskerStoreValue]() CtrlStore = New[CtrlStoreValue]() ResStore = New[ResStoreValue]() )
TaskerStore, CtrlStore, and ResStore track the callback registrations of the package's taskers, controllers, and resources.
Functions ¶
This section is empty.
Types ¶
type CtrlStoreValue ¶
type CtrlStoreValue struct {
SinkIDToEventCallbackID map[int64]uint64
CustomControllerCallbacksID uint64
}
CtrlStoreValue records the callback registrations for one controller: the event callbacks backing its sinks, keyed by sink ID, and the shared custom-controller callback registration.
type ResStoreValue ¶
type ResStoreValue struct {
SinkIDToEventCallbackID map[int64]uint64
CustomRecognizersCallbackID map[string]uint64
CustomActionsCallbackID map[string]uint64
}
ResStoreValue records the callback registrations for one resource: the event callbacks backing its sinks, keyed by sink ID, and the custom recognizer and custom action callback registrations, keyed by name.
type Store ¶
type Store[T any] struct { // contains filtered or unexported fields }
Store is a registry of values keyed by native handle.
Set, Get, and Del take no lock: the caller must hold Lock for the duration of any sequence of those calls. Update acquires the lock itself and must not be called while the caller holds Lock.
func (*Store[T]) Del ¶
Del removes the value stored under handle. Deleting an absent handle is a no-op. The caller must hold Lock.
func (*Store[T]) Get ¶
Get returns the value stored under handle, or the zero value of T when handle is absent. The caller must hold Lock.
func (*Store[T]) Lock ¶
func (s *Store[T]) Lock()
Lock locks the store exclusively, guarding the Set, Get, and Del calls made while it is held.
func (*Store[T]) Set ¶
Set stores value under handle, replacing any previous value. The caller must hold Lock.
func (*Store[T]) Unlock ¶
func (s *Store[T]) Unlock()
Unlock releases the store. Every Lock call must be paired with exactly one Unlock.
type TaskerStoreValue ¶
type TaskerStoreValue struct {
SinkIDToEventCallbackID map[int64]uint64
ContextSinkIDToEventCallbackID map[int64]uint64
}
TaskerStoreValue records the callback registrations for one tasker: the event callbacks backing its sinks and the event callbacks backing its context-scoped sinks, each keyed by sink ID.