ds

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIllegalKey   = errors.New("illegal key")
	ErrKeyNotExists = errors.New("key not exists")
)

Functions

func ReplaceToDotKey

func ReplaceToDotKey(m map[string]string) map[string]string

func ReplaceToSlashKey

func ReplaceToSlashKey(m map[string]string) map[string]string

Types

type Args

type Args struct {
	DS    string
	Token string
	Root  string
}

type DataSource

type DataSource interface {
	Get(key string) (string, error)
	Set(key, val string) error
	JSON() ([]byte, error)
	Watch() (chan struct{}, chan error)
	Close() error
}

func Provider

func Provider(args Args) (DataSource, error)

type File

type File struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFile

func NewFile(name string) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) Get

func (f *File) Get(key string) (string, error)

func (*File) JSON

func (f *File) JSON() ([]byte, error)

func (*File) Set

func (f *File) Set(key, val string) error

func (*File) Watch

func (f *File) Watch() (chan struct{}, chan error)

type GRPC

type GRPC struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGRPC

func NewGRPC(addr, token, root string) (*GRPC, error)

func (*GRPC) Close

func (g *GRPC) Close() error

func (*GRPC) Get

func (g *GRPC) Get(key string) (string, error)

func (*GRPC) JSON

func (g *GRPC) JSON() ([]byte, error)

func (*GRPC) Set

func (g *GRPC) Set(key, val string) error

func (*GRPC) Watch

func (g *GRPC) Watch() (chan struct{}, chan error)

Jump to

Keyboard shortcuts

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