coreutil

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MPL-2.0 Imports: 7 Imported by: 3

Documentation

Overview

package coreutil provides utilities for core interfaces, that can be useful not only for engine, but other core importers too. coreutil MUST NOT depend on any core subpackage, because they may import coreutil.

Index

Constants

View Source
const DefaultBufferSize = 512 * 1024
View Source
const MinimalBufferSize = 4 * 1024

Variables

This section is empty.

Functions

func NewCallbackOnFinishSchedule added in v0.3.0

func NewCallbackOnFinishSchedule(s core.Schedule, onFinish func()) core.Schedule

NewCallbackOnFinishSchedule returns schedule that calls back once onFinish just before first callee could know, that schedule is finished. That is, calls onFinish once, first time, whet Next() returns ok == false or Left() returns 0.

func ResetReusedAmmo added in v0.3.0

func ResetReusedAmmo(ammo core.Ammo)

ResetReusedAmmo sets to zero any ammo. Used by core.Provider implementations that accepts generic type, and need to clean reused ammo before fill with fresh data.

func ReturnSampleIfBorrowed added in v0.3.0

func ReturnSampleIfBorrowed(s core.Sample)

Types

type BufferSizeConfig added in v0.3.0

type BufferSizeConfig struct {
	BufferSize datasize.ByteSize `config:"buffer-size"`
}

BufferSizeConfig SHOULD be used to configure buffer size. That makes buffer size configuration consistent among all Aggregators.

func (BufferSizeConfig) BufferSizeOrDefault added in v0.3.0

func (conf BufferSizeConfig) BufferSizeOrDefault() int

type DataSinkFunc added in v0.3.0

type DataSinkFunc func() (wc io.WriteCloser, err error)

func (DataSinkFunc) OpenSink added in v0.3.0

func (f DataSinkFunc) OpenSink() (wc io.WriteCloser, err error)

type DataSourceFunc added in v0.3.0

type DataSourceFunc func() (wc io.ReadCloser, err error)

func (DataSourceFunc) OpenSource added in v0.3.0

func (f DataSourceFunc) OpenSource() (rc io.ReadCloser, err error)

type Waiter

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

Waiter goroutine unsafe wrapper for efficient waiting schedule.

func NewWaiter

func NewWaiter(sched core.Schedule, ctx context.Context) *Waiter

func (*Waiter) IsFinished added in v0.3.0

func (w *Waiter) IsFinished() (ok bool)

IsFinished is quick check, that wait context is not canceled and there are some tokens left in schedule.

func (*Waiter) Wait

func (w *Waiter) Wait() (ok bool)

Wait waits for next waiter schedule event. Returns true, if event successfully waited, or false if waiter context is done, or schedule finished.

Jump to

Keyboard shortcuts

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