Documentation
¶
Index ¶
- func SelectLocked[T comparable, K comparable](r *Registry, members map[uint32]T, instanceKey string, name func(T) K) []T
- type Generation
- type Registry
- func (r *Registry) BindLocked(member any, generation *Generation) error
- func (r *Registry) Broadcast() *broadcast.Broadcast
- func (r *Registry) CanShareNameLocked(member any, candidate *Generation) bool
- func (r *Registry) ForgetLocked(member any)
- func (r *Registry) GenerationLocked(member any) *Generation
- func (r *Registry) InstanceKeyLocked(member any) string
- func (r *Registry) OnChange(changed func())
- func (r *Registry) Register(root srpc.Mux) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectLocked ¶
func SelectLocked[T comparable, K comparable](r *Registry, members map[uint32]T, instanceKey string, name func(T) K) []T
SelectLocked selects visible registrations by semantic name for one logical installation. Scoped definitions override global defaults; the latest ID wins within one priority. Callers hold Broadcast and clone mutable wire results.
Types ¶
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation retains one plugin executable's private or admitted registrations. Its state is protected by the Registry broadcast lock.
func FromContext ¶
func FromContext(ctx context.Context, pluginID string) (*Generation, error)
FromContext returns the private registration scope, or nil for ordinary registrations. A named plugin must match the scope's family.
func (*Generation) Activate ¶
func (g *Generation) Activate(ctx context.Context, req *sdk_registration.ActivateRequest) (*sdk_registration.ActivateResponse, error)
Activate publishes the whole generation in one critical section. Retrying the active generation succeeds; a retired or closed generation cannot supersede it.
func (*Generation) Close ¶
func (g *Generation) Close()
Close hides this generation. During handover, a failed candidate restores the still-retained previous worker; once that worker retires it cannot reappear.
func (*Generation) InvokeMethod ¶
InvokeMethod binds registration calls to this private generation. Other root services are deliberately absent from a registration scope.
func (*Generation) ManifestRoot ¶
func (g *Generation) ManifestRoot() string
ManifestRoot returns the exact implementation registered by this generation.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry owns admission of plugin generations across the Resource registries. Participating registries use Broadcast for their records and visibility reads, so activation and a registry snapshot share one critical section.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry constructs an independent registration admission boundary.
func (*Registry) BindLocked ¶
func (r *Registry) BindLocked(member any, generation *Generation) error
BindLocked associates a comparable registration pointer with its generation. A nil generation is a normal immediately visible registration. The caller holds Broadcast and must forget the member when its Resource is released.
func (*Registry) Broadcast ¶
Broadcast returns the lock shared by generation admission and registry records.
func (*Registry) CanShareNameLocked ¶
func (r *Registry) CanShareNameLocked(member any, candidate *Generation) bool
CanShareNameLocked permits independent installation scopes and private replacement candidates of the same family. It rejects duplicates within one generation and competing families within one scope. The caller holds Broadcast.
func (*Registry) ForgetLocked ¶
ForgetLocked removes a released registration's generation association. The caller holds Broadcast.
func (*Registry) GenerationLocked ¶
func (r *Registry) GenerationLocked(member any) *Generation
GenerationLocked returns a registration's group, or nil for an ungrouped registration. The caller holds Broadcast.
func (*Registry) InstanceKeyLocked ¶
InstanceKeyLocked returns the plugin instance that serves a registration, empty for a global registration. A scoped registration's plugin runs in its installation, so loads of its handler carry this key. The caller holds Broadcast.