Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultOptions(dir string) badger.Options
- type Chain
- type Codec
- type Library
- type Params
- type ReadLibrary
- type Reader
- type SafeDeque
- func (s *SafeDeque) Back() interface{}
- func (s *SafeDeque) Cap() int
- func (s *SafeDeque) Clear()
- func (s *SafeDeque) Front() interface{}
- func (s *SafeDeque) Len() int
- func (s *SafeDeque) PopBack() interface{}
- func (s *SafeDeque) PopFront() interface{}
- func (s *SafeDeque) PushBack(v interface{})
- func (s *SafeDeque) PushFront(v interface{})
- func (s *SafeDeque) Rotate(n int)
- func (s *SafeDeque) Set(i int, v interface{})
- func (s *SafeDeque) SetMinCapacity(cap uint)
- type Token
- type WriteLibrary
- type Writer
Constants ¶
const ( FlowBlockchain = "flow" FlowMainnet = flow.Mainnet FlowTestnet = flow.Testnet FlowLocalnet = flow.Localnet FlowSymbol = "FLOW" FlowDecimals = 8 StatusCompleted = "COMPLETED" OperationTransfer = "TRANSFER" )
Flow constant parameters.
Variables ¶
var ( ErrFinished = errors.New("finished") )
Sentinel errors.
var FlowParams = make(map[flow.ChainID]Params)
FlowParams is a map that contains the parameters for each known Flow chain.
Functions ¶
func DefaultOptions ¶
func DefaultOptions(dir string) badger.Options
DefaultOptions returns the default Badger options preferred by the DPS for its index database.
Types ¶
type Chain ¶
type Chain interface { Root() (uint64, error) Header(height uint64) (*flow.Header, error) Commit(height uint64) (flow.StateCommitment, error) Events(height uint64) ([]flow.Event, error) Collections(height uint64) ([]*flow.LightCollection, error) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error) Transactions(height uint64) ([]*flow.TransactionBody, error) Results(height uint64) ([]*flow.TransactionResult, error) Seals(height uint64) ([]*flow.Seal, error) }
Chain represents something that has access to chain data.
type Codec ¶
type Codec interface { Encode(value interface{}) ([]byte, error) Compress(data []byte) ([]byte, error) Decode(data []byte, value interface{}) error Decompress(compressed []byte) ([]byte, error) Marshal(value interface{}) ([]byte, error) Unmarshal(compressed []byte, value interface{}) error }
Codec represents something that can encode and decode data, as well as compress and decompress it.
type Library ¶
type Library interface { ReadLibrary WriteLibrary }
Library represents something that produces operations to read/write from/on a DPS index database.
type Params ¶
type Params struct { ChainID flow.ChainID FungibleToken flow.Address FlowFees flow.Address StakingTable flow.Address LockedTokens flow.Address StakingProxy flow.Address NonFungibleToken flow.Address Tokens map[string]Token }
Params contains the parameters of a Flow chain.
type ReadLibrary ¶
type ReadLibrary interface { RetrieveFirst(height *uint64) func(*badger.Txn) error RetrieveLast(height *uint64) func(*badger.Txn) error LookupHeightForBlock(blockID flow.Identifier, height *uint64) func(*badger.Txn) error LookupHeightForTransaction(txID flow.Identifier, height *uint64) func(*badger.Txn) error RetrieveCommit(height uint64, commit *flow.StateCommitment) func(*badger.Txn) error RetrieveHeader(height uint64, header *flow.Header) func(*badger.Txn) error RetrieveEvents(height uint64, types []flow.EventType, events *[]flow.Event) func(*badger.Txn) error RetrievePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error LookupTransactionsForHeight(height uint64, txIDs *[]flow.Identifier) func(*badger.Txn) error LookupTransactionsForCollection(collID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error LookupCollectionsForHeight(height uint64, collIDs *[]flow.Identifier) func(*badger.Txn) error LookupSealsForHeight(height uint64, sealIDs *[]flow.Identifier) func(*badger.Txn) error RetrieveCollection(collID flow.Identifier, collection *flow.LightCollection) func(*badger.Txn) error RetrieveGuarantee(collID flow.Identifier, collection *flow.CollectionGuarantee) func(*badger.Txn) error RetrieveTransaction(txID flow.Identifier, transaction *flow.TransactionBody) func(*badger.Txn) error RetrieveResult(txID flow.Identifier, result *flow.TransactionResult) func(*badger.Txn) error RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error IterateLedger(exclude func(height uint64) bool, process func(path ledger.Path, payload *ledger.Payload) error) func(*badger.Txn) error }
ReadLibrary represents something that produces operations to read from a DPS index database.
type Reader ¶
type Reader interface { First() (uint64, error) Last() (uint64, error) HeightForBlock(blockID flow.Identifier) (uint64, error) HeightForTransaction(txID flow.Identifier) (uint64, error) Commit(height uint64) (flow.StateCommitment, error) Header(height uint64) (*flow.Header, error) Events(height uint64, types ...flow.EventType) ([]flow.Event, error) Values(height uint64, paths []ledger.Path) ([]ledger.Value, error) Collection(collID flow.Identifier) (*flow.LightCollection, error) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error) Transaction(txID flow.Identifier) (*flow.TransactionBody, error) Seal(sealID flow.Identifier) (*flow.Seal, error) Result(txID flow.Identifier) (*flow.TransactionResult, error) CollectionsByHeight(height uint64) ([]flow.Identifier, error) TransactionsByHeight(height uint64) ([]flow.Identifier, error) SealsByHeight(height uint64) ([]flow.Identifier, error) }
Reader represents something that can read from a DPS index.
type SafeDeque ¶ added in v1.3.3
type SafeDeque struct {
// contains filtered or unexported fields
}
SafeDeque is a concurrency-safe double-ended queue. NOTE: As specified in the original Deque documentation, concurrency safety is up to the consumer to provide. See https://github.com/gammazero/deque
func NewDeque ¶ added in v1.3.3
func NewDeque() *SafeDeque
NewDeque instantiates and returns a new empty double-ended queue.
func (*SafeDeque) Back ¶ added in v1.3.3
func (s *SafeDeque) Back() interface{}
Back returns the element at the back of the queue. It panics if the queue is empty.
func (*SafeDeque) Clear ¶ added in v1.3.3
func (s *SafeDeque) Clear()
Clear removes all elements from the queue, but retains the current capacity.
func (*SafeDeque) Front ¶ added in v1.3.3
func (s *SafeDeque) Front() interface{}
Front returns the element at the front of the queue. It panics if the queue is empty.
func (*SafeDeque) PopBack ¶ added in v1.3.3
func (s *SafeDeque) PopBack() interface{}
PopBack removes and returns the element from the back of the queue.
func (*SafeDeque) PopFront ¶ added in v1.3.3
func (s *SafeDeque) PopFront() interface{}
PopFront removes and returns the element from the front of the queue.
func (*SafeDeque) PushBack ¶ added in v1.3.3
func (s *SafeDeque) PushBack(v interface{})
PushBack appends an element to the back of the queue.
func (*SafeDeque) PushFront ¶ added in v1.3.3
func (s *SafeDeque) PushFront(v interface{})
PushFront prepends an element to the front of the queue.
func (*SafeDeque) SetMinCapacity ¶ added in v1.3.3
SetMinCapacity sets a minimum capacity of 2^cap. If the value of the minimum capacity is less than or equal to the minimum allowed, then capacity is set to the minimum allowed.
type Token ¶
type Token struct { Symbol string Address flow.Address Type string Vault string Receiver string Balance string }
Token contains the details of a crypto token.
type WriteLibrary ¶
type WriteLibrary interface { SaveFirst(height uint64) func(*badger.Txn) error SaveLast(height uint64) func(*badger.Txn) error IndexHeightForBlock(blockID flow.Identifier, height uint64) func(*badger.Txn) error IndexHeightForTransaction(txID flow.Identifier, height uint64) func(*badger.Txn) error SaveCommit(height uint64, commit flow.StateCommitment) func(*badger.Txn) error SaveHeader(height uint64, header *flow.Header) func(*badger.Txn) error SaveEvents(height uint64, typ flow.EventType, events []flow.Event) func(*badger.Txn) error SavePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error IndexTransactionsForHeight(height uint64, txIDs []flow.Identifier) func(*badger.Txn) error IndexTransactionsForCollection(collID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error IndexCollectionsForHeight(height uint64, collIDs []flow.Identifier) func(*badger.Txn) error IndexSealsForHeight(height uint64, sealIDs []flow.Identifier) func(*badger.Txn) error SaveCollection(collection *flow.LightCollection) func(*badger.Txn) error SaveGuarantee(guarantee *flow.CollectionGuarantee) func(*badger.Txn) error SaveTransaction(transaction *flow.TransactionBody) func(*badger.Txn) error SaveResult(results *flow.TransactionResult) func(*badger.Txn) error SaveSeal(seal *flow.Seal) func(*badger.Txn) error }
WriteLibrary represents something that produces operations to write on a DPS index database.
type Writer ¶
type Writer interface { First(height uint64) error Last(height uint64) error Height(blockID flow.Identifier, height uint64) error Commit(height uint64, commit flow.StateCommitment) error Header(height uint64, header *flow.Header) error Events(height uint64, events []flow.Event) error Payloads(height uint64, paths []ledger.Path, values []*ledger.Payload) error Collections(height uint64, collections []*flow.LightCollection) error Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error Transactions(height uint64, transactions []*flow.TransactionBody) error Results(results []*flow.TransactionResult) error Seals(height uint64, seals []*flow.Seal) error }
Writer represents something that can write on a DPS index.