wrapper

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MPL-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerWrapper

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

HandlerWrapper is used to wrap service registration implementations of the Handler interface. We do not use a map or similar to store the handlers, so we can avoid having to use a lock. This may need to be updated if we ever support additional registration providers.

func NewHandlerWrapper

func NewHandlerWrapper(
	log hclog.Logger, consulProvider, nomadProvider serviceregistration.Handler) *HandlerWrapper

NewHandlerWrapper configures and returns a HandlerWrapper for use within client hooks that need to interact with service and check registrations. It mimics the serviceregistration.Handler interface, but returns the implementation to allow future flexibility and is initially only intended for use with the alloc and task runner service hooks.

func (*HandlerWrapper) RegisterWorkload

func (h *HandlerWrapper) RegisterWorkload(workload *serviceregistration.WorkloadServices) error

RegisterWorkload wraps the serviceregistration.Handler RegisterWorkload function. It determines which backend provider to call and passes the workload unless the provider is unknown, in which case an error will be returned.

func (*HandlerWrapper) RemoveWorkload

func (h *HandlerWrapper) RemoveWorkload(services *serviceregistration.WorkloadServices)

RemoveWorkload wraps the serviceregistration.Handler RemoveWorkload function. It determines which backend provider to call and passes the workload unless the provider is unknown.

func (*HandlerWrapper) UpdateWorkload

func (h *HandlerWrapper) UpdateWorkload(old, new *serviceregistration.WorkloadServices) error

UpdateWorkload identifies which provider to call for the new and old workloads provided. In the event both use the same provider, the UpdateWorkload function will be called, otherwise the register and remove functions will be called.

Jump to

Keyboard shortcuts

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