Documentation
¶
Index ¶
- type Block
- type BlockLoader
- func (l *BlockLoader) Clear(key uint64)
- func (l *BlockLoader) Load(key uint64) (Block, error)
- func (l *BlockLoader) LoadAll(keys []uint64) ([]Block, []error)
- func (l *BlockLoader) LoadAllThunk(keys []uint64) func() ([]Block, []error)
- func (l *BlockLoader) LoadThunk(key uint64) func() (Block, error)
- func (l *BlockLoader) Prime(key uint64, value Block) bool
- type BlockLoaderConfig
- type BlockRawTransaction
- type RPC
- func (r RPC) GetBlocks(ctx context.Context, retries uint, blocksIds ...uint64) ([]Block, []int, error)
- func (r RPC) GetBlocksWithLimit(ctx context.Context, from, limit uint64) ([]uint64, error)
- func (r RPC) GetLatestBlock(ctx context.Context) (uint64, error)
- func (v RPC) MarshalEasyJSON(w *jwriter.Writer)
- func (v RPC) MarshalJSON() ([]byte, error)
- func (v *RPC) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *RPC) UnmarshalJSON(data []byte) error
- type TokenBalanceChange
- type Tx
- type TxMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockLoader ¶
type BlockLoader struct {
// contains filtered or unexported fields
}
BlockLoader batches and caches requests
func NewBlockLoader ¶
func NewBlockLoader(config BlockLoaderConfig) *BlockLoader
NewBlockLoader creates a new BlockLoader given a fetch, wait, and maxBatch
func (*BlockLoader) Clear ¶
func (l *BlockLoader) Clear(key uint64)
Clear the value at key from the cache, if it exists
func (*BlockLoader) Load ¶
func (l *BlockLoader) Load(key uint64) (Block, error)
Load a Block by key, batching and caching will be applied automatically
func (*BlockLoader) LoadAll ¶
func (l *BlockLoader) LoadAll(keys []uint64) ([]Block, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*BlockLoader) LoadAllThunk ¶
func (l *BlockLoader) LoadAllThunk(keys []uint64) func() ([]Block, []error)
LoadAllThunk returns a function that when called will block waiting for a Blocks. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.
func (*BlockLoader) LoadThunk ¶
func (l *BlockLoader) LoadThunk(key uint64) func() (Block, error)
LoadThunk returns a function that when called will block waiting for a Block. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.
type BlockLoaderConfig ¶
type BlockLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uint64) ([]Block, []error) // Wait is how long wait before sending a batch Wait time.Duration // MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit MaxBatch int }
BlockLoaderConfig captures the config to create a new BlockLoader
type BlockRawTransaction ¶
type BlockRawTransaction struct { Meta txMeta `json:"meta"` Transaction [2]string `json:"transaction"` Version any `json:"version"` }
func (BlockRawTransaction) MarshalEasyJSON ¶
func (v BlockRawTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BlockRawTransaction) MarshalJSON ¶
func (v BlockRawTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BlockRawTransaction) UnmarshalEasyJSON ¶
func (v *BlockRawTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BlockRawTransaction) UnmarshalJSON ¶
func (v *BlockRawTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
func (RPC) GetBlocks ¶
func (r RPC) GetBlocks(ctx context.Context, retries uint, blocksIds ...uint64) ([]Block, []int, error)
GetBlocks will recursevily try to fetch specified block ids until 0 retries left todo use backoff
func (RPC) GetBlocksWithLimit ¶
func (RPC) GetLatestBlock ¶
Retruns latest slot and total block count
func (RPC) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (RPC) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*RPC) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RPC) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type TokenBalanceChange ¶
type Tx ¶
type Tx struct { TxHash string Meta TxMeta Insts []types.Instruction InnerInsts map[int][]types.Instruction }
Parsed tx
func TxFromBlockTransaction ¶
func TxFromBlockTransaction(l lgr.L, blockTx BlockRawTransaction) (transaction Tx, include bool, err error)
TxFromBlockTransaction parses raw rpc transaction to appropriate form for parsing todo: exposed for tests. parsing can happen in different entity. fine for now