database

package
v0.0.0-...-b221635 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DBVersion is the latest version of the database that is understood by the
	// program. Databases with recorded versions higher than this will fail to
	// open (meaning any upgrades prevent reverting to older software).
	DBVersion = initialVersion
)

Variables

View Source
var (
	// PoolBkt is the main bucket of mining pool, all other buckets
	// are nested within it.
	PoolBkt = []byte("poolbkt")

	// AccountBkt stores all registered accounts for the mining pool.
	AccountBkt = []byte("accountbkt")

	// ShareBkt stores all client shares for the mining pool.
	ShareBkt = []byte("sharebkt")

	// JobBkt stores jobs delivered to clients, it is periodically pruned by the
	// current chain tip height.
	JobBkt = []byte("jobbkt")

	// WorkBkt stores work submissions from pool clients and confirmed mined
	// work from the pool, it is periodically pruned by the current chain tip
	// adjusted by the max reorg height and by chain reorgs.
	WorkBkt = []byte("workbkt")

	// PaymentBkt stores all payments.
	PaymentBkt = []byte("paymentbkt")

	// PaymentArchiveBkt stores all processed payments for auditing purposes.
	PaymentArchiveBkt = []byte("paymentarchivebkt")

	// VersionK is the key of the current version of the database.
	VersionK = []byte("version")

	// LastPaymentCreatedOn is the key of the last time a payment was
	// persisted.
	LastPaymentCreatedOn = []byte("lastpaymentcreatedon")

	// LastPaymentPaidOn is the key of the last time a payment was
	// paid.
	LastPaymentPaidOn = []byte("lastpaymentpaidon")

	// LastPaymentHeight is the key of the last payment height.
	LastPaymentHeight = []byte("lastpaymentheight")

	// TxFeeReserve is the key of the tx fee reserve.
	TxFeeReserve = []byte("txfeereserve")

	// SoloPool is the solo pool mode key.
	SoloPool = []byte("solopool")

	// CSRFSecret is the CSRF secret key.
	CSRFSecret = []byte("csrfsecret")
)

Functions

func Backup

func Backup(db *bolt.DB) error

Backup saves a copy of the db to file.

func CreateBuckets

func CreateBuckets(db *bolt.DB) error

CreateBuckets creates all storage buckets of the mining pool.

func Delete

func Delete(db *bolt.DB, bucket, key []byte) error

Delete removes the specified key and its associated value from the provided bucket.

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func ErrBucketNotFound

func ErrBucketNotFound(bucket []byte) error

ErrBucketNotFound is returned when a provided database bucket cannot be found.

func ErrValueNotFound

func ErrValueNotFound(key []byte) error

ErrValueNotFound is returned when a provided database key does not map to any value.

func OpenDB

func OpenDB(storage string) (*bolt.DB, error)

OpenDB creates a connection to the provided bolt storage, the returned connection storage should always be closed after use.

func Purge

func Purge(db *bolt.DB) error

Purge removes all existing data and recreates the db.

func Upgrade

func Upgrade(db *bolt.DB) error

Upgrade checks whether the any upgrades are necessary before the database is ready for application usage. If any are, they are performed.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

This section is empty.

Jump to

Keyboard shortcuts

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