cache

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const STATE_FN = ".state-"

STATE_FN ...

Variables

View Source
var (
	ErrPrevStateNotFound   = errors.New("could not find previous state")
	ErrLocalStateCorrupted = errors.New("local state is corrupted")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(serverUUID, db string) (*schema.ImmutableState, error)
	Set(serverUUID, db string, state *schema.ImmutableState) error
	GetLocker(serverUUID string) Locker
}

Cache the cache interface

func NewFileCache

func NewFileCache(dir string) Cache

NewFileCache returns a new file cache

func NewInMemoryCache added in v0.7.0

func NewInMemoryCache() Cache

NewInMemoryCache returns a new in-memory cache

type FileLocker added in v0.9.1

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

func (*FileLocker) Lock added in v0.9.1

func (fl *FileLocker) Lock() (err error)

func (*FileLocker) Unlock added in v0.9.1

func (fl *FileLocker) Unlock() (err error)

type HistoryCache

type HistoryCache interface {
	Cache
	Walk(serverUUID string, db string, f func(*schema.ImmutableState) interface{}) ([]interface{}, error)
}

HistoryCache the history cache interface

func NewHistoryFileCache

func NewHistoryFileCache(dir string) HistoryCache

NewHistoryFileCache returns a new history file cache

type HistoryLocker added in v0.9.1

type HistoryLocker struct{}

func (*HistoryLocker) Lock added in v0.9.1

func (fl *HistoryLocker) Lock() (err error)

func (*HistoryLocker) Unlock added in v0.9.1

func (fl *HistoryLocker) Unlock() (err error)

type InMemoryLocker added in v0.9.1

type InMemoryLocker struct{}

func (*InMemoryLocker) Lock added in v0.9.1

func (fl *InMemoryLocker) Lock() (err error)

func (*InMemoryLocker) Unlock added in v0.9.1

func (fl *InMemoryLocker) Unlock() (err error)

type Locker added in v0.9.1

type Locker interface {
	Lock() error
	Unlock() error
}

Jump to

Keyboard shortcuts

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