callback

package
v0.46.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackController

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

CallbackController wraps a ExecuteFunc and/or HandlerFunc into a controller. This is a utility to quickly build controllers.

func NewCallbackController

func NewCallbackController(info *controller.Info, execute ExecuteFunc, handleDir directive.HandlerFunc, closeFn CloseFunc) *CallbackController

NewCallbackController constructs a new CallbackController.

func (*CallbackController) Close

func (c *CallbackController) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*CallbackController) Execute

func (c *CallbackController) Execute(ctx context.Context) error

Execute executes the controller goroutine. Returning nil ends execution. Returning an error triggers a retry with backoff.

func (*CallbackController) GetControllerID

func (c *CallbackController) GetControllerID() string

GetControllerID returns the controller ID.

func (*CallbackController) GetControllerInfo

func (c *CallbackController) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*CallbackController) HandleDirective

func (c *CallbackController) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.

type CloseFunc

type CloseFunc = func() error

CloseFunc is the type for the close function.

type ExecuteFunc

type ExecuteFunc = func(ctx context.Context) error

ExecuteFunc is the type for the execute function.

Jump to

Keyboard shortcuts

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