vaquita

package module
v0.0.0-...-2d2925b Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2015 License: MIT Imports: 5 Imported by: 4

README

Vaquita

In development, experimental

Vaquita is a configuration management library for Go inspired by archaius.

Property values are resolved in a hierarchy of configurations polled from different sources (files, Dbs, ZooKeeper, etc.) and updated during runtime.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoValue          = errors.New("no property value")
	InvalidBoolValue = errors.New("invalid boolean value")
)
View Source
var InvalidSubscribtion = errors.New("invalid subscription")

Functions

func CompareIdentity

func CompareIdentity(cfg1 Config, cfg2 Config) bool

Types

type BoolProperty

type BoolProperty interface {
	Get() bool
	Property
}

func NewChainedBoolProperty

func NewChainedBoolProperty(f *PropertyFactory, name string, next BoolProperty) BoolProperty

type Callback

type Callback func(e *ChangeEvent)

type ChainedBoolProperty

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

func (*ChainedBoolProperty) Get

func (p *ChainedBoolProperty) Get() bool

func (*ChainedBoolProperty) HasValue

func (p *ChainedBoolProperty) HasValue() bool

func (*ChainedBoolProperty) Name

func (p *ChainedBoolProperty) Name() string

type ChainedDurationProperty

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

func (*ChainedDurationProperty) Get

func (*ChainedDurationProperty) HasValue

func (p *ChainedDurationProperty) HasValue() bool

func (*ChainedDurationProperty) Name

func (p *ChainedDurationProperty) Name() string

type ChainedIntProperty

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

func (*ChainedIntProperty) Get

func (p *ChainedIntProperty) Get() int

func (*ChainedIntProperty) HasValue

func (p *ChainedIntProperty) HasValue() bool

func (*ChainedIntProperty) Name

func (p *ChainedIntProperty) Name() string

type ChainedStringProperty

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

func (*ChainedStringProperty) Get

func (p *ChainedStringProperty) Get() string

func (*ChainedStringProperty) HasValue

func (p *ChainedStringProperty) HasValue() bool

func (*ChainedStringProperty) Name

func (p *ChainedStringProperty) Name() string

type ChangeEvent

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

func NewChangeEvent

func NewChangeEvent(source Config, event Event, name, value string) *ChangeEvent

func (*ChangeEvent) Event

func (e *ChangeEvent) Event() Event

func (*ChangeEvent) Name

func (e *ChangeEvent) Name() string

func (*ChangeEvent) Source

func (e *ChangeEvent) Source() Config

func (*ChangeEvent) Value

func (e *ChangeEvent) Value() string

type Config

type Config interface {
	SetProperty(name, value string)
	HasProperty(name string) bool
	GetProperty(name string) (string, bool)
	RemoveProperty(name string)
}

type DurationProperty

type DurationProperty interface {
	Get() time.Duration
	Property
}

func NewChainedDurationProperty

func NewChainedDurationProperty(f *PropertyFactory, name string, unit time.Duration, next DurationProperty) DurationProperty

type DynamicBoolProperty

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

func (*DynamicBoolProperty) Get

func (p *DynamicBoolProperty) Get() bool

func (*DynamicBoolProperty) HasValue

func (p *DynamicBoolProperty) HasValue() bool

func (*DynamicBoolProperty) Name

func (p *DynamicBoolProperty) Name() string

type DynamicConfig

type DynamicConfig interface {
	Config
	Observable
}

type DynamicDurationProperty

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

func (*DynamicDurationProperty) Get

func (*DynamicDurationProperty) HasValue

func (p *DynamicDurationProperty) HasValue() bool

func (*DynamicDurationProperty) Name

func (p *DynamicDurationProperty) Name() string

type DynamicIntProperty

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

func (*DynamicIntProperty) Get

func (p *DynamicIntProperty) Get() int

func (*DynamicIntProperty) HasValue

func (p *DynamicIntProperty) HasValue() bool

func (*DynamicIntProperty) Name

