Documentation
¶
Overview ¶
Package priority implements the priority protocol that resolves arbitrary cluster wide priorities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prioritiser ¶
type Prioritiser struct {
// contains filtered or unexported fields
}
Prioritiser resolves cluster wide priorities.
func NewForT ¶
func NewForT(_ *testing.T, transport Transport, consensus Consensus, msgProvider msgProvider, msgValidator msgValidator, consensusTimeout time.Duration, tickerProvider tickerProvider, ) *Prioritiser
NewForT returns a new prioritiser for testing.
func (*Prioritiser) Prioritise ¶
func (p *Prioritiser) Prioritise(slot int64)
Prioritise starts a new prioritisation round for the provided slot.
func (*Prioritiser) Run ¶
func (p *Prioritiser) Run(ctx context.Context) error
Run runs the prioritiser until the context is cancelled. Note this will panic if called multiple times.
func (*Prioritiser) Subscribe ¶
func (p *Prioritiser) Subscribe(topic string, fn subscriber)
Subscribe registers a prioritiser output subscriber function. This is not thread safe and MUST NOT be called after Run.
type Transport ¶
type Transport interface {
// SendReceive sends the request to the peer and returns a single response.
SendReceive(
ctx context.Context,
peer peer.ID,
req, resp proto.Message,
protocols ...protocol.ID) bool
// ReceiveSend registers a callback function that will be invoked when peers
// send requests, replying with this peer's response.
ReceiveSend(
zeroReq func() proto.Message,
callback func(ctx context.Context, peer peer.ID, request proto.Message) (proto.Message, error),
protocols ...protocol.ID)
}
Transport abstracts sending and receiving libp2p protobuf messages.
Click to show internal directories.
Click to hide internal directories.