transform

package
v0.0.2-0...-d05d5d5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NilObjectType string = "nil"
)

Variables

This section is empty.

Functions

func FindNextUnindexed

func FindNextUnindexed(ctx context.Context, startBlockNum uint64, possibleIndexSizes []uint64, shortName string, store dstore.Store) (next uint64)

func NewBlockIndex

func NewBlockIndex(lowBlockNum, indexSize uint64) *blockIndex

NewBlockIndex initializes and returns a new BlockIndex

func NewTestBlockIndex

func NewTestBlockIndex(lowBlockNum, indexSize uint64, kv map[string]*roaring64.Bitmap) *blockIndex

func ReadNewBlockIndex

func ReadNewBlockIndex(r io.ReadCloser) (*blockIndex, error)

ReadNewBlockIndex returns a new BlockIndex from a io.ReadCloser it does not set the lowBlockNum an indexSize

Types

type BitmapGetter

type BitmapGetter interface {
	Get(string) *roaring64.Bitmap
	GetByPrefixAndSuffix(prefix string, suffix string) *roaring64.Bitmap
}

type BlockIndexer

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

BlockIndexer creates and performs I/O operations on index files

func NewBlockIndexer

func NewBlockIndexer(store dstore.Store, indexSize uint64, indexShortname string, opts ...Option) *BlockIndexer

NewBlockIndexer initializes and returns a new BlockIndexer

func (*BlockIndexer) Add

func (i *BlockIndexer) Add(keys []string, blockNum uint64)

Add will populate the BlockIndexer's currentIndex by adding the specified BlockNum to the bitmaps identified with the provided keys

func (*BlockIndexer) String

func (i *BlockIndexer) String() string

String returns a summary of the current BlockIndexer

type BlockMetadata

type BlockMetadata struct {
	Ref       bstream.BlockRef
	ParentRef bstream.BlockRef
	LibNum    uint64
	Timestamp time.Time
}

type Factory

type Factory struct {
	Obj     proto.Message
	NewFunc func(message *anypb.Any) (Transform, error)
}

type GenericBlockIndexProvider

type GenericBlockIndexProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

GenericBlockIndexProvider responds to queries on BlockIndex

func NewGenericBlockIndexProvider

func NewGenericBlockIndexProvider(
	store dstore.Store,
	indexShortname string,
	possibleIndexSizes []uint64,
	filterFunc func(BitmapGetter) []uint64,
) *GenericBlockIndexProvider

NewGenericBlockIndexProvider initializes and returns a new GenericBlockIndexProvider

func (*GenericBlockIndexProvider) BlocksInRange

func (ip *GenericBlockIndexProvider) BlocksInRange(baseBlock, bundleSize uint64) (out []uint64, err error)

type Input

type Input interface {
	Type() string
	Obj() proto.Message // Most of the time a `pbsol.Block` or `pbeth.Block`
}

type InputObj

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

func (*InputObj) Obj

func (i *InputObj) Obj() proto.Message

func (*InputObj) Type

func (i *InputObj) Type() string

type NilObj

type NilObj struct{}

func NewNilObj

func NewNilObj() *NilObj

func (*NilObj) Obj

func (n *NilObj) Obj() proto.Message

func (*NilObj) Type

func (n *NilObj) Type() string

type Option

type Option func(*BlockIndexer)

func WithDefinedStartBlock

func WithDefinedStartBlock(startBlock uint64) Option

func WithMaxAttempts

func WithMaxAttempts(attempts int) Option

func WithOpsTimeout

func WithOpsTimeout(timeout time.Duration) Option

type Output

type Output proto.Message

type PreprocessTransform

type PreprocessTransform interface {
	Transform(readOnlyBlk *pbbstream.Block, in Input) (Output, error)
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) BuildFromTransforms

func (r *Registry) BuildFromTransforms(anyTransforms []*anypb.Any) (
	bstream.PreprocessFunc,
	bstream.BlockIndexProvider,
	string,
	error,
)

BuildFromTransforms returns a PreprocessFunc, an optional BlockIndexProvider, a human-readable description and an error It will fail if it receives a transform of type Passthrough or a transform that does not match any interface

func (*Registry) New

func (r *Registry) New(message *anypb.Any) (Transform, error)

func (*Registry) Register

func (r *Registry) Register(f *Factory)

type Transform

type Transform interface {
	String() string
}

Jump to

Keyboard shortcuts

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