store

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package store defines the permanent storage service.

Index

Constants

View Source
const (
	DirScoreDecay     = 0.986 // roughly 0.5^(1/50)
	DirScoreIncrement = 10
	DirScorePrecision = 6
)

Parameters for directory history scores.

Variables

This section is empty.

Functions

This section is empty.

Types

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

Path Synopsis
Package storedefs contains definitions of the store API.
Package storedefs contains definitions of the store API.
Package storetest keeps test suites against storedefs.Store.
Package storetest keeps test suites against storedefs.Store.

Jump to

Keyboard shortcuts

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