indexer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIterClose = errors.New("iter closed")

Functions

This section is empty.

Types

type DataIndex

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

DataIndex creates an index that allows datastores to be indexed by the specified owner and index of the datastore

func NewDataIndex

func NewDataIndex(p, pp prefixFunc) *DataIndex

NewDataIndex creates a new dataIndex object

func (*DataIndex) Add

func (di *DataIndex) Add(txn *badger.Txn, utxoID []byte, owner *objs.Owner, dataIndex []byte) error

Add adds an item to the index

func (*DataIndex) AddFastSync

func (di *DataIndex) AddFastSync(txn *badger.Txn, utxoID []byte, owner *objs.Owner, dataIndex []byte) error

AddFastSync adds an item to the index and overwrites previous data if it is present

func (*DataIndex) Contains

func (di *DataIndex) Contains(txn *badger.Txn, owner *objs.Owner, dataIndex []byte) (bool, error)

Contains determines whether or not the value at dataIndex is present

func (*DataIndex) Drop

func (di *DataIndex) Drop(txn *badger.Txn, utxoID []byte) error

Drop removes a utxoID from the index

func (*DataIndex) GetUTXOID

func (di *DataIndex) GetUTXOID(txn *badger.Txn, owner *objs.Owner, dataIndex []byte) ([]byte, error)

GetUTXOID returns the UTXOID of a datastore based on owner and index

func (*DataIndex) PaginateDataStores

func (di *DataIndex) PaginateDataStores(txn *badger.Txn, owner *objs.Owner, num int, startIndex []byte, exclude map[string]bool) ([]*objs.PaginationResponse, error)

PaginateDataStores returns utxoIDs for owner below specified num

type DataIndexKey

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

func (*DataIndexKey) MarshalBinary

func (dik *DataIndexKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*DataIndexKey) UnmarshalBinary

