loader

package
v0.5.17 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotLoaded        = errors.New("not loaded config yet")
	ErrLoaderStop       = errors.New("config loader has been close")
	ErrNotSupportReload = errors.New("current config loader not support reload")
)

Functions

This section is empty.

Types

type Loader

type Loader interface {
	// Close will stop the loader
	Close() error
	// Load the sources
	Load(...source.Source) error
	// A Snapshot of loaded config
	Snapshot() (*Snapshot, error)
	// Next will return the updated data, when the configuration data is updated
	Next() (*Snapshot, error)
	// String is the name of loader
	String() string
}

Loader manages loading sources

type Option

type Option func(o *Options)

func WithReader

func WithReader(r reader.Reader) Option

WithReader sets the config reader

func WithSource

func WithSource(s source.Source) Option

type Options

type Options struct {
	Reader reader.Reader
	Source []source.Source
}

type Snapshot

type Snapshot struct {
	// The merged ChangeSet
	ChangeSet *source.ChangeSet
	// Deterministic and comparable version of the snapshot
	Version string
}

Snapshot is a merged ChangeSet

func Copy

func Copy(s *Snapshot) *Snapshot

Copy snapshot

Directories

Path Synopsis
Package memory loader will load config info from source, encoder it and store to memory
Package memory loader will load config info from source, encoder it and store to memory

Jump to

Keyboard shortcuts

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