Documentation
¶
Overview ¶
Package proposerpreferences handles listening to, validating, and caching proposer preferences received via the P2P gossip network.
Index ¶
- type Cache
- func (c *Cache) Add(slot phase0.Slot, prefs *gloas.SignedProposerPreferences) bool
- func (c *Cache) Clear()
- func (c *Cache) Get(slot phase0.Slot) (*gloas.SignedProposerPreferences, bool)
- func (c *Cache) GetAll() map[phase0.Slot]*gloas.SignedProposerPreferences
- func (c *Cache) Has(slot phase0.Slot) bool
- func (c *Cache) PruneBefore(slot phase0.Slot)
- func (c *Cache) SetStateDB(stateDB *db.Database, log logrus.FieldLogger)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores proposer preferences by slot. Thread-safe. Only the first valid preference per slot is stored (subsequent ones for the same slot are ignored).
func (*Cache) Add ¶
Add stores proposer preferences for a slot. If the slot already exists, the existing value is kept and false is returned.
func (*Cache) GetAll ¶
func (c *Cache) GetAll() map[phase0.Slot]*gloas.SignedProposerPreferences
GetAll returns a copy of all cached proposer preferences.
func (*Cache) PruneBefore ¶
PruneBefore removes all proposer preferences for slots before the provided slot.
func (*Cache) SetStateDB ¶
func (c *Cache) SetStateDB(stateDB *db.Database, log logrus.FieldLogger)
SetStateDB attaches an optional state-db for best-effort write-through persistence and loads any previously-persisted preferences into the cache.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service listens to proposer preferences from the beacon node's SSE event stream and caches the latest preference per slot.
func NewService ¶
func NewService(clClient *beacon.Client, log logrus.FieldLogger) *Service
NewService creates a new proposer preferences service.