storage

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package storage provides different backends for versioned data storage.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("storage item does not exist")

Functions

This section is empty.

Types

type Backend

type Backend interface {
	URI() string
	Create(name string, data []byte) (string, error)
	Update(name string, data []byte) (Version, error)
	Delete(name string) error
	List() (Names, error)
	Get(name string) ([]byte, error)
	GetVersions(name string) ([]Version, error)
	GetVersion(name string, version Version) ([]byte, error)
	Log(name string, message string) error
}

func NewFSStorage

func NewFSStorage(path string, versionLimit VersionLimit) (Backend, error)

func NewMemoryStorage

func NewMemoryStorage(versionLimit VersionLimit) Backend

type Names

type Names interface {
	Next() string
}

type Version

type Version uint64

type VersionLimit

type VersionLimit uint64
const MaxVersionLimit VersionLimit = 255

Jump to

Keyboard shortcuts

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