package store

import "src.elv.sh/pkg/store"

Package store defines the permanent storage service.

Index

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

var ErrNoSharedVar = errors.New("no such shared variable")

ErrNoSharedVar is returned by Store.SharedVar when there is no such variable.

type DBStore

type DBStore interface {
    Store
    Close() error
}

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 store. To prevent bad things from happening, every time the main goroutine spawns a new goroutine to operate on the store, it should call wg.Add(1) in the main goroutine before spawning another goroutine, and call wg.Done() in the spawned goroutine after the operation is finished.

func MustTempStore

func MustTempStore(c testutil.Cleanuper) DBStore

MustTempStore returns a Store backed by a temporary file for testing. The Store and its underlying file will be cleaned up properly after the test is finished.

func NewStore

func NewStore(dbname string) (DBStore, error)

NewStore creates a new Store from the given file.

func NewStoreFromDB

func NewStoreFromDB(db *bolt.DB) (DBStore, error)

NewStoreFromDB creates a new Store from a bolt DB.

Directories

PathSynopsis
pkg/store/storedefsPackage storedefs contains definitions of the store API.
pkg/store/storetestPackage storetest keeps test suites against storedefs.Store.

Package store imports 14 packages (graph).

Version v0.16.3 (latest) | Published Aug 28, 2021 | Platform: linux/amd64 | Updated 12 hours ago

.
Tools for package owners.