func (dik *DataIndexKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type DataIndexRefKey

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

func (*DataIndexRefKey) MarshalBinary

func (dirk *DataIndexRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*DataIndexRefKey) UnmarshalBinary

func (dirk *DataIndexRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type EpochConstrainedList

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

EpochConstrainedList creates an index that allows objects to be dropped by epoch

func NewEpochConstrainedIndex

func NewEpochConstrainedIndex(p, pp prefixFunc) *EpochConstrainedList

func (*EpochConstrainedList) Append

func (ecl *EpochConstrainedList) Append(txn *badger.Txn, epoch uint32, txHash []byte) error

Append adds an item to the list

func (*EpochConstrainedList) Drop

func (ecl *EpochConstrainedList) Drop(txn *badger.Txn, txHash []byte) error

func (*EpochConstrainedList) DropBefore

func (ecl *EpochConstrainedList) DropBefore(txn *badger.Txn, epoch uint32) ([][]byte, error)

DropBefore returns a list of all txHashes that should be dropped

func (*EpochConstrainedList) GetEpoch

func (ecl *EpochConstrainedList) GetEpoch(txn *badger.Txn, txHash []byte) (uint32, error)

type EpochConstrainedListKey

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

func (*EpochConstrainedListKey) MarshalBinary

func (eclk *EpochConstrainedListKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*EpochConstrainedListKey) UnmarshalBinary

func (eclk *EpochConstrainedListKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type EpochConstrainedListRefKey

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

func (*EpochConstrainedListRefKey) MarshalBinary

func (eclrk *EpochConstrainedListRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*EpochConstrainedListRefKey) UnmarshalBinary

func (eclrk *EpochConstrainedListRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type ExpSizeIndex

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

ExpSizeIndex creates an index that allows objects to be dropped by epoch

func NewExpSizeIndex

func NewExpSizeIndex(p, pp prefixFunc) *ExpSizeIndex

func (*ExpSizeIndex) Add

func (esi *ExpSizeIndex) Add(txn *badger.Txn, epoch uint32, utxoID []byte, size uint32) error

func (*ExpSizeIndex) Drop

func (esi *ExpSizeIndex) Drop(txn *badger.Txn, utxoID []byte) error

func (*ExpSizeIndex) GetExpiredObjects

func (esi *ExpSizeIndex) GetExpiredObjects(txn *badger.Txn, epoch uint32, maxBytes uint32) ([][]byte, uint32)

type ExpSizeIndexKey

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

func (*ExpSizeIndexKey) MarshalBinary

func (esik *ExpSizeIndexKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*ExpSizeIndexKey) UnmarshalBinary

func (esik *ExpSizeIndexKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type ExpSizeIndexRefKey

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

func (*ExpSizeIndexRefKey) MarshalBinary

func (esirk *ExpSizeIndexRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*ExpSizeIndexRefKey) UnmarshalBinary

func (esirk *ExpSizeIndexRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type HeightIdxIndex

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

func NewHeightIdxIndex

func NewHeightIdxIndex(p, pp prefixFunc) *HeightIdxIndex

func (*HeightIdxIndex) Add

func (hii *HeightIdxIndex) Add(txn *badger.Txn, txHash []byte, height uint32, idx uint32) error

func (*HeightIdxIndex) Delete

func (hii *HeightIdxIndex) Delete(txn *badger.Txn, txHash []byte) error

func (*HeightIdxIndex) GetHeightIdx

func (hii *HeightIdxIndex) GetHeightIdx(txn *badger.Txn, txHash []byte) (uint32, uint32, error)

func (*HeightIdxIndex) GetTxHashFromHeightIdx

func (hii *HeightIdxIndex) GetTxHashFromHeightIdx(txn *badger.Txn, height uint32, idx uint32) ([]byte, error)

type HeightIdxIndexKey

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

func (*HeightIdxIndexKey) MarshalBinary

func (hiik *HeightIdxIndexKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*HeightIdxIndexKey) UnmarshalBinary

func (hiik *HeightIdxIndexKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type HeightIdxIndexRefKey

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

func (*HeightIdxIndexRefKey) MarshalBinary

func (hiirk *HeightIdxIndexRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*HeightIdxIndexRefKey) UnmarshalBinary

func (hiirk *HeightIdxIndexRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type InsertionOrderIndexer

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

func NewInsertionOrderIndex

func NewInsertionOrderIndex(p, pp prefixFunc) *InsertionOrderIndexer

func (*InsertionOrderIndexer) Add

func (ioi *InsertionOrderIndexer) Add(txn *badger.Txn, txHash []byte) error

func (*InsertionOrderIndexer) Delete

func (ioi *InsertionOrderIndexer) Delete(txn *badger.Txn, txHash []byte) error

func (*InsertionOrderIndexer) NewIter

func (ioi *InsertionOrderIndexer) NewIter(txn *badger.Txn) (*badger.Iterator, []byte)

type InsertionOrderIndexerKey

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

func (*InsertionOrderIndexerKey) MarshalBinary

func (ioik *InsertionOrderIndexerKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*InsertionOrderIndexerKey) UnmarshalBinary

func (ioik *InsertionOrderIndexerKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type InsertionOrderIndexerRevKey

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

func (*InsertionOrderIndexerRevKey) MarshalBinary

func (ioirk *InsertionOrderIndexerRevKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*InsertionOrderIndexerRevKey) UnmarshalBinary

func (ioirk *InsertionOrderIndexerRevKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type RefCounter

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

func NewRefCounter

func NewRefCounter(p prefixFunc) *RefCounter

func (*RefCounter) Decrement

func (rc *RefCounter) Decrement(txn *badger.Txn, txHash []byte) (int64, error)

func (*RefCounter) Increment

func (rc *RefCounter) Increment(txn *badger.Txn, txHash []byte) (int64, error)

type RefCounterKey

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

func (*RefCounterKey) MarshalBinary

func (rck *RefCounterKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*RefCounterKey) UnmarshalBinary

func (rck *RefCounterKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type RefLinker

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

func NewRefLinkerIndex

func NewRefLinkerIndex(p, pp, ppp prefixFunc) *RefLinker

func (*RefLinker) Add

func (rl *RefLinker) Add(txn *badger.Txn, txHash []byte, utxoIDs [][]byte) (bool, [][]byte, error)

func (*RefLinker) Delete

func (rl *RefLinker) Delete(txn *badger.Txn, txHash []byte) error

func (*RefLinker) DeleteMined

func (rl *RefLinker) DeleteMined(txn *badger.Txn, txHash []byte) ([][]byte, [][]byte, error)

type RefLinkerRefKey

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

func (*RefLinkerRefKey) MarshalBinary

func (rlrk *RefLinkerRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*RefLinkerRefKey) UnmarshalBinary

func (rlrk *RefLinkerRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

type RefLinkerRevRefKey

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

func (*RefLinkerRevRefKey) MarshalBinary

func (rlrrk *RefLinkerRevRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*RefLinkerRevRefKey) UnmarshalBinary

func (rlrrk *RefLinkerRevRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

func (*RefLinkerRevRefKey) XXXIsKey

func (rlrrk *RefLinkerRevRefKey) XXXIsKey()

type ValueIndex

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

ValueIndex creates an index that allows objects to be dropped by epoch

func NewValueIndex

func NewValueIndex(p, pp prefixFunc) *ValueIndex

func (*ValueIndex) Add

func (vi *ValueIndex) Add(txn *badger.Txn, utxoID []byte, owner *objs.Owner, valueOrig *uint256.Uint256) error

Add adds an item to the list

func (*ValueIndex) Drop

func (vi *ValueIndex) Drop(txn *badger.Txn, utxoID []byte) error

Drop returns a list of all txHashes that should be dropped

func (*ValueIndex) GetValueForOwner

func (vi *ValueIndex) GetValueForOwner(txn *badger.Txn, owner *objs.Owner, minValue *uint256.Uint256, exclude [][]byte) ([][]byte, *uint256.Uint256, error)

type ValueIndexKey

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

func (*ValueIndexKey) MarshalBinary

func (vik *ValueIndexKey) MarshalBinary() []byte

func (*ValueIndexKey) UnmarshalBinary

func (vik *ValueIndexKey) UnmarshalBinary(data []byte)

type ValueIndexRefKey

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

func (*ValueIndexRefKey) MarshalBinary

func (virk *ValueIndexRefKey) MarshalBinary() []byte

MarshalBinary returns the byte slice for the key object

func (*ValueIndexRefKey) UnmarshalBinary

func (virk *ValueIndexRefKey) UnmarshalBinary(data []byte)

UnmarshalBinary takes in a byte slice to set the key object

Jump to

Keyboard shortcuts

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