pgdbops

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ingester

type Ingester struct {
	// contains filtered or unexported fields
}

func NewIngester

func NewIngester(ctx context.Context, db *bun.DB, chain chainctx.IChainCtx, pageSize int) *Ingester

func (*Ingester) Flush

func (i *Ingester) Flush() error

func (*Ingester) StoreBlock

func (i *Ingester) StoreBlock(blockHash, actualMMRRoot chainhash.Hash, block *wire.MsgBlock) error

type PGIndexer

type PGIndexer struct {
	// contains filtered or unexported fields
}

PGIndexer provides an inmplentations of indexer that is managed by an index manager such as the Manager.

func NewIndexer

func NewIndexer(ctx context.Context, db *bun.DB, chain chainctx.IChainCtx) *PGIndexer

func (*PGIndexer) ConnectBlock

func (pgi *PGIndexer) ConnectBlock(_ database.Tx, block *jaxutil.Block,
	actualMMRRoot chainhash.Hash, _ []chaindata.SpentTxOut) error

ConnectBlock is invoked when a new block has been connected to the main chain. The set of output spent within a block is also passed in so indexers can access the pevious output scripts input spent if required.

func (*PGIndexer) Create

func (pgi *PGIndexer) Create(_ database.Tx) error

Create is invoked when the indexer manager determines the index needs to be created for the first time.

func (*PGIndexer) DisconnectBlock

func (pgi *PGIndexer) DisconnectBlock(_ database.Tx, block *jaxutil.Block, _ []chaindata.SpentTxOut) error

DisconnectBlock is invoked when a block has been disconnected from the main chain. The set of outputs scripts that were spent within this block is also returned so indexers can clean up the prior index state for this block

func (*PGIndexer) Init

func (pgi *PGIndexer) Init() error

Init is invoked when the index manager is first initializing the index. This differs from the Create method in that it is called on every load, including the case the index was just created.

func (*PGIndexer) Key

func (pgi *PGIndexer) Key() []byte

Key returns the key of the index as a byte slice.

func (*PGIndexer) Name

func (pgi *PGIndexer) Name() string

Name returns the human-readable name of the index.

type SerialBlockWriter

type SerialBlockWriter struct {
	// contains filtered or unexported fields
}

func NewSerialBlockWriter

func NewSerialBlockWriter(ctx context.Context, db *bun.DB, chain chainctx.IChainCtx) *SerialBlockWriter

func (*SerialBlockWriter) DisconnectBlock

func (sbw *SerialBlockWriter) DisconnectBlock(block string) error

func (*SerialBlockWriter) InitState

func (sbw *SerialBlockWriter) InitState() error

func (*SerialBlockWriter) StoreBlockToDB

func (sbw *SerialBlockWriter) StoreBlockToDB(block *wire.MsgBlock, actualMMR *chainhash.Hash) error

Jump to

Keyboard shortcuts

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