Documentation ¶
Overview ¶
Package badger3 provides a configurable BadgerDB v3 go-datastore for use with IPFS Cluster.
Index ¶
- Constants
- Variables
- func Cleanup(cfg *Config) error
- func New(cfg *Config) (ds.Datastore, error)
- type Config
- func (cfg *Config) ApplyEnvVars() error
- func (cfg *Config) ConfigKey() string
- func (cfg *Config) Default() error
- func (cfg *Config) GetFolder() string
- func (cfg *Config) LoadJSON(raw []byte) error
- func (cfg *Config) ToDisplayJSON() ([]byte, error)
- func (cfg *Config) ToJSON() (raw []byte, err error)
- func (cfg *Config) Validate() error
Constants ¶
View Source
const (
DefaultSubFolder = "badger3"
)
Default values for badger Config
Variables ¶
View Source
var ( // DefaultBadgerOptions has to be a var because badger.DefaultOptions // is. Values are customized during Init(). DefaultBadgerOptions badger.Options // DefaultGCDiscardRatio for GC operations. See Badger docs. DefaultGCDiscardRatio float64 = 0.2 // DefaultGCInterval specifies interval between GC cycles. DefaultGCInterval time.Duration = 15 * time.Minute // DefaultGCSleep specifies sleep time between GC rounds. DefaultGCSleep time.Duration = 10 * time.Second )
Functions ¶
Types ¶
type Config ¶
type Config struct { config.Saver // The folder for this datastore. Non-absolute paths are relative to // the base configuration folder. Folder string // For GC operation. See Badger documentation. GCDiscardRatio float64 // Interval between GC cycles. Each GC cycle runs one or more // rounds separated by GCSleep. GCInterval time.Duration // Time between rounds in a GC cycle GCSleep time.Duration BadgerOptions badger.Options }
Config is used to initialize a BadgerDB datastore. It implements the ComponentConfig interface.
func (*Config) ApplyEnvVars ¶
ApplyEnvVars fills in any Config fields found as environment variables.
func (*Config) ConfigKey ¶
ConfigKey returns a human-friendly identifier for this type of Datastore.
func (*Config) LoadJSON ¶
LoadJSON reads the fields of this Config from a JSON byteslice as generated by ToJSON.
func (*Config) ToDisplayJSON ¶
ToDisplayJSON returns JSON config as a string.
Click to show internal directories.
Click to hide internal directories.