Documentation
¶
Index ¶
Constants ¶
View Source
const ( // EnvOpenProfile selects the TreeDB profile for downstream wrappers. EnvOpenProfile = "TREEDB_OPEN_PROFILE" // EnvKeepRecent overrides the wrapper's KeepRecent default. EnvKeepRecent = "TREEDB_KEEP_RECENT" // EnvMemtableMode overrides the wrapper's memtable mode. EnvMemtableMode = "TREEDB_MEMTABLE_MODE" )
Variables ¶
This section is empty.
Functions ¶
func ParseProfile
deprecated
func ParsePublicProfile ¶
ParsePublicProfile parses the public downstream profile vocabulary. Empty input falls back to fallback, but the fallback must also be a public profile.
func ResolveOptions ¶
func ResolveOptions(cfg OpenConfig) (treedb.Options, string, error)
ResolveOptions converts downstream wrapper defaults and standard TREEDB_* environment overrides into TreeDB Options.
Types ¶
type OpenConfig ¶
type OpenConfig struct {
ParentDir string
Name string
// AdapterName controls kvstore-facing Name() output.
AdapterName string
// DBFileSuffix defaults to ".db".
DBFileSuffix string
// DefaultProfile defaults to treedb.ProfileCommandWALRelaxed.
DefaultProfile treedb.Profile
// DefaultKeepRecent is applied when the env override is unset.
DefaultKeepRecent uint64
// DefaultMemtableMode applies when the env override is unset.
DefaultMemtableMode string
// DefaultAdaptiveMemtableBase maps an empty/adaptive profile default to
// adaptive:<base> when DefaultMemtableMode is unset.
DefaultAdaptiveMemtableBase string
// Environment keys default to the standard TREEDB_* names when empty.
ProfileEnvKey string
KeepRecentEnvKey string
MemtableModeEnvKey string
// ReadWorkers overrides adapter read worker count when > 0.
ReadWorkers int
}
OpenConfig standardizes the common "TreeDB behind a kvstore-style wrapper" open path used by downstream integrations such as cosmos-db/cometbft-db.
The intended usage is:
- Pick a TreeDB profile.
- Optionally pin a small KeepRecent window.
- Optionally allow an integration-specific memtable default/override.
- Open TreeDB and wrap it with the canonical kvstore adapter.
Click to show internal directories.
Click to hide internal directories.