repository

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockNotFound   = errors.New("block not found")
	ErrNoBlocksHeaders = errors.New("no block headers in repository")
)
View Source
var ErrFilterNotFound = errors.New("filter not found")

Functions

This section is empty.

Types

type BlockHeaderRepository

type BlockHeaderRepository interface {
	// chain tip returns the best block header in the store
	ChainTip(context.Context) (*block.Header, error)
	GetBlockHeader(context.Context, chainhash.Hash) (*block.Header, error)
	GetBlockHashByHeight(context.Context, uint32) (*chainhash.Hash, error)
	WriteHeaders(context.Context, ...block.Header) error
	// LatestBlockLocator returns the block locator for the latest known tip as root of the locator
	LatestBlockLocator(context.Context) (blockchain.BlockLocator, error)
	HasAllAncestors(context.Context, chainhash.Hash) (bool, error)
}

type FilterEntry

type FilterEntry struct {
	Key    FilterKey
	NBytes []byte
}

FilterEntry is the base filter structure using to store filter data.

func NewFilterEntry

func NewFilterEntry(key FilterKey, filter *gcs.Filter) (*FilterEntry, error)

func (*FilterEntry) GcsFilter

func (f *FilterEntry) GcsFilter() (*gcs.Filter, error)

type FilterKey

type FilterKey struct {
	BlockHash  []byte
	FilterType FilterType
}

FilterKey is the unique key for a filter. for each possible key, the repository should store 1 unique filter

func (FilterKey) String

func (k FilterKey) String() string

type FilterRepository

type FilterRepository interface {
	PutFilter(context.Context, *FilterEntry) error
	GetFilter(context.Context, FilterKey) (*FilterEntry, error)
}

type FilterType

type FilterType byte
const (
	// RegularFilter is only filter type supported for now
	RegularFilter FilterType = iota
)

Jump to

Keyboard shortcuts

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