ipfs-cluster: github.com/ipfs/ipfs-cluster/datastore/badger Index | Files

package badger

import "github.com/ipfs/ipfs-cluster/datastore/badger"

Package badger provides a configurable BadgerDB go-datastore for use with IPFS Cluster.


Package Files

badger.go config.go


const (
    DefaultSubFolder = "badger"

Default values for badger Config


var (
    // DefaultBadgerOptions has to be a var because badger.DefaultOptions
    // is. Values are customized during Init().
    DefaultBadgerOptions badger.Options

func Cleanup Uses

func Cleanup(cfg *Config) error

Cleanup deletes the badger datastore.

func New Uses

func New(cfg *Config) (ds.Datastore, error)

New returns a BadgerDB datastore configured with the given configuration.

type Config Uses

type Config struct {

    // The folder for this datastore. Non-absolute paths are relative to
    // the base configuration folder.
    Folder string

    BadgerOptions badger.Options

Config is used to initialize a BadgerDB datastore. It implements the ComponentConfig interface.

func (*Config) ApplyEnvVars Uses

func (cfg *Config) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*Config) ConfigKey Uses

func (cfg *Config) ConfigKey() string

ConfigKey returns a human-friendly identifier for this type of Datastore.

func (*Config) Default Uses

func (cfg *Config) Default() error

Default initializes this Config with sensible values.

func (*Config) GetFolder Uses

func (cfg *Config) GetFolder() string

GetFolder returns the BadgerDB folder.

func (*Config) LoadJSON Uses

func (cfg *Config) LoadJSON(raw []byte) error

LoadJSON reads the fields of this Config from a JSON byteslice as generated by ToJSON.

func (*Config) ToDisplayJSON Uses

func (cfg *Config) ToDisplayJSON() ([]byte, error)

ToDisplayJSON returns JSON config as a string.

func (*Config) ToJSON Uses

func (cfg *Config) ToJSON() (raw []byte, err error)

ToJSON generates a JSON-formatted human-friendly representation of this Config.

func (*Config) Validate Uses

func (cfg *Config) Validate() error

Validate checks that the fields of this Config have working values, at least in appearance.

Package badger imports 12 packages (graph) and is imported by 1 packages. Updated 2020-05-22. Refresh now. Tools for package owners.