Documentation ¶
Index ¶
- Variables
- type Cert
- type Store
- func (cs *Store) Get(ctx context.Context, instance uint64) (*Cert, error)
- func (cs *Store) GetRange(ctx context.Context, start uint64, end uint64) ([]Cert, error)
- func (cs *Store) Latest() *Cert
- func (cs *Store) Put(ctx context.Context, cert *Cert) error
- func (cs *Store) SubscribeForNewCerts(ch chan<- *Cert) (last *Cert, closer func())
Constants ¶
This section is empty.
Variables ¶
var ErrCertNotFound = errors.New("certificate not found")
Functions ¶
This section is empty.
Types ¶
type Cert ¶
type Cert struct {
Instance uint64
}
func (Cert) MarshalBinary ¶
func (*Cert) UnmarshalBinary ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is responsible for storing and relaying information about new finality certificates
func (*Store) GetRange ¶
GetRange returns a range of certs from start to end inclusive by instance numbers in the increasing order. Only this order of traversal is supported. If it encounters missing cert, it returns a wrapped ErrCertNotFound and the available certs
func (*Store) Put ¶
Put saves a certificate in a store and notifies listeners. It errors if adding a cert would create a gap
func (*Store) SubscribeForNewCerts ¶
SubscribeForNewCerts is used to subscribe to the broadcast channel. If the passed channel is full at any point, it will be dropped from subscription and closed. To stop subscribing, either the closer function can be used or the channel can be abandoned. Passing a channel multiple times to the Subscribe function will result in a panic. The channel will receive new certificates sequentially.