reloader

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package reloader provides support for live configuration reloading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicHandler

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

AtomicHandler provides an atomic http.Handler implementation, allowing safe handler replacement at runtime. AtomicHandler must be initialized with a call to NewAtomicHandler. It will never panic and is safe for concurrent use.

func NewAtomicHandler

func NewAtomicHandler(h http.Handler) *AtomicHandler

NewAtomicHandler creates a new AtomicHandler ready for use.

func (*AtomicHandler) ServeHTTP

func (ah *AtomicHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the standard libraries http.Handler interface by atomically passing the request along to the most recently stored handler.

func (*AtomicHandler) Store

func (ah *AtomicHandler) Store(h http.Handler)

Store will update this http.Handler to serve future requests using h.

func (*AtomicHandler) String

func (ah *AtomicHandler) String() string

String implements fmt.Stringer by returning a string literal.

type ConfigFunc

type ConfigFunc func(*conf.GlobalConfiguration)

type Reloader

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

func NewReloader

func NewReloader(watchDir string) *Reloader

func (*Reloader) Watch

func (rl *Reloader) Watch(ctx context.Context, fn ConfigFunc) error

Jump to

Keyboard shortcuts

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