client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IsEnabled(string, bool) bool
	GetFeatures() map[string]bool
}

Client is a threadsafe client for the Laika API.

func NewClient

func NewClient(conf Config) (Client, error)

NewClient creates a new Client.

type Config

type Config struct {
	Addr            string
	Username        string
	Password        string
	Environment     string
	PollingInterval time.Duration
}

Config is used to parameterize a client

type Error

type Error struct {
	Message string `json:"message"`
}

Error represents an API error.

type Feature

type Feature struct {
	CreatedAt time.Time       `json:"created_at"`
	Name      string          `json:"name"`
	Status    map[string]bool `json:"status"`
}

Feature represents a Feature.

type FeatureCache

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

FeatureCache is a in-memory threadsafe cache for Features.

func NewFeatureCache

func NewFeatureCache() *FeatureCache

NewFeatureCache creates a new FeatureCache.

func (*FeatureCache) Add

func (fc *FeatureCache) Add(feature *Feature)

Add adds a feature to the cache.

func (*FeatureCache) AddAll

func (fc *FeatureCache) AddAll(features []*Feature)

AddAll adds a list of features to the cache.

func (*FeatureCache) Get

func (fc *FeatureCache) Get(name string) *Feature

Get gets a Feature from the cache if it exits.

func (*FeatureCache) GetAll

func (fc *FeatureCache) GetAll() map[string]*Feature

Jump to

Keyboard shortcuts

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