breaksync

package
v4.45.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Identity = func(a string) string {
	return a
}

Identity consider key as rupture value

Functions

This section is empty.

Types

type Rupture

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

Rupture in a break/sync algorithm

func NewRupture

func NewRupture(name string, extract func(string) string) *Rupture

NewRupture creates and initialize Rupture

type Source

type Source[T any] struct {
	// contains filtered or unexported fields
}

Source of data in a break/sync algorithm

func NewChanSource added in v4.39.0

func NewChanSource[T any](input <-chan T, keyer func(T) string, readRupture *Rupture) *Source[T]

NewChanSource is a source from a chan, read sequentially

func NewSliceSource added in v4.13.0

func NewSliceSource[T any](arr []T, keyer func(T) string, readRupture *Rupture) *Source[T]

NewSliceSource is a source from a slice, read sequentially

func NewSource

func NewSource[T any](reader func() (T, error), keyer func(T) string, readRupture *Rupture) *Source[T]

NewSource creates and initialize Source

func (*Source[T]) ComputeSynchro added in v4.39.0

func (s *Source[T]) ComputeSynchro(key string)

func (*Source[T]) Current

func (s *Source[T]) Current() any

func (*Source[T]) CurrentKey added in v4.39.0

func (s *Source[T]) CurrentKey() string

func (*Source[T]) IsSynchronized added in v4.39.0

func (s *Source[T]) IsSynchronized() bool

func (*Source[T]) NextKey added in v4.39.0

func (s *Source[T]) NextKey() string

func (*Source[T]) Read added in v4.39.0

func (s *Source[T]) Read() error

func (*Source[T]) ReadRupture added in v4.39.0

func (s *Source[T]) ReadRupture() *Rupture

type SyncSource added in v4.39.0

type SyncSource interface {
	ReadRupture() *Rupture
	Current() any
	CurrentKey() string
	NextKey() string
	IsSynchronized() bool
	ComputeSynchro(string)
	Read() error
}

SyncSource behavior interface

type Synchronization

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

Synchronization in a break/sync algorithm

func NewSynchronization

func NewSynchronization() *Synchronization

NewSynchronization creates and initializes Synchronization

func (*Synchronization) AddSources added in v4.13.0

func (s *Synchronization) AddSources(sources ...SyncSource) *Synchronization

AddSources adds given source

func (*Synchronization) Run

func (s *Synchronization) Run(business func(uint64, []any) error) (err error)

Run start break/sync algorithm

Jump to

Keyboard shortcuts

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