Documentation ¶
Index ¶
- func NotMalicious(d *Data, atx *ATX, _ lockGuard) bool
- func Warmup(db sql.Executor, cache *Data, keep types.EpochID, logger *zap.Logger) error
- type ATX
- type AtxFilter
- type Data
- func (d *Data) Add(epoch types.EpochID, node types.NodeID, coinbase types.Address, ...) *ATX
- func (d *Data) AddAtx(target types.EpochID, id types.ATXID, atx *ATX) bool
- func (d *Data) AddFromAtx(atx *types.ActivationTx, malicious bool) *ATX
- func (d *Data) EvictEpoch(evict types.EpochID)
- func (d *Data) Evicted() types.EpochID
- func (d *Data) Get(epoch types.EpochID, atx types.ATXID) *ATX
- func (d *Data) IsEvicted(epoch types.EpochID) bool
- func (d *Data) IsMalicious(node types.NodeID) bool
- func (d *Data) IterateHighTicksInEpoch(target types.EpochID, fn func(types.ATXID) bool)
- func (d *Data) IterateInEpoch(epoch types.EpochID, fn func(types.ATXID, *ATX), filters ...AtxFilter)
- func (d *Data) MissingInEpoch(epoch types.EpochID, atxs []types.ATXID) []types.ATXID
- func (d *Data) SetMalicious(node types.NodeID)
- func (d *Data) Size(target types.EpochID) int
- func (d *Data) WeightForSet(epoch types.EpochID, set []types.ATXID) (uint64, []bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotMalicious ¶ added in v1.4.0
Types ¶
type ATX ¶
type ATX struct { Node types.NodeID Coinbase types.Address Weight uint64 BaseHeight, Height uint64 Nonce types.VRFPostIndex }
SAFETY: all exported fields are read-only and are safe to read concurrently. Thanks to the fact that ATX is immutable, it is safe to return a pointer to it.
type AtxFilter ¶ added in v1.4.0
AtxFilter is a function that filters atxs. The `lockGuard` prevents using the filter functions outside of the allowed context to prevent data races.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func (*Data) Add ¶
func (d *Data) Add( epoch types.EpochID, node types.NodeID, coinbase types.Address, atxid types.ATXID, weight, baseHeight, height uint64, nonce types.VRFPostIndex, malicious bool, ) *ATX
Add adds ATX data to the store. Returns the ATX that was added to the store (if any) or `nil` if it wasn't.
func (*Data) AddAtx ¶ added in v1.4.0
Add adds ATX data to the store. Returns whether the ATX was added to the store.
func (*Data) AddFromAtx ¶ added in v1.6.0
func (d *Data) AddFromAtx(atx *types.ActivationTx, malicious bool) *ATX
AddFromHeader extracts relevant fields from an ActivationTx and adds them together with nonce and malicious flag. Returns the ATX that was added to the store (if any) or `nil` if it wasn't.
func (*Data) EvictEpoch ¶ added in v1.4.3
EvictEpoch is a notification for cache to evict epochs that are not useful to keep in memory.
func (*Data) IterateHighTicksInEpoch ¶ added in v1.5.4
func (*Data) IterateInEpoch ¶ added in v1.4.0
func (d *Data) IterateInEpoch(epoch types.EpochID, fn func(types.ATXID, *ATX), filters ...AtxFilter)
IterateInEpoch calls `fn` for every ATX in epoch. If filters are provided, only atxs that pass all filters are returned. SAFETY: The returned pointer MUST NOT be modified.