index

package
v0.0.0-...-b9690c5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("Record is not found")

	// ErrChanged is returned from SaveLocked
	// if record with the same key was inserted by another client
	// between FindLocked-SaveLocked cycle; e.g.:
	//   client1: FindLocked -> ErrNotFound
	//   client2: FindLocked -> ErrNotFound
	//   client1: SaveLocked -> no err
	//   client2: SaveLocked -> ErrChanged
	ErrChanged = errors.New("Record changed")
)

Functions

This section is empty.

Types

type FileIndex

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

func NewFileIndex

func NewFileIndex(path string, fs boshsys.FileSystem) FileIndex

func (FileIndex) Find

func (ri FileIndex) Find(key interface{}, entry interface{}) error

func (FileIndex) FindLocked

func (ri FileIndex) FindLocked(key interface{}, value interface{}) (LockedRecord, error)

func (FileIndex) List

func (ri FileIndex) List(entries interface{}) error

func (FileIndex) ListKeys

func (ri FileIndex) ListKeys(keys interface{}) error

func (FileIndex) Remove

func (ri FileIndex) Remove(key interface{}) error

func (FileIndex) Save

func (ri FileIndex) Save(key interface{}, entry interface{}) error

type Index

type Index interface {
	ListKeys(interface{}) error
	List(interface{}) error

	Find(interface{}, interface{}) error
	Save(interface{}, interface{}) error
	Remove(interface{}) error

	// FindLocked returns and locks record such that another client cannot read or write it
	// before associated locked record is released is called.
	// (In databases typically this is done with row level locks and transactions.)
	FindLocked(interface{}, interface{}) (LockedRecord, error)
}

type LockedRecord

type LockedRecord interface {
	Release() error

	Save(interface{}) error
	Remove() error
}

Jump to

Keyboard shortcuts

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