persistence

package
v0.0.0-...-2cf97e7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 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
}

Accessor defines persistence storage accessor.

type Filesystem

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

Filesystem implements filesystem persistence storage accessor.

func CreateFilesystem

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

CreateFilesystem creates a filesystem for the argument diretory.

func OpenFilesystem

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

OpenFilesystem opens the filesystem from the argument directory.

func (*Filesystem) Exists

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

Exists implements Reader.Exists.

func (*Filesystem) Get

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

Get implements Reader.Get.

func (*Filesystem) GetAll

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

GetAll implements Reader.GetAll.

func (*Filesystem) Set

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

Set implements Writer.Set.

type Flags

type Flags uint

Flags define flags for persistence operations.

const (
	// NoCache forces reading from the storage bypassing any cached
	// content.
	NoCache Flags = 1 << iota
)

type HTTP

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

HTTP implements HTTP presistence storage accessor.

func NewHTTP

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

NewHTTP creates a new HTTP persistence storage accessor.

func (*HTTP) Exists

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

Exists implements Reader.Exists.

func (*HTTP) Get

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

Get implements Reader.Get.

func (*HTTP) GetAll

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

GetAll implements Reader.GetAll.

func (*HTTP) Set

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

Set implements Writer.Set.

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)
}

Reader defines persistence reader interface.

type Writer

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

Writer defines persistence writer interface.

Jump to

Keyboard shortcuts

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