Documentation ¶
Index ¶
- type DNSCache
- func (d *DNSCache) GetDomainIp(domain string) ([]net.IPAddr, int64, bool)
- func (d *DNSCache) GetTxtRecord(domain string) ([]string, int64, bool)
- func (d *DNSCache) PutDomainIp(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)
- 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) Hash() flow.Identifier
- func (t *Transactions) Rem(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 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 ¶
GetIpDomain returns the ip domain if exists in the cache. The second return value determines the timestamp of adding the domain to 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 second return value determines the timestamp of adding the record to the cache. The boolean return value determines if record exists in the cache.
func (*DNSCache) PutDomainIp ¶
PutDomainIp adds the given ip domain into the cache.
func (*DNSCache) PutTxtRecord ¶
PutTxtRecord adds the given txt record into the cache.
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) Hash ¶
func (t Transactions) Hash() flow.Identifier
Hash will return a fingerprint hash representing the contents of the entire memory pool.
func (*Transactions) Rem ¶
func (t *Transactions) Rem(id flow.Identifier) bool
Rem removes transaction from mempool.
func (Transactions) Size ¶
func (t Transactions) Size() uint
Size returns total number of stored transactions.