package store
import "src.elv.sh/pkg/store"
Package store defines the permanent storage service.
Index ¶
- Constants
- Variables
- type Cmd
- type DBStore
- func MustGetTempStore() (DBStore, func())
- func NewStore(dbname string) (DBStore, error)
- func NewStoreFromDB(db *bolt.DB) (DBStore, error)
- type Dir
- type Store
Package Files ¶
buckets.go cmd.go db_store.go dir.go shared_var.go store.go temp_store.go
Constants ¶
const ( DirScoreDecay = 0.986 // roughly 0.5^(1/50) DirScoreIncrement = 10 DirScorePrecision = 6 )
Parameters for directory history scores.
Variables ¶
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.
NoBlacklist is an empty blacklist, to be used in GetDirs.
type Cmd ¶
Cmd is an entry in the command history.
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 ¶
MustGetTempStore returns a Store backed by a temporary file, and a cleanup function that should be called when the Store is no longer used.
func NewStore ¶
NewStore creates a new Store from the given file.
func NewStoreFromDB ¶
NewStoreFromDB creates a new Store from a bolt DB.
type Dir ¶
Dir is an entry in the directory history.
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) (name string) (string, error) (name, value string) error (name string) error }
Store is an interface satisfied by the storage service.
Package store imports 12 packages (graph) and is imported by 5 packages. Updated 1 month ago.
Tools for package owners.