delts

package module
v0.0.0-...-0a848dd Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2015 License: MIT Imports: 2 Imported by: 0

README

#delts

streaming delta tracking

This library provides a way to detect breaks in sequential ranges during out-of-order processing of stream data. For instance if an incremental id is present throughout all log entries but log entries may not arrive in sequential order.

// define the window of entries to accumulate before reporting
// break in sequence.
s := NewSortedDeltaStream(100)

for i := int64(1); i <= 20; i++ {
	s.Add(i)
}
for i := int64(40); i > 20; i-- {
	s.Add(i)
}

s.Close()

for d := range s.Output {
	fmt.Println(d)
}

// Output:
// [1 40]

All operations are threadsafe so calling Add() from multiple go routines outputs the expected ranges.

DOCS LICENSE

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SortedDeltaStream

type SortedDeltaStream struct {
	Output chan []int64
	// contains filtered or unexported fields
}
Example
s := NewSortedDeltaStream(1 << 20)

for i := int64(1); i <= 20; i++ {
	s.Add(i)
}

s.Close()

for d := range s.Output {
	fmt.Println(d)
}
Output:

[1 20]

func NewSortedDeltaStream

func NewSortedDeltaStream(size int) *SortedDeltaStream

func (*SortedDeltaStream) Add

func (d *SortedDeltaStream) Add(n int64)

func (*SortedDeltaStream) Close

func (d *SortedDeltaStream) Close()

func (*SortedDeltaStream) Emit

func (d *SortedDeltaStream) Emit()

Jump to

Keyboard shortcuts

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