offsettrk

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SparseAcks2Str

func SparseAcks2Str(offset offsetmgr.Offset) string

SparseAcks2Str returns human readable representation of sparsely committed ranges encoded in the specified offset metadata.

Types

type T

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

T represents an entity that tracks offered and acknowledged messages and maintains offset data for the current state.

func New

func New(actDesc *actor.Descriptor, offset offsetmgr.Offset, offerTimeout time.Duration) *T

New creates a new offset tracker instance.

func (*T) Adjust

func (ot *T) Adjust(offset int64) (offsetmgr.Offset, int)

Adjust adjusts the tracked offset. Offers with offsets lower then the new offset value are dropped.

func (*T) IsAcked

func (ot *T) IsAcked(offset int64) (bool, int64)

IsAcked checks if an offset has already been acknowledged. The second returned value is the smallest not acked offset that is greater than the specified offset.

func (*T) NextRetry

func (ot *T) NextRetry() (consumer.Message, int, bool)

NextRetry returns a next message to be retried along with the retry attempt number. If there are no messages to be retried then nil is returned.

func (*T) OnAcked

func (ot *T) OnAcked(offset int64) (offsetmgr.Offset, int)

OnAcked should be called when a message has been acknowledged by a consumer. It returns an offset to be submitted and a total number of offered messages.

func (*T) OnOffered

func (ot *T) OnOffered(msg consumer.Message) int

OnOffered should be called when a message has been offered to a consumer. It returns the total number of offered messages. It is callers responsibility to ensure that the number of offered message does not grow too large.

func (*T) ShouldWait4Ack

func (ot *T) ShouldWait4Ack() time.Duration

ShouldWait4Ack tells how much time until all offers expire.

Jump to

Keyboard shortcuts

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