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 ¶
const DefaultBufferSize = 512 * 1024
const MaxOverdueDuration = 2 * time.Second
const MinimalBufferSize = 4 * 1024
Variables ¶
This section is empty.
Functions ¶
func NewCallbackOnFinishSchedule ¶ added in v0.3.0
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
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
Types ¶
type BufferSizeConfig ¶ added in v0.3.0
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 (*Waiter) IsFinished ¶ added in v0.3.0
IsFinished is quick check, that wait context is not canceled and there are some tokens left in schedule.
func (*Waiter) IsSlowDown ¶ added in v0.4.0
IsSlowDown returns true, if schedule contains 2 elements before current time.