messagerequester

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2020 License: Apache-2.0, BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRetryInterval defines the Default Retry Interval of the message requester.
	DefaultRetryInterval = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

type Events struct {
	// Fired when a request for a given message should be sent.
	SendRequest *events.Event
	// MissingMessageAppeared is triggered when a message is actually present in the node's db although it was still being requested.
	MissingMessageAppeared *events.Event
}

Events represents events happening on a message requester.

type MessageExistsFunc added in v0.2.2

type MessageExistsFunc func(messageId message.ID) bool

MessageExistsFunc is a function that tells if a message exists.

type MessageRequester

type MessageRequester struct {
	Events Events
	// contains filtered or unexported fields
}

MessageRequester takes care of requesting messages.

func New

func New(missingMessages []message.ID, optionalOptions ...Option) *MessageRequester

New creates a new message requester.

func (*MessageRequester) RequestQueueSize added in v0.2.2

func (requester *MessageRequester) RequestQueueSize() int

RequestQueueSize returns the number of scheduled message requests.

func (*MessageRequester) StartRequest added in v0.2.2

func (requester *MessageRequester) StartRequest(id message.ID)

StartRequest initiates a regular triggering of the StartRequest event until it has been stopped using StopRequest.

func (*MessageRequester) StopRequest

func (requester *MessageRequester) StopRequest(id message.ID)

StopRequest stops requests for the given message to further happen.

type Option

type Option func(*Options)

Option is a function which inits an option.

func RetryInterval

func RetryInterval(interval time.Duration) Option

RetryInterval creates an option which sets the retry interval to the given value.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options holds options for a message requester.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL