package wrapper

import "github.com/hashicorp/nomad/client/serviceregistration/wrapper"

Index

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 serviceregistration.Handler, 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.

Source Files

wrapper.go

Version
v1.10.0 (latest)
Published
Apr 9, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
14 minutes ago

Tools for package owners.