Documentation ¶
Index ¶
Constants ¶
const AllItems = -1
AllItems indicates all items from the tailer should be read
const (
EndOffset int64 = -1
)
EndOffset specifies the largest offset. It is used to tell IterateReverse to return all items independent of their offset
Variables ¶
var ( // ErrStop indicates the iteration should be stopped. This can be returned from the iterate-Visitor ErrStop = errors.New("iteration stopped") )
Functions ¶
This section is empty.
Types ¶
type TailMessageHook ¶
type TailMessageHook func(item *TailerItem)
TailMessageHook is called on every message being added to the tailer
type Tailer ¶
type Tailer struct {
// contains filtered or unexported fields
}
Tailer updates messages from a topic and keeps them in a ring buffer for reverse iteration
func (*Tailer) IterateReverse ¶
func (t *Tailer) IterateReverse(maxOffset int64, visit TailerVisiter) error
IterateReverse iterates over all items ignoring items having bigger offset than maxOffset (or all, if EndOffset is given)
func (*Tailer) RegisterConsumeHook ¶
func (t *Tailer) RegisterConsumeHook(tailHook TailMessageHook)
RegisterConsumeHook sets the callback that will be called on every message being added to the tailer
type TailerItem ¶ added in v1.2.5
type TailerItem struct { // Key is the key of the original message Key string // Value is the decoded value. This will not be nil, as the tailer ignores nils Value interface{} // Offset is the message's offset Offset int64 }
TailerItem represents a decoded messagei n the tailer's ring buffer
type TailerVisiter ¶ added in v1.2.5
type TailerVisiter func(item *TailerItem) error
TailerVisiter is called on reverseiterate for every message