Documentation ¶
Overview ¶
Package store defines the permanent storage service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoMatchingCmd = errors.New("no matching command line")
ErrNoMatchingCmd is the error returned when a LastCmd or FirstCmd query completes with no result.
ErrNoSharedVar is returned by Store.SharedVar when there is no such variable.
var NoBlacklist = map[string]struct{}{}
NoBlacklist is an empty blacklist, to be used in GetDirs.
Functions ¶
This section is empty.
Types ¶
type DBStore ¶
DBStore is the permanent storage backend for elvish. It is not thread-safe. In particular, the store may be closed while another goroutine is still accessing the To prevent bad things from happening, every time the main goroutine spawns a new goroutine to operate on the store, it should call Waits.Add(1) in the main goroutine before spawning another goroutine, and call Waits.Done() in the spawned goroutine after the operation is finished.
func MustGetTempStore ¶
func MustGetTempStore() (DBStore, func())
MustGetTempStore returns a Store backed by a temporary file, and a cleanup function that should be called when the Store is no longer used.
type Store ¶
type Store interface { NextCmdSeq() (int, error) AddCmd(text string) (int, error) DelCmd(seq int) error Cmd(seq int) (string, error) Cmds(from, upto int) ([]string, error) CmdsWithSeq(from, upto int) ([]Cmd, error) NextCmd(from int, prefix string) (Cmd, error) PrevCmd(upto int, prefix string) (Cmd, error) AddDir(dir string, incFactor float64) error DelDir(dir string) error Dirs(blacklist map[string]struct{}) ([]Dir, error) }
Store is an interface satisfied by the storage service.