doryMemory

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DoryDiskvBaseDir = golenv.OverrideIfEnv("DORY_DISKV_BASE_DIR", "/tmp")
	DoryDiskvCacheMB = golenv.OverrideIfEnv("DORY_DISKV_CACHE_MB", "128")
)

Functions

This section is empty.

Types

type Cache2Go

type Cache2Go struct {
	CacheTable *cache2go.CacheTable
}

Cache2Go is abstracted here so it can be mocked.

func (*Cache2Go) Add

func (cache *Cache2Go) Add(key string, ttl time.Duration, dataBlob []byte) error

func (*Cache2Go) Count

func (cache *Cache2Go) Count() int

func (*Cache2Go) Delete

func (cache *Cache2Go) Delete(key string) error

func (*Cache2Go) Exists

func (cache *Cache2Go) Exists(key string) bool

func (*Cache2Go) List

func (cache *Cache2Go) List() []string

func (*Cache2Go) Purge

func (cache *Cache2Go) Purge() error

func (*Cache2Go) PurgeOne

func (cache *Cache2Go) PurgeOne(key string) error

func (*Cache2Go) Value

func (cache *Cache2Go) Value(key string) ([]byte, error)

type DataStore

type DataStore interface {
	Add(string, time.Duration, []byte) error
	Delete(string) error
	Exists(string) bool
	Value(string) ([]byte, error)

	List() []string
	Count() int
	Purge() error
	PurgeOne(string) error
}

DataStore is an interface for all datastore backends that can be used. Mainly so I can write actual "unit" tests.

func NewDiskv

func NewDiskv(cacheName string) DataStore

NewDiskv instantiates and return a GolevelDB DBEngine.

func NewLocalAuthStore

func NewLocalAuthStore(cacheName string) DataStore

NewLocalAuthStore instantiates and return a Cache2Go Table store.

type Diskv

type Diskv struct {
	KV *diskv.Diskv
}

Diskv is abstracted here so it can be mocked.

func (*Diskv) Add

func (kvstore *Diskv) Add(key string, ttl time.Duration, dataBlob []byte) error

func (*Diskv) Count

func (kvstore *Diskv) Count() int

func (*Diskv) Delete

func (kvstore *Diskv) Delete(key string) error

func (*Diskv) Exists

func (kvstore *Diskv) Exists(key string) bool

func (*Diskv) List

func (kvstore *Diskv) List() []string

func (*Diskv) Purge

func (kvstore *Diskv) Purge() error

func (*Diskv) PurgeOne

func (kvstore *Diskv) PurgeOne(key string) error

func (*Diskv) Value

func (kvstore *Diskv) Value(key string) ([]byte, error)

type LocalAuth

type LocalAuth struct {
	Name      string
	Value     golcrypt.AESBlock
	TTLSecond uint64
}

LocalAuth is a struct for Name as Auth-Path, Value with Gol Library Struct for Data/Cipher/Key nodes, TTLSecond for expiry timeout.

func (*LocalAuth) Delete

func (auth *LocalAuth) Delete(dataStore DataStore) bool

Delete purges a Auth-Path in Cache2Go Table, if it's value is decipherable by given Token.

func (*LocalAuth) Exists

func (auth *LocalAuth) Exists(dataStore DataStore) bool

Exists checks if a Auth-Path exists in Cache2Go Table.

func (*LocalAuth) Get

func (auth *LocalAuth) Get(dataStore DataStore) bool

Get fetchs a value decrypted by Token stored at a Auth-Path in Cache2Go Table.

func (*LocalAuth) Set

func (auth *LocalAuth) Set(dataStore DataStore) bool

Set stores an encrypted value with random/provided Token at Auth-Path in Cache2Go Table.

Jump to

Keyboard shortcuts

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