localstore

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverReader

func DiscoverReader(root string, opts DiscoverOptions) (Reader, []StoreCandidate, error)

DiscoverReader finds the best supported discovered candidate and opens a reader for it.

func ExplainCandidate

func ExplainCandidate(candidate StoreCandidate) string

func PotentialFutureAdapter

func PotentialFutureAdapter(candidate StoreCandidate) bool

Types

type CandidateKind

type CandidateKind string
const (
	KindUnknown   CandidateKind = "unknown"
	KindSQLite    CandidateKind = "sqlite"
	KindLevelDB   CandidateKind = "leveldb"
	KindIndexedDB CandidateKind = "indexeddb"
)

type CandidateSource

type CandidateSource string
const (
	SourceExplicit CandidateSource = "flag"
	SourceEnv      CandidateSource = "env"
	SourceDefault  CandidateSource = "default"
	SourceConfig   CandidateSource = "config"
	SourceGlob     CandidateSource = "glob"
)

type DiscoverOptions

type DiscoverOptions struct {
	ExplicitPath string
	EnvPath      string
	DefaultPaths []string
	ConfigPaths  []string
	SearchRoots  []string
	MaxResults   int
	SkipSearch   bool
}

type InspectableReader

type InspectableReader interface {
	Reader
	Capabilities() ReaderCapabilities
	Inspect() (ReaderInspection, error)
}

type Reader

type Reader interface {
	Candidate() StoreCandidate
	OpenStore(opts db.StoreOptions) (*db.Store, error)
}

Reader abstracts a readable local store implementation. SQLite is the only concrete reader for now.

func OpenReader

func OpenReader(candidate StoreCandidate) (Reader, error)

OpenReader instantiates a reader for a discovered local-store candidate.

type ReaderCapabilities

type ReaderCapabilities struct {
	InspectableMetadata bool `json:"inspectable_metadata"`
	KeyValueAccess      bool `json:"key_value_access"`
	SQLiteStore         bool `json:"sqlite_store"`
}

type ReaderInspection

type ReaderInspection struct {
	Kind       CandidateKind     `json:"kind"`
	KeyCount   int               `json:"key_count,omitempty"`
	SampleKeys []string          `json:"sample_keys,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
}

type StoreCandidate

type StoreCandidate struct {
	Path       string          `json:"path"`
	Kind       CandidateKind   `json:"kind"`
	Source     CandidateSource `json:"source"`
	Confidence int             `json:"confidence"`
	Supported  bool            `json:"supported"`
}

func Discover

func Discover(root string, opts DiscoverOptions) ([]StoreCandidate, error)

func ResolveCandidate

func ResolveCandidate(root string, opts DiscoverOptions) (StoreCandidate, error)

ResolveCandidate finds the best supported discovered candidate.

Jump to

Keyboard shortcuts

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