db

package
v0.0.0-...-67d7764 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db implements interfaces to different database types and provides specification of BlockstackDB and DB operations, such that any new database can be used as long as it implements those methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockstackDB

type BlockstackDB interface {
	DB

	GetNames() (map[string]map[string]bool, error)
	GetNamesAt(t time.Time) (map[string]map[string]bool, error)
	PutNames(names map[string]map[string]bool) error
	PutNamesAt(names map[string]map[string]bool, t time.Time) error
}

BlockstackDB provides interface for Blockstack related operations

func New

func New() (BlockstackDB, error)

New attempts to instantiate a new database instance using the configuration variables provided.

func NewBadgerDB

func NewBadgerDB(path string) (BlockstackDB, error)

NewBadgerDB instantiates and returns a Badger DB instance based on the provided path. If one or more directories don't exist, it will attempt to create them, and returns an error if any occur.

func NewBoltDB

func NewBoltDB(path string) (BlockstackDB, error)

NewBoltDB instantiates and returns a Bolt DB instance based on the provided path. If one or more directories don't exist, it will attempt to create them, and returns an error if any occur.

type DB

type DB interface {
	Shutdown() error
}

DB interface enforces Shutdown method, which may be required for certain databases to ensure persistence of all operations (e.g. flushing to disk from memory), and is useful if signal is sent to application to gracefully terminate

Directories

Path Synopsis
package badger implements database operations for BadgerDB
package badger implements database operations for BadgerDB
package bolt implements operations using Bolt as the underlying database
package bolt implements operations using Bolt as the underlying database

Jump to

Keyboard shortcuts

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