keydb

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 7 Imported by: 2

Documentation

Overview

Package keydb implements a DB-based keypool storage backend.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is returned if trying to work with a closed DB connection
	ErrClosed = errors.New("spendbook: DB is closed")
)

Functions

func Add

func Add(kp *keypool.KeyPool, db interface{}) error

Add keyDB to keypool storage handlers

Types

type KeyDB

type KeyDB struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

KeyDB contains a key storage in sql database

func New

func New(db interface{}) (*KeyDB, error)

New returns a new spendbook. Takes an existing database handle or URL

func NewFromDB

func NewFromDB(db *sql.DB) (*KeyDB, error)

NewFromDB returns a KeyDB from an existing database handler

func NewFromURL

func NewFromURL(dburl string) (*KeyDB, error)

NewFromURL returns a KeyDB from a URL

func (*KeyDB) Add

func (kd *KeyDB) Add(kp *keypool.KeyPool) error

Add keyDB to keypool storage handlers

func (*KeyDB) Close

func (kd *KeyDB) Close()

Close the database

func (*KeyDB) Fetch

func (kd *KeyDB) Fetch(keyid []byte) (marshalledKey []byte, err error)

Fetch fetches keyid from the database and returns the marshalled key

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL