persistence

package
v0.0.0-...-4f831cf Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessor

type Accessor interface {
	Reader
	Writer
}

type Filesystem

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

func CreateFilesystem

func CreateFilesystem(root string) (*Filesystem, error)

func OpenFilesystem

func OpenFilesystem(root string) (*Filesystem, error)

func (*Filesystem) Exists

func (fs *Filesystem) Exists(namespace, key string) (bool, error)

func (*Filesystem) Get

func (fs *Filesystem) Get(namespace, key string, flags Flags) ([]byte, error)

func (*Filesystem) GetAll

func (fs *Filesystem) GetAll(namespace string) (map[string][]byte, error)

func (*Filesystem) Set

func (fs *Filesystem) Set(namespace, key string, value []byte) error

type Flags

type Flags uint
const (
	NoCache Flags = 1 << iota
)

type HTTP

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

func NewHTTP

func NewHTTP(root string) (*HTTP, error)

func (*HTTP) Exists

func (h *HTTP) Exists(namespace, key string) (bool, error)

func (*HTTP) Get

func (h *HTTP) Get(namespace, key string, flags Flags) ([]byte, error)

func (*HTTP) GetAll

func (h *HTTP) GetAll(namespace string) (map[string][]byte, error)

func (*HTTP) Set

func (h *HTTP) Set(namespace, key string, data []byte) error

type Reader

type Reader interface {
	// Exists tests if the specified key exists in the namespace.
	Exists(namespace, key string) (bool, error)

	// Get gets the data of the specified key in the namespace.
	Get(namespace, key string, flags Flags) ([]byte, error)

	// GetAll returns all keys and their values from the namespae.
	GetAll(namespace string) (map[string][]byte, error)
}

type Writer

type Writer interface {
	// Set sets the data to the specified key in the namespace.
	Set(namespace, key string, data []byte) error
}

Jump to

Keyboard shortcuts

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