storage

package
v0.0.0-...-3fdd853 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package storage contains abstract storage implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypt

type Crypt interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

func NewRSACrypt

func NewRSACrypt(c config.Configuration) (Crypt, error)

type File

type File struct {
	Dir   string
	Crypt Crypt
}

File is a file system based Json implementation

func New

func New(dir string, crypt Crypt) (*File, error)

Returns new file system based JSON implementation. The dir is created if it does not exist.

func (File) Delete

func (fs File) Delete(id string) error

func (File) Get

func (fs File) Get(id string, v interface{}) error

func (File) Put

func (fs File) Put(id string, data interface{}) error

type InMemory

type InMemory struct {
	Pretend bool // Set Pretend to true to simulate a found even when it's not previously stored
	sync.RWMutex
	// contains filtered or unexported fields
}

InMemory is a Json implementation to hold structs in memory

func (*InMemory) Delete

func (n *InMemory) Delete(id string) error

func (*InMemory) Get

func (n *InMemory) Get(id string, v interface{}) error

func (*InMemory) Put

func (n *InMemory) Put(id string, data interface{}) error

type Json

type Json interface {
	Put(string, interface{}) error
	Get(string, interface{}) error
	Delete(string) error
}

Json is the base wrapper for json based storage devices

type RSA

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

RSA is used to en- and decrypt using RSA.

func (RSA) Decrypt

func (r RSA) Decrypt(b []byte) ([]byte, error)

func (RSA) Encrypt

func (r RSA) Encrypt(b []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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