sktdb

package
v0.0.0-...-163fc3c Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DBFileCodeStr = "52A7AD74C4929DEC7B5C8D46CC3BAFA81FC96129283B3A6923CD12F41A30B3AC"

TODO compatible with multiple db prefix DoubleSHA256([]byte("MASSDB"))

Variables

View Source
var (
	ErrInvalidDBType        = errors.New("invalid sktdb type")
	ErrInvalidDBArgs        = errors.New("invalid sktdb args")
	ErrDBDoesNotExist       = errors.New("non-existent sktdb")
	ErrDBAlreadyExists      = errors.New("sktdb already exists")
	ErrDBCorrupted          = errors.New("sktdb corrupted")
	ErrUnimplemented        = errors.New("unimplemented sktdb interface")
	ErrUnsupportedBitLength = errors.New("unsupported bit length")
)
View Source
var (
	DBFileCode    []byte
	DBBackendList []DBBackend
)

Functions

func AddDBBackend

func AddDBBackend(ins DBBackend)

Types

type DBBackend

type DBBackend struct {
	Typ      string
	OpenDB   func(args ...interface{}) (SktDB, error)
	CreateDB func(args ...interface{}) (SktDB, error)
}

type SktDB

type SktDB interface {
	// Get type of SktDB
	Type() string

	// Close SktDB
	Close() error

	// Execute plotting on SktDB
	Plot() chan error

	// Stop plotting on SktDB
	StopPlot() chan error

	// Is SktDB loaded and plotted
	Ready() bool

	// Get bitLength of SktDB
	BitLength() int

	// Get PubKeyHash of SktDB
	PubKeyHash() pocutil.Hash

	// Get PubKey of SktDB
	PubKey() *pocec.PublicKey

	// Get assembled proof by challenge
	GetProof(challenge pocutil.Hash) (proof *poc.Proof, err error)

	// Get plot progress
	Progress() (prePlotted, plotted bool, progress float64)

	// Delete all data of SktDB
	Delete() chan error
}

func CreateDB

func CreateDB(dbType string, args ...interface{}) (SktDB, error)

func OpenDB

func OpenDB(dbType string, args ...interface{}) (SktDB, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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