kevlar

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 17 Imported by: 0

README

kvas

kvas is a minimal overhead key value store backed by the filesystem.

Documentation

Index

Constants

View Source
const (
	JsonExt = ".json"
	GobExt  = ".gob"
	HtmlExt = ".html"
	XmlExt  = ".xml"
)
View Source
const (
	CaseSensitive = iota
	FullMatch
)

Variables

This section is empty.

Functions

func ErrUnknownAsset added in v0.5.0

func ErrUnknownAsset(asset string) error

func Sha256

func Sha256(reader io.Reader) (string, error)

Types

type KeyValues added in v0.3.2

type KeyValues interface {
	Keys() ([]string, error)
	Has(key string) (bool, error)

	Get(key string) (io.ReadCloser, error)
	Set(key string, data io.Reader) error
	Cut(key string) (bool, error)

	IsCurrent() (bool, time.Time)
	CreatedAfter(ts int64) ([]string, error)
	UpdatedAfter(ts int64) ([]string, error)
	CreatedOrUpdatedAfter(ts int64) ([]string, error)
	IsUpdatedAfter(key string, ts int64) (bool, error)

	ModTime(key string) (time.Time, error)
}

func NewKeyValues added in v0.4.10

func NewKeyValues(dir, ext string) (KeyValues, error)

NewKeyValues connects a new local key value storage at the specified directory and will use specified extension for the value files

type MatchOption added in v0.3.38

type MatchOption int

type ReadableRedux added in v0.3.38

type ReadableRedux interface {
	MustHave(assets ...string) error
	Keys(asset string) []string
	HasAsset(asset string) bool
	HasKey(asset, key string) bool
	HasValue(asset, key, val string) bool
	GetAllValues(asset, key string) ([]string, bool)
	GetLastVal(asset, key string) (string, bool)
	ModTime() (time.Time, error)
	RefreshReader() (ReadableRedux, error)
	MatchAsset(asset string, terms []string, scope []string, options ...MatchOption) []string
	Match(query map[string][]string, options ...MatchOption) []string
	Sort(ids []string, desc bool, sortBy ...string) ([]string, error)
	Export(w io.Writer, keys ...string) error
}

func NewReduxReader added in v0.4.3

func NewReduxReader(dir string, assets ...string) (ReadableRedux, error)

type WriteableRedux added in v0.3.38

type WriteableRedux interface {
	ReadableRedux
	AddValues(asset, key string, values ...string) error
	BatchAddValues(asset string, keyValues map[string][]string) error
	ReplaceValues(asset, key string, values ...string) error
	BatchReplaceValues(asset string, keyValues map[string][]string) error
	CutKeys(asset string, keys ...string) error
	CutValues(asset, key string, values ...string) error
	BatchCutValues(asset string, keyValues map[string][]string) error
	RefreshWriter() (WriteableRedux, error)
}

func NewReduxWriter added in v0.4.3

func NewReduxWriter(dir string, assets ...string) (WriteableRedux, error)

Jump to

Keyboard shortcuts

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