Documentation ¶
Index ¶
- type DirectiveController
- func (c *DirectiveController) AddDirective(dir directive.Directive, cb directive.ReferenceHandler) (directive.Instance, directive.Reference, error)
- func (c *DirectiveController) AddHandler(hnd directive.Handler) error
- func (c *DirectiveController) Close()
- func (c *DirectiveController) GetDirectives() []directive.Instance
- func (c *DirectiveController) RemoveHandler(hnd directive.Handler)
- type DirectiveInstance
- func (r *DirectiveInstance) AddDisposeCallback(cb func()) func()
- func (r *DirectiveInstance) AddIdleCallback(cb directive.IdleCallback) func()
- func (r *DirectiveInstance) AddReference(cb directive.ReferenceHandler, weakRef bool) directive.Reference
- func (r *DirectiveInstance) Close()
- func (r *DirectiveInstance) GetDirective() directive.Directive
- func (r *DirectiveInstance) GetResolverErrors() []error
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 ¶
func (c *DirectiveController) AddDirective( dir directive.Directive, cb directive.ReferenceHandler, ) (directive.Instance, directive.Reference, error)
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.