controller

package
v0.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectiveController

type DirectiveController struct {
	// contains filtered or unexported fields
}

DirectiveController is the directive controller.

func NewDirectiveController

func NewDirectiveController(ctx context.Context, le *logrus.Entry) *DirectiveController

NewDirectiveController builds a new directive controller.

func (*DirectiveController) AddDirective

AddDirective adds a directive to the controller. This call de-duplicates equivalent directives. Returns the instance, new reference, and any error.

func (*DirectiveController) AddHandler

func (c *DirectiveController) AddHandler(hnd directive.Handler) error

AddHandler adds a directive handler. The handler will receive calls for all existing directives (initial set).

func (*DirectiveController) Close

func (c *DirectiveController) Close()

Close closes the directive instance.

func (*DirectiveController) GetDirectives

func (c *DirectiveController) GetDirectives() []directive.Instance

GetDirectives returns a list of all currently active directives.

func (*DirectiveController) RemoveHandler

func (c *DirectiveController) RemoveHandler(hnd directive.Handler)

RemoveHandler removes a directive handler.

type DirectiveInstance

type DirectiveInstance struct {
	// contains filtered or unexported fields
}

DirectiveInstance implements the directive instance interface.

func NewDirectiveInstance

func NewDirectiveInstance(
	ctx context.Context,
	le *logrus.Entry,
	dir directive.Directive,
	cb directive.ReferenceHandler,
	released func(di *DirectiveInstance),
) (*DirectiveInstance, directive.Reference)

NewDirectiveInstance constructs a new directive instance with an initial reference.

func (*DirectiveInstance) AddDisposeCallback

func (r *DirectiveInstance) AddDisposeCallback(cb func()) func()

AddDisposeCallback adds a callback that will be called when the instance is disposed, either when Close() is called, or when the reference count drops to zero. The callback may occur immediately if the instance is already disposed, but will be made in a new goroutine. Returns a callback release function.

func (*DirectiveInstance) AddIdleCallback

func (r *DirectiveInstance) AddIdleCallback(cb directive.IdleCallback) func()

AddIdleCallback adds a callback that will be called when idle. The callback is called exactly once. Errs is the list of non-nil resolver errors. Returns a callback release function.

func (*DirectiveInstance) AddReference

func (r *DirectiveInstance) AddReference(
	cb directive.ReferenceHandler,
	weakRef bool,
) directive.Reference

AddReference adds a reference to the directive. Will return nil if the directive is already expired. Weak references do not contribute to the reference count.

func (*DirectiveInstance) Close

func (r *DirectiveInstance) Close()

Close cancels the directive instance.

func (*DirectiveInstance) GetDirective

func (r *DirectiveInstance) GetDirective() directive.Directive

GetDirective returns the underlying directive.

func (*DirectiveInstance) GetResolverErrors added in v0.8.7

func (r *DirectiveInstance) GetResolverErrors() []error

GetResolverErrors returns a snapshot of any errors returned by resolvers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL