db

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PoolSize = 10
)

Variables

This section is empty.

Functions

func OpenConnPool

func OpenConnPool(ctx context.Context, dbURI string) (
	conn *sqlite.Conn, pool *sqlitex.Pool, err error)

Types

type Chain

type Chain struct {
	// General Factom Blockchain Data
	ID          *factom.Bytes32
	Head        factom.EBlock
	HeadDBKeyMR *factom.Bytes32
	NetworkID   factom.NetworkID
	SyncHeight  uint32
	SyncDBKeyMR *factom.Bytes32

	// FAT Specific Data
	TokenID       string
	IssuerChainID *factom.Bytes32
	Identity      factom.Identity
	Issuance      fat.Issuance
	NumIssued     uint64

	DBFile string
	Conn   *sqlite.Conn  // Read/Write
	Pool   *sqlitex.Pool // Read Only Pool
	Log    _log.Log
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, dbPath, fname string) (chain Chain, err error)

func OpenAll

func OpenAll(ctx context.Context, dbPath string) (chains []Chain, err error)

func OpenNew

func OpenNew(ctx context.Context, dbPath string,
	dbKeyMR *factom.Bytes32, eb factom.EBlock, networkID factom.NetworkID,
	identity factom.Identity) (chain Chain, err error)

dbPath must be path ending in os.Separator

func (*Chain) Apply

func (chain *Chain) Apply(dbKeyMR *factom.Bytes32, eb factom.EBlock) (err error)

func (*Chain) ApplyEntry

func (chain *Chain) ApplyEntry(e factom.Entry) (txErr, err error)

func (*Chain) ApplyFAT0Tx

func (chain *Chain) ApplyFAT0Tx(ei int64, e factom.Entry) (tx fat0.Transaction,
	txErr, err error)

func (*Chain) ApplyFAT1Tx

func (chain *Chain) ApplyFAT1Tx(ei int64, e factom.Entry) (tx fat1.Transaction,
	txErr, err error)

func (*Chain) Close

func (chain *Chain) Close()

Close all database connections. Log any errors.

func (*Chain) LatestEntryTimestamp

func (chain *Chain) LatestEntryTimestamp() time.Time

func (*Chain) Save

func (chain *Chain) Save() func(txErr, err *error)

func (*Chain) SetSync

func (chain *Chain) SetSync(height uint32, dbKeyMR *factom.Bytes32) error

func (Chain) Validate

func (chain Chain) Validate() (err error)

Validate all Entry Hashes and EBlock KeyMRs, as well as the continuity of all stored EBlocks and Entries.

This does not validate the validity of the saved DBlock KeyMRs.

Directories

Path Synopsis
Package addresses provides functions and SQL framents for working with the "addresses" table, which stores factom.FAAddress with its balance.
Package addresses provides functions and SQL framents for working with the "addresses" table, which stores factom.FAAddress with its balance.
Package eblocks provides functions and SQL framents for working with the "eblocks" table, which stores factom.EBlock.
Package eblocks provides functions and SQL framents for working with the "eblocks" table, which stores factom.EBlock.
Package entries provides functions and SQL framents for working with the "entries" table, which stores factom.Entry with a valid flag.
Package entries provides functions and SQL framents for working with the "entries" table, which stores factom.Entry with a valid flag.
Package metadata provides functions and SQL framents for working with the "metadata" table, which stores the sync height, sync DBKeyMR, factom.NetworkID, and factom.Identity.
Package metadata provides functions and SQL framents for working with the "metadata" table, which stores the sync height, sync DBKeyMR, factom.NetworkID, and factom.Identity.
Package nftokens provides functions and SQL framents for working with the "nf_tokens" table, which stores fat.NFToken with owner, creation id, and metadata.
Package nftokens provides functions and SQL framents for working with the "nf_tokens" table, which stores fat.NFToken with owner, creation id, and metadata.

Jump to

Keyboard shortcuts

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