Documentation ¶
Index ¶
- type CountObserver
- func (c *CountObserver) Finish(ctx context.Context) error
- func (c *CountObserver) Fork(ctx context.Context) (rangedloop.Partial, error)
- func (c *CountObserver) Join(ctx context.Context, partial rangedloop.Partial) error
- func (c *CountObserver) Process(ctx context.Context, segments []segmentloop.Segment) error
- func (c *CountObserver) Start(ctx context.Context, time time.Time) error
- type RangeSplitter
- type SegmentProvider
- type SleepObserver
- func (c *SleepObserver) Finish(ctx context.Context) error
- func (c *SleepObserver) Fork(ctx context.Context) (rangedloop.Partial, error)
- func (c *SleepObserver) Join(ctx context.Context, partial rangedloop.Partial) error
- func (c *SleepObserver) Process(ctx context.Context, segments []segmentloop.Segment) error
- func (c *SleepObserver) Start(ctx context.Context, time time.Time) error
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 ¶
func (c *CountObserver) Fork(ctx context.Context) (rangedloop.Partial, error)
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.
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 ¶
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 ¶
func (c *SleepObserver) Fork(ctx context.Context) (rangedloop.Partial, error)
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.