backend

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCfgAddress = "127.0.0.1"
	DefaultCfgPort    = 8080
)

Variables

View Source
var (
	DefaultPathEtcd    = "/zerolog/config"
	DefaultDialTimeout = 5 * time.Second

	ErrEndpointsEmpty = errors.New("endpoints is empty")
	ErrKeyInvalid     = errors.New("key is invalid")
	ErrValueInvalid   = errors.New("value is invalid")
)

Functions

func NewClient

func NewClient(cfg ConfigBackendETCD) (*clientv3.Client, error)

NewClient is a constructor for DBETCD.

Types

type BETCD

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

func BackendETCD

func BackendETCD(cfg ConfigBackendETCD) (*BETCD, error)

hotReloadFromETCD is a function which sets up the hot reload from ETCD.

func (*BETCD) Close

func (b *BETCD) Close() error

Close is a function which closes the connection to etcd.

func (*BETCD) Get

func (b *BETCD) Get(key string, timeout int) (data.DataHotReload, error)

Get is a function which gets the value from etcd.

func (*BETCD) Reload

func (b *BETCD) Reload() data.DataHotReload

Reload is a function which reloads the hot reload from ETCD.

func (*BETCD) Set

func (b *BETCD) Set(key string, value data.DataHotReload, timeout int) error

Set is a function which sets the value to etcd.

func (*BETCD) Shutdown

func (b *BETCD) Shutdown() error

Shutdown is a function which shuts down the hot reload from ETCD.

type BLocalAPI

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

func BackendLocalAPI

func BackendLocalAPI(cfg ...ConfigBackendLocalAPI) (*BLocalAPI, error)

func (*BLocalAPI) HttpServer

func (b *BLocalAPI) HttpServer() error

func (*BLocalAPI) Reload

func (b *BLocalAPI) Reload() data.DataHotReload

func (*BLocalAPI) Shutdown

func (b *BLocalAPI) Shutdown() error

type ConfigBackendETCD

type ConfigBackendETCD struct {
	// Endpoints is a list of ETCD Servers.
	Endpoints []string
	// DialTimeout is the timeout for failing to connect to a server.
	DialTimeout time.Duration
	// TLS is a reference to the TLS Config.
	TLS *tls.Config
	// Path get the value from etcd.
	Path string
}

type ConfigBackendLocalAPI

type ConfigBackendLocalAPI struct {
	Address string
	Port    int
}

Jump to

Keyboard shortcuts

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