config

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBootstrap

func LoadBootstrap(file string) (*bootstrap.Bootstrap, error)

Types

type Config

type Config struct {
	sync.RWMutex
	*bootstrap.Bootstrap
	// contains filtered or unexported fields
}

func New

func New(b *bootstrap.Bootstrap) (*Config, error)

New creates config with the given bootstrap object.

func (*Config) MarshalJSON

func (c *Config) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

func (*Config) Subscribe

func (c *Config) Subscribe() <-chan Event

Subscribe subscribes the config update.

type DynamicSource

type DynamicSource interface {
	// SetDependencyHook sets a hook which will be called
	// when a dependency is added or removed. It must be
	// called before Serve.
	SetDependencyHook(hook dependencyHook)
	// SetSvcConfigHook sets a hook which wil be called
	// when the proxy config of subscribed service update.
	// It must be called before Serve.
	SetSvcConfigHook(hook svcConfigHook)
	// SetSvcEndpointHook sets a hook which will be called
	// when the endpoints of subscribed service updated.
	// It must be called before Serve.
	SetSvcEndpointHook(hook svcEndpointHook)

	// Serve starts observing the config update from remote.
	// It will return until Stop is called.
	Serve()
	// Stop stops observing the config update from remote.
	Stop()
}

DynamicSource represents the dynamic config source.

type Event

type Event interface {
}

Event represents an event indicating config change.

type SvcAddEvent

type SvcAddEvent struct {
	Name      string
	Config    *service.Config
	Endpoints []*service.Endpoint
}

SvcAddEvent represents a service add event.

type SvcConfigEvent

type SvcConfigEvent struct {
	Name   string
	Config *service.Config
}

SvcConfigEvent represents a service config change event.

type SvcEndpointEvent

type SvcEndpointEvent struct {
	Name    string
	Added   []*service.Endpoint
	Removed []*service.Endpoint
}

SvcEndpointEvent represents a service endpoints change event.

type SvcRemoveEvent

type SvcRemoveEvent struct {
	Name string
}

SvcRemoveEvent represents a service remove event.

Jump to

Keyboard shortcuts

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