Documentation ¶
Index ¶
- type BlockExecutionData
- func (t *BlockExecutionData) Add(ed *execution_data.BlockExecutionDataEntity) bool
- func (t *BlockExecutionData) All() []*execution_data.BlockExecutionDataEntity
- func (t *BlockExecutionData) ByID(blockID flow.Identifier) (*execution_data.BlockExecutionDataEntity, bool)
- func (t *BlockExecutionData) Clear()
- func (t *BlockExecutionData) Has(blockID flow.Identifier) bool
- func (t *BlockExecutionData) Remove(blockID flow.Identifier) bool
- func (t *BlockExecutionData) Size() uint
- type DNSCache
- func (d *DNSCache) GetDomainIp(domain string) (*mempool.IpRecord, bool)
- func (d *DNSCache) GetTxtRecord(domain string) (*mempool.TxtRecord, bool)
- func (d *DNSCache) LockIPDomain(domain string) (bool, error)
- func (d *DNSCache) LockTxtRecord(txt string) (bool, error)
- func (d *DNSCache) PutIpDomain(domain string, addresses []net.IPAddr, timestamp int64) bool
- func (d *DNSCache) PutTxtRecord(domain string, record []string, timestamp int64) bool
- func (d *DNSCache) RemoveIp(domain string) bool
- func (d *DNSCache) RemoveTxt(domain string) bool
- func (d DNSCache) Size() (uint, uint)
- func (d *DNSCache) UpdateIPDomain(domain string, addresses []net.IPAddr, timestamp int64) error
- func (d *DNSCache) UpdateTxtRecord(txt string, records []string, timestamp int64) error
- type Transactions
- func (t *Transactions) Add(tx *flow.TransactionBody) bool
- func (t Transactions) All() []*flow.TransactionBody
- func (t Transactions) ByID(txID flow.Identifier) (*flow.TransactionBody, bool)
- func (t *Transactions) Clear()
- func (t Transactions) Has(id flow.Identifier) bool
- func (t *Transactions) Remove(id flow.Identifier) bool
- func (t Transactions) Size() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockExecutionData ¶ added in v0.30.4
type BlockExecutionData struct {
// contains filtered or unexported fields
}
func NewBlockExecutionData ¶ added in v0.30.4
func NewBlockExecutionData(limit uint32, logger zerolog.Logger, collector module.HeroCacheMetrics) *BlockExecutionData
NewBlockExecutionData implements a block execution data mempool based on hero cache.
func (*BlockExecutionData) Add ¶ added in v0.30.4
func (t *BlockExecutionData) Add(ed *execution_data.BlockExecutionDataEntity) bool
Add adds a block execution data to the mempool, keyed by block ID. It returns false if the execution data was already in the mempool.
func (*BlockExecutionData) All ¶ added in v0.30.4
func (t *BlockExecutionData) All() []*execution_data.BlockExecutionDataEntity
All returns all block execution data from the mempool. Since it is using the HeroCache, All guarantees returning all block execution data in the same order as they are added.
func (*BlockExecutionData) ByID ¶ added in v0.30.4
func (t *BlockExecutionData) ByID(blockID flow.Identifier) (*execution_data.BlockExecutionDataEntity, bool)
ByID returns the block execution data for the given block ID from the mempool. It returns false if the execution data was not found in the mempool.
func (*BlockExecutionData) Clear ¶ added in v0.30.4
func (t *BlockExecutionData) Clear()
Clear removes all block execution data stored in this mempool.
func (*BlockExecutionData) Has ¶ added in v0.30.4
func (t *BlockExecutionData) Has(blockID flow.Identifier) bool
Has checks whether the block execution data for the given block ID is currently in the memory pool.
func (*BlockExecutionData) Remove ¶ added in v0.30.4
func (t *BlockExecutionData) Remove(blockID flow.Identifier) bool
Remove removes block execution data from mempool by block ID. It returns true if the execution data was known and removed.
func (*BlockExecutionData) Size ¶ added in v0.30.4
func (t *BlockExecutionData) Size() uint
Size returns total number of stored block execution data.
type DNSCache ¶
type DNSCache struct {
// contains filtered or unexported fields
}
func NewDNSCache ¶
func NewDNSCache(sizeLimit uint32, logger zerolog.Logger, ipCollector module.HeroCacheMetrics, txtCollector module.HeroCacheMetrics) *DNSCache
func (*DNSCache) GetDomainIp ¶
GetDomainIp returns the ip domain if exists in the cache. The boolean return value determines if domain exists in the cache.
func (*DNSCache) GetTxtRecord ¶
GetTxtRecord returns the txt record if exists in the cache. The boolean return value determines if record exists in the cache.
func (*DNSCache) LockIPDomain ¶ added in v0.27.0
LockIPDomain locks an ip address dns record if exists in the cache. The boolean return value determines whether attempt on locking was successful.
A locking attempt is successful when the domain record exists in the cache and has not been locked before. Once a domain record gets locked the only way to unlock it is through updating that record.
The locking process is defined to record that a resolving attempt is ongoing for an expired domain. So the locking happens to avoid any other parallel resolving
func (*DNSCache) LockTxtRecord ¶ added in v0.27.0
LockTxtRecord locks a txt address dns record if exists in the cache. The boolean return value determines whether attempt on locking was successful.
A locking attempt is successful when the domain record exists in the cache and has not been locked before. Once a domain record gets locked the only way to unlock it is through updating that record.
The locking process is defined to record that a resolving attempt is ongoing for an expired domain. So the locking happens to avoid any other parallel resolving.
func (*DNSCache) PutIpDomain ¶ added in v0.27.0
PutIpDomain adds the given ip domain into the cache.
func (*DNSCache) PutTxtRecord ¶
PutTxtRecord adds the given txt record into the cache.
func (DNSCache) Size ¶
Size returns total domains maintained into this cache. The first returned value determines number of ip domains. The second returned value determines number of txt records.
func (*DNSCache) UpdateIPDomain ¶ added in v0.27.0
UpdateIPDomain updates the dns record for the given ip domain with the new address and timestamp values.
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
func NewTransactions ¶
func NewTransactions(limit uint32, logger zerolog.Logger, collector module.HeroCacheMetrics) *Transactions
NewTransactions implements a transactions mempool based on hero cache.
func (*Transactions) Add ¶
func (t *Transactions) Add(tx *flow.TransactionBody) bool
Add adds a transaction to the mempool.
func (Transactions) All ¶
func (t Transactions) All() []*flow.TransactionBody
All returns all transactions from the mempool. Since it is using the HeroCache, All guarantees returning all transactions in the same order as they are added.
func (Transactions) ByID ¶
func (t Transactions) ByID(txID flow.Identifier) (*flow.TransactionBody, bool)
ByID returns the transaction with the given ID from the mempool.
func (*Transactions) Clear ¶
func (t *Transactions) Clear()
Clear removes all transactions stored in this mempool.
func (Transactions) Has ¶
func (t Transactions) Has(id flow.Identifier) bool
Has checks whether the transaction with the given hash is currently in the memory pool.
func (*Transactions) Remove ¶ added in v0.27.0
func (t *Transactions) Remove(id flow.Identifier) bool
Remove removes transaction from mempool.
func (Transactions) Size ¶
func (t Transactions) Size() uint
Size returns total number of stored transactions.