Documentation
¶
Index ¶
- func NotMalicious(data *ATX, _ lockGuard) bool
- func Warmup(db sql.Executor, cache *Data) error
- type ATX
- type AtxFilter
- type Data
- func (d *Data) Add(epoch types.EpochID, node types.NodeID, coinbase types.Address, ...) bool
- func (d *Data) AddFromHeader(atx *types.ActivationTxHeader, nonce types.VRFPostIndex, malicious bool) bool
- 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) 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) OnEpoch(applied types.EpochID)
- func (d *Data) SetMalicious(node types.NodeID)
- func (d *Data) WeightForSet(epoch types.EpochID, set []types.ATXID) (uint64, []bool)
- type Opt
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 // contains filtered or unexported fields }
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, atx types.ATXID, weight, baseHeight, height uint64, nonce types.VRFPostIndex, malicious bool, ) bool
Add adds atx data to the store. Returns true if the atx was added to the store.
func (*Data) AddFromHeader ¶ added in v1.4.0
func (d *Data) AddFromHeader(atx *types.ActivationTxHeader, nonce types.VRFPostIndex, malicious bool) bool
AddFromVerified extracts relevant fields from verified atx and adds them together with nonce and malicious flag. Returns true if the atx was added to the store.
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.
func (*Data) MissingInEpoch ¶ added in v1.4.0
func (*Data) OnEpoch ¶
OnEpoch is a notification for cache to evict epochs that are not useful to keep in memory.
func (*Data) SetMalicious ¶
type Opt ¶
type Opt func(*Data)
func WithCapacity ¶
WithCapacity sets the number of epochs from the latest applied that cache will maintain in memory.
func WithCapacityFromLayers ¶
WithCapacityFromLayers sets capacity to include all layers in the window.