Documentation ¶
Index ¶
- Variables
- type FileIndex
- func (ri FileIndex) Find(key interface{}, entry interface{}) error
- func (ri FileIndex) FindLocked(key interface{}, value interface{}) (LockedRecord, error)
- func (ri FileIndex) List(entries interface{}) error
- func (ri FileIndex) ListKeys(keys interface{}) error
- func (ri FileIndex) Remove(key interface{}) error
- func (ri FileIndex) Save(key interface{}, entry interface{}) error
- type Index
- type LockedRecord
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) FindLocked ¶
func (ri FileIndex) FindLocked(key interface{}, value interface{}) (LockedRecord, 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 ¶
Click to show internal directories.
Click to hide internal directories.