storage

package
v0.0.0-...-f28edca Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptedStorage

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

AESEncryptedStorage is a storage type which is backed by a json-file. The json-file contains key-value mappings, where the keys are _not_ encrypted, only the values are.

func NewAESEncryptedStorage

func NewAESEncryptedStorage(filename string, key []byte) *AESEncryptedStorage

NewAESEncryptedStorage creates a new encrypted storage backed by the given file/key

func (*AESEncryptedStorage) Get

func (s *AESEncryptedStorage) Get(key string) string

Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length

func (*AESEncryptedStorage) Put

func (s *AESEncryptedStorage) Put(key, value string)

Put stores a value by key. 0-length keys results in no-op

type EphemeralStorage

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

EphemeralStorage is an in-memory storage that does not persist values to disk. Mainly used for testing

func (*EphemeralStorage) Get

func (s *EphemeralStorage) Get(key string) string

func (*EphemeralStorage) Put

func (s *EphemeralStorage) Put(key, value string)

type Storage

type Storage interface {
	// Put stores a value by key. 0-length keys results in no-op
	Put(key, value string)
	// Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length
	Get(key string) string
}

func NewEphemeralStorage

func NewEphemeralStorage() Storage

Jump to

Keyboard shortcuts

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