dynamicconfig

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolPropertyFn

type BoolPropertyFn func(opts ...FilterOption) bool

BoolPropertyFn is a wrapper to get bool property from dynamic config

type Client

type Client interface {
	GetValue(name Key, defaultValue interface{}) (interface{}, error)
	GetValueWithFilters(name Key, filters map[Filter]interface{}, defaultValue interface{}) (interface{}, error)

	GetIntValue(name Key, filters map[Filter]interface{}, defaultValue int) (int, error)
	GetFloatValue(name Key, filters map[Filter]interface{}, defaultValue float64) (float64, error)
	GetBoolValue(name Key, filters map[Filter]interface{}, defaultValue bool) (bool, error)
	GetStringValue(name Key, filters map[Filter]interface{}, defaultValue string) (string, error)
	GetMapValue(
		name Key, filters map[Filter]interface{}, defaultValue map[string]interface{},
	) (map[string]interface{}, error)
	GetDurationValue(
		name Key, filters map[Filter]interface{}, defaultValue time.Duration,
	) (time.Duration, error)
}

Client allows fetching values from a dynamic configuration system NOTE: This does not have async options right now. In the interest of keeping it minimal, we can add when requirement arises.

func NewNopClient

func NewNopClient() Client

NewNopClient creates a nop client

type Collection

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

Collection wraps dynamic config client with a closure so that across the code, the config values can be directly accessed by calling the function without propagating the client everywhere in code

func NewCollection

func NewCollection(client Client, logger bark.Logger) *Collection

NewCollection creates a new collection

func NewNopCollection

func NewNopCollection() *Collection

NewNopCollection creates a new nop collection

func (*Collection) GetBoolProperty

func (c *Collection) GetBoolProperty(key Key, defaultValue bool) BoolPropertyFn

GetBoolProperty gets property and asserts that it's an bool

func (*Collection) GetDurationProperty

func (c *Collection) GetDurationProperty(key Key, defaultValue time.Duration) DurationPropertyFn

GetDurationProperty gets property and asserts that it's a duration

func (*Collection) GetFloat64Property

func (c *Collection) GetFloat64Property(key Key, defaultValue float64) FloatPropertyFn

GetFloat64Property gets property and asserts that it's a float64

func (*Collection) GetIntProperty

func (c *Collection) GetIntProperty(key Key, defaultValue int) IntPropertyFn

GetIntProperty gets property and asserts that it's an integer

func (*Collection) GetProperty

func (c *Collection) GetProperty(key Key, defaultValue interface{}) PropertyFn

GetProperty gets a eface property and returns defaultValue if property is not found

type DurationPropertyFn

type DurationPropertyFn func(opts ...FilterOption) time.Duration

DurationPropertyFn is a wrapper to get duration property from dynamic config

type Filter

type Filter int

Filter represents a filter on the dynamic config key

const (

	// DomainName is the domain name
	DomainName Filter
	// TaskListName is the tasklist name
	TaskListName
)

func (Filter) String

func (f Filter) String() string

type FilterOption

type FilterOption func(filterMap map[Filter]interface{})

FilterOption is used to provide filters for dynamic config keys

func DomainFilter

func DomainFilter(name string) FilterOption

DomainFilter filters by domain name

func TaskListFilter

func TaskListFilter(name string) FilterOption

TaskListFilter filters by task list name

type FloatPropertyFn

type FloatPropertyFn func(opts ...FilterOption) float64

FloatPropertyFn is a wrapper to get float property from dynamic config

type IntPropertyFn

type IntPropertyFn func(opts ...FilterOption) int

IntPropertyFn is a wrapper to get int property from dynamic config

type Key

type Key int

Key represents a key/property stored in dynamic config

const (

	// MatchingMinTaskThrottlingBurstSize is the minimum burst size for task list throttling
	MatchingMinTaskThrottlingBurstSize Key
	// MatchingMaxTaskBatchSize is the maximum batch size to fetch from the task buffer
	MatchingMaxTaskBatchSize
	// MatchingLongPollExpirationInterval is the long poll expiration interval in the matching service
	MatchingLongPollExpirationInterval
	// MatchingEnableSyncMatch is to enable sync match
	MatchingEnableSyncMatch
	// MatchingUpdateAckInterval is the interval for update ack
	MatchingUpdateAckInterval
	// MatchingIdleTasklistCheckInterval is the IdleTasklistCheckInterval
	MatchingIdleTasklistCheckInterval
	// HistoryLongPollExpirationInterval is the long poll expiration interval in the history service
	HistoryLongPollExpirationInterval
)

func (Key) String

func (k Key) String() string

type PropertyFn

type PropertyFn func() interface{}

PropertyFn is a wrapper to get property from dynamic config

Jump to

Keyboard shortcuts

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