confdis

package
v3.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 5, 2015 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

confdis manages JSON based configuration in redis

Index

Constants

View Source
const PUB_SUFFIX = ":_changes"
View Source
const PUB_VALUE = "{\"library\": \"confdis\"}"

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfDis

type ConfDis struct {
	Changes chan error // Channel to receive config updates (value is return of reload())
	// contains filtered or unexported fields
}

func New

func New(client *redis.Client, rootKey string, structVal interface{}) (*ConfDis, error)

func (*ConfDis) AtomicSave

func (c *ConfDis) AtomicSave(editFn func(interface{}) error) error

AtomicSave is like save, but only writes the changed config back to redis if somebody else did not make a change already (notified via pubsub). Note that the converse is not necessarily true; somebody else -- specifically, reload() -- *could* overwrite the changes written by AtomicSave.

func (*ConfDis) GetConfig

func (c *ConfDis) GetConfig() interface{}

GetConfig returns the current snapshot of config struct.

func (*ConfDis) MustReceiveChanges

func (c *ConfDis) MustReceiveChanges()

MustReceiveChanges listens for change notifications and updates the internal config. Will panic if there is an error reading the new config.

Jump to

Keyboard shortcuts

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