boltdb

package
v2.3.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "boltdb"

Variables

This section is empty.

Functions

func NewBoltDBDriver

func NewBoltDBDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (kv.Storage, error)

Types

type Config

type Config struct {
	// Dir is a directory to store the DB files
	Dir string
	// File is boltDB file. No need to create it by your own,
	// boltdb driver is able to create the file, or read existing
	File string
	// Bucket to store data in boltDB
	Bucket string
	// db file permissions
	Permissions int
	// timeout
	Interval uint `mapstructure:"interval"`
}

func (*Config) InitDefaults

func (s *Config) InitDefaults()

InitDefaults initializes default values for the boltdb

type Driver

type Driver struct {
	// db instance
	DB *bolt.DB
	// contains filtered or unexported fields
}

func (*Driver) Delete

func (d *Driver) Delete(keys ...string) error

Delete all keys from DB

func (*Driver) Get

func (d *Driver) Get(key string) ([]byte, error)

Get retrieves the value for a key in the bucket. Returns a nil value if the key does not exist or if the key is a nested bucket. The returned value is only valid for the life of the transaction.

func (*Driver) Has

func (d *Driver) Has(keys ...string) (map[string]bool, error)

func (*Driver) MExpire

func (d *Driver) MExpire(items ...kv.Item) error

MExpire sets the expiration time to the key If key already has the expiration time, it will be overwritten

func (*Driver) MGet

func (d *Driver) MGet(keys ...string) (map[string]interface{}, error)

func (*Driver) Set

func (d *Driver) Set(items ...kv.Item) error

Set puts the K/V to the bolt

func (*Driver) TTL

func (d *Driver) TTL(keys ...string) (map[string]interface{}, error)

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin BoltDB K/V storage.

func (*Plugin) Available added in v2.2.0

func (s *Plugin) Available()

Available interface implementation

func (*Plugin) Init

func (s *Plugin) Init(log logger.Logger, cfg config.Configurer) error

func (*Plugin) Name

func (s *Plugin) Name() string

Name returns plugin name

func (*Plugin) Provide

func (s *Plugin) Provide(key string) (kv.Storage, error)

func (*Plugin) Serve

func (s *Plugin) Serve() chan error

Serve is noop here

func (*Plugin) Stop

func (s *Plugin) Stop() error

Jump to

Keyboard shortcuts

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