hotconf

package
v0.0.0-...-2aa8555 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PathPrefix = "/hotconf/"

Variables

This section is empty.

Functions

func Handle

func Handle(key string, currentValue interface{}, h HotConfHandler)

Types

type ConfValue

type ConfValue struct {
	Pre     interface{}
	Current interface{}
	Default interface{}
}

ConfValue is the value set by hotconf

func (*ConfValue) String

func (cv *ConfValue) String() string

type HotConf

type HotConf interface {
	// Handle should be guaranteed thread-safe by the user
	Handle(key string, currentValue interface{}, h HotConfHandler)
}

HotConf means the config option can be hot changed without restarting the process

func New

func New() HotConf

type HotConfHandler

type HotConfHandler func(key, val string) (interface{}, error)

HotConfHandler handle the change event of a key, and return the current value

Jump to

Keyboard shortcuts

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