func (p *DynamicIntProperty) Name() string

type DynamicProperty

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

func (*DynamicProperty) LastTimeChanged

func (p *DynamicProperty) LastTimeChanged() time.Time

func (*DynamicProperty) Name

func (p *DynamicProperty) Name() string

type DynamicStringProperty

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

func (*DynamicStringProperty) Get

func (p *DynamicStringProperty) Get() string

func (*DynamicStringProperty) HasValue

func (p *DynamicStringProperty) HasValue() bool

func (*DynamicStringProperty) Name

func (p *DynamicStringProperty) Name() string

type Event

type Event int
const (
	PropertySet Event = iota
	PropertyRemoved
	PropertyChanged
)

type EventHandler

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

func NewEventHandler

func NewEventHandler() *EventHandler

func (*EventHandler) Notify

func (h *EventHandler) Notify(e *ChangeEvent)

func (*EventHandler) Subscribe

func (h *EventHandler) Subscribe(f Callback) subscription

func (*EventHandler) Unsubscribe

func (h *EventHandler) Unsubscribe(s subscription) error

type IntProperty

type IntProperty interface {
	Get() int
	Property
}

func NewChainedIntProperty

func NewChainedIntProperty(f *PropertyFactory, name string, next IntProperty) IntProperty

type LayeredConfig

type LayeredConfig struct {
	*EventHandler
	// contains filtered or unexported fields
}

func NewLayeredConfig

func NewLayeredConfig() *LayeredConfig

func (*LayeredConfig) Add

func (c *LayeredConfig) Add(cfg DynamicConfig) int

func (*LayeredConfig) AddAtIndex

func (c *LayeredConfig) AddAtIndex(cfg DynamicConfig, index int) int

func (*LayeredConfig) GetProperty

func (c *LayeredConfig) GetProperty(name string) (string, bool)

func (*LayeredConfig) HasProperty

func (c *LayeredConfig) HasProperty(name string) bool

func (*LayeredConfig) RemoveProperty

func (c *LayeredConfig) RemoveProperty(name string)

func (*LayeredConfig) SetProperty

func (c *LayeredConfig) SetProperty(name string, value string)

type MapConfig

type MapConfig struct {
	*EventHandler
	// contains filtered or unexported fields
}

func NewEmptyMapConfig

func NewEmptyMapConfig() *MapConfig

func NewMapConfig

func NewMapConfig(values map[string]string) *MapConfig

func (*MapConfig) GetProperty

func (c *MapConfig) GetProperty(name string) (string, bool)

func (*MapConfig) HasProperty

func (c *MapConfig) HasProperty(name string) bool

func (*MapConfig) RemoveProperty

func (c *MapConfig) RemoveProperty(name string)

func (*MapConfig) SetProperty

func (c *MapConfig) SetProperty(name, value string)

type Observable

type Observable interface {
	Subscribe(Callback) subscription
	Unsubscribe(subscription) error
}

type Property

type Property interface {
	Name() string
	HasValue() bool
}

type PropertyFactory

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

func NewPropertyFactory

func NewPropertyFactory(owner DynamicConfig) *PropertyFactory

func (*PropertyFactory) GetBoolProperty

func (f *PropertyFactory) GetBoolProperty(name string, defaultValue bool) BoolProperty

func (*PropertyFactory) GetDurationProperty

func (f *PropertyFactory) GetDurationProperty(name string, defaultValue time.Duration, unit time.Duration) DurationProperty

func (*PropertyFactory) GetIntProperty

func (f *PropertyFactory) GetIntProperty(name string, defaultValue int) IntProperty

func (*PropertyFactory) GetStringProperty

func (f *PropertyFactory) GetStringProperty(name, defaultValue string) StringProperty

type StringProperty

type StringProperty interface {
	Get() string
	Property
}

func NewChainedStringProperty

func NewChainedStringProperty(f *PropertyFactory, name string, next StringProperty) StringProperty

Jump to

Keyboard shortcuts

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