db

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ApplicationID int32 = 0x0FA7D000
View Source
const (

	// TODO: expose this as flag
	PoolSize = 2
)

Variables

This section is empty.

Functions

func Close added in v1.1.0

func Close(conn *sqlite.Conn, pool *sqlitex.Pool) error

Close all database connections. Log any errors.

func OpenConnPool

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

OpenConnPool opens a Conn to the sqlite3 database at dbURI and performs a number of checks and operations to ensure that the Conn is ready for use. The Interrupt on the Conn is set to ctx.Done().

If the Conn is successfully initialized a read-only Pool will be opened on the same database.

The caller is responsible for closing conn and pool if err is not nil.

Types

type FATChain added in v1.1.0

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

	// General Factom Blockchain Data
	FactomChain
}

func NewFATChain added in v1.1.0

func NewFATChain(ctx context.Context, dbPath, tokenID string,
	chainID, issuerChainID *factom.Bytes32,
	networkID factom.NetworkID) (_ FATChain, err error)

func OpenAllFATChains added in v1.1.0

func OpenAllFATChains(ctx context.Context, dbPath string) (chains []FATChain, err error)

func OpenFATChain added in v1.1.0

func OpenFATChain(ctx context.Context,
	dbPath, fname string) (chain FATChain, err error)

func (*FATChain) AddNumIssued added in v1.1.0

func (chain *FATChain) AddNumIssued(add uint64) error

type FactomChain added in v1.1.0

type FactomChain struct {
	ID          *factom.Bytes32
	Head        factom.EBlock
	HeadDBKeyMR *factom.Bytes32
	NetworkID   factom.NetworkID
	SyncHeight  uint32
	SyncDBKeyMR *factom.Bytes32

	DBFile   string
	Conn     *sqlite.Conn  // Read/Write
	Pool     *sqlitex.Pool // Read Only Pool
	CloseMtx trylock.TryLocker

	Log _log.Log
}

func NewFactomChain added in v1.1.0

func NewFactomChain(ctx context.Context,
	dbPath string, chainID *factom.Bytes32,
	networkID factom.NetworkID) (_ FactomChain, err error)

func OpenFactomChain added in v1.1.0

func OpenFactomChain(ctx context.Context,
	dbPath, fname string) (_ FactomChain, err error)

func (*FactomChain) Close added in v1.1.0

func (chain *FactomChain) Close() error

Close all database connections. Log any errors.

func (*FactomChain) LatestEntryTimestamp added in v1.1.0

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

func (*FactomChain) SetSync added in v1.1.0

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

Directories

Path Synopsis
Package address provides functions and SQL framents for working with the "address" table, which stores factom.FAAddress with its balance.
Package address provides functions and SQL framents for working with the "address" table, which stores factom.FAAddress with its balance.
Package eblock provides functions and SQL framents for working with the "eblock" table, which stores factom.EBlock.
Package eblock provides functions and SQL framents for working with the "eblock" table, which stores factom.EBlock.
Package entry provides functions and SQL framents for working with the "entry" table, which stores factom.Entry with a valid flag.
Package entry provides functions and SQL framents for working with the "entry" table, which stores factom.Entry with a valid flag.
Package metadata provides functions and SQL fragments for working with the "factom_chain" and "fat_chain" metadata tables, which store the sync height, sync DBKeyMR, factom.NetworkID, and factom.Identity.
Package metadata provides functions and SQL fragments for working with the "factom_chain" and "fat_chain" metadata tables, which store the sync height, sync DBKeyMR, factom.NetworkID, and factom.Identity.
Package nftoken provides functions and SQL framents for working with the "nftoken" table, which stores fat.NFToken with owner, creation id, and metadata.
Package nftoken provides functions and SQL framents for working with the "nftoken" 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