rangedlooptest

package
v1.70.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountObserver

type CountObserver struct {
	NumSegments int
}

CountObserver is a subscriber to the ranged segment loop which counts the number of segments.

func (*CountObserver) Finish

func (c *CountObserver) Finish(ctx context.Context) error

Finish is the callback for ranged segment loop end.

func (*CountObserver) Fork

Fork splits the observer to count ranges of segments.

func (*CountObserver) Join

func (c *CountObserver) Join(ctx context.Context, partial rangedloop.Partial) error

Join adds the count of all the ranges together.

func (*CountObserver) Process

func (c *CountObserver) Process(ctx context.Context, segments []segmentloop.Segment) error

Process counts the size of a batch of segments.

func (*CountObserver) Start

func (c *CountObserver) Start(ctx context.Context, time time.Time) error

Start is the callback for segment loop start.

type RangeSplitter

type RangeSplitter struct {
	Segments []segmentloop.Segment
}

RangeSplitter allows to iterate over segments from an in-memory source.

func (*RangeSplitter) CreateRanges

func (m *RangeSplitter) CreateRanges(nRanges int, batchSize int) ([]rangedloop.SegmentProvider, error)

CreateRanges splits the segments into equal ranges.

type SegmentProvider

type SegmentProvider struct {
	Segments []segmentloop.Segment
	// contains filtered or unexported fields
}

SegmentProvider allows to iterate over segments from an in-memory source.

func (*SegmentProvider) Iterate

func (m *SegmentProvider) Iterate(ctx context.Context, fn func([]segmentloop.Segment) error) error

Iterate allows to loop over the segments stored in the provider.

type SleepObserver

type SleepObserver struct {
	Duration time.Duration
}

SleepObserver is a subscriber to the segment loop which sleeps for every batch.

func (*SleepObserver) Finish

func (c *SleepObserver) Finish(ctx context.Context) error

Finish is the callback for segment loop end.

func (*SleepObserver) Fork

Fork splits the observer to process a segment range.

func (*SleepObserver) Join

func (c *SleepObserver) Join(ctx context.Context, partial rangedloop.Partial) error

Join is a noop.

func (*SleepObserver) Process

func (c *SleepObserver) Process(ctx context.Context, segments []segmentloop.Segment) error

Process sleeps for every batch of segments to simulate execution time.

func (*SleepObserver) Start

func (c *SleepObserver) Start(ctx context.Context, time time.Time) error

Start is the callback for segment loop start.

Jump to

Keyboard shortcuts

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