payload

package
v2.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Payload

type Payload struct {
	Nonce         string
	Resending     bool
	Element       internallist.Element
	ResendElement internallist.Element
	// contains filtered or unexported fields
}

Payload holds the data and acknowledged status of a spool of events and provides methods for processing acknowledgements so that a future resend of the payload does not resend acknowledged events

func NewPayload

func NewPayload(events []*core.EventDescriptor) *Payload

NewPayload initialises a new payload structure from the given spool of events

func (*Payload) Ack

func (pp *Payload) Ack(sequence int) (int, bool)

Ack processes an acknowledgement sequence, marking events as sent and preventing resends from sending those events Returns the number of events acknowledged, with the second return value true if the payload is now completely acknowledged

func (*Payload) Complete

func (pp *Payload) Complete() bool

Complete returns true if all events in this payload have been acknowledged

func (*Payload) Events

func (pp *Payload) Events() []*core.EventDescriptor

Events returns the unacknowledged set of events in the payload

func (*Payload) HasAck

func (pp *Payload) HasAck() bool

HasAck returns true if the payload has had at least one event acknowledged

func (*Payload) Init

func (pp *Payload) Init()

Init initialises the internallist elements and anything else requiring initialisation

func (*Payload) ResetSequence

func (pp *Payload) ResetSequence()

ResetSequence makes the first unacknowledged event have a sequence ID of 1 This should be called before resending to ensure the ACK messages returned (which will use an ID of 1 for the first unacknowledged event) are understood correctly

func (*Payload) Rollup

func (pp *Payload) Rollup() []*core.EventDescriptor

Rollup removes acknowledged events from the payload and returns them so they may be passed onto the Registrar

func (*Payload) Size

func (pp *Payload) Size() int

Size returns the original size of this payload

Jump to

Keyboard shortcuts

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