storage

package
v0.0.0-...-813fb4a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidUserObject = errors.New("Invalid user object")
	UserNotFound      = errors.New("No user found.")

	LoginNameAlreadyTaken = errors.New("The given loginName is already taken.")
	EmailAlreadyTaken     = errors.New("The given email address is already taken.")
)

Functions

func NewEtcdStorage

func NewEtcdStorage(peers []string, prefix string, ttl uint64, syncCluster, logCURL bool, logger *log.Logger) *keyValueStorage

func NewLocalStorage

func NewLocalStorage() *keyValueStorage

func NewRedisStorage

func NewRedisStorage(pool *redis.Pool) *keyValueStorage

Types

type EtcdIndex

type EtcdIndex struct {
	Storage *EtcdStorageDriver
	Name    string
}

EtcdIndex implements KeyValueIndex on Etcd.

func (*EtcdIndex) Lookup

func (s *EtcdIndex) Lookup(key string) (string, bool, error)

func (*EtcdIndex) Put

func (s *EtcdIndex) Put(key, userID string) error

func (*EtcdIndex) Remove

func (s *EtcdIndex) Remove(key string) error

type EtcdStorageDriver

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

func (*EtcdStorageDriver) Index

func (d *EtcdStorageDriver) Index(name string) keyValueIndex

Index is called initially to create a helper for accessing an index

func (*EtcdStorageDriver) Lookup

func (d *EtcdStorageDriver) Lookup(userID string) (string, bool, error)

Lookup returns the json previously written with Set().

func (*EtcdStorageDriver) Path

func (d *EtcdStorageDriver) Path(index, name string) string

func (*EtcdStorageDriver) Set

func (d *EtcdStorageDriver) Set(userID, json string) error

Set writes the json with data

type Index

type Index struct {
	Lock *sync.Mutex
	Data map[string]string
}

Index is a helper struct

func NewIndex

func NewIndex() *Index

func (*Index) Lookup

func (i *Index) Lookup(key string) (string, bool, error)

func (*Index) Put

func (i *Index) Put(key, value string) error

func (*Index) Remove

func (i *Index) Remove(key string) error

Jump to

Keyboard shortcuts

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