disk

package
v0.0.0-...-c66ceb2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExists = errors.New("object does not exist in storage")
)

storage errors

Functions

This section is empty.

Types

type Loader

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

Loader loads the DataStore from the storage

func NewLoader

func NewLoader(storage *Storage) *Loader

NewLoader returns a new Loader instance

func (*Loader) Load

func (l *Loader) Load() (*cntl.DataStore, error)

Load the data from the storage and return a populated data store

type Storage

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

Storage is a filesystem abstraction storage for controller data

func New

func New(storageDir string) *Storage

New returns a new Storage instance with the given storage fileName set

func (*Storage) Delete

func (s *Storage) Delete(key string, kind interface{}) error

Delete a given key of a given kind

func (*Storage) Has

func (s *Storage) Has(key string, kind interface{}) bool

Has returns weather the storage has the given entity or not

func (*Storage) List

func (s *Storage) List(kind interface{}) []string

List the keys of a given kind

func (*Storage) Read

func (s *Storage) Read(key string, value interface{}) error

Read a given id into the given value

func (*Storage) Write

func (s *Storage) Write(key string, value interface{}) error

Write a given value with the given fileName to disk

Jump to

Keyboard shortcuts

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