mem

package
v0.0.0-...-3c2e606 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventValues

func EventValues(e *epb.Event, mds MetadataStore) []*spb.Summary_Value

EventValues converts an on-disk event to the summary values that it represents, applying compatibility transformations. It updates the MetadataStore with any new summary metadata, and may read from it to determine how to transform summary data. The input event may be mutated.

Types

type EagerReservoir

type EagerReservoir interface {
	// Offer accepts a record from the stream and either inserts it into
	// the reservoir or discards it (with the caveat that the most recent
	// record is always kept).
	Offer(value StepIndexed)
	// Sample takes a simple random sample from the non-preempted records
	// of the stream read so far, chosen uniformly among samples that
	// include the most recent record. The returned buffer is owned by the
	// caller.
	Sample() []StepIndexed
	// Last returns the most recent record, or nil if no records have yet
	// been offered.
	Last() StepIndexed
}

EagerReservoir describes the contract for a naive reservoir sampling algorithm (data structure) over StepIndexed values. An EagerReservoir must inspect every record in the stream. Preemption occurs implicitly whenever the Step value of a record does not increase.

func NewEagerReservoir

func NewEagerReservoir(capacity uint64) EagerReservoir

NewEagerReservoir creates an EagerReservoir with the given capacity. The reservoir can hold up to capacity elements losslessly, and will start downsampling after that many.

type MetadataStore

type MetadataStore map[string]*spb.SummaryMetadata

A MetadataStore holds the initial SummaryMetadata seen for each tag within a single run. Keys are tag names; the run is implicit.

type Step

type Step int64

A Step represents a strictly monotonically increasing step value. It is stored as an int64, but must be non-negative.

type StepIndexed

type StepIndexed interface {
	// Step returns the step for this value, which must be non-negative.
	// See docs for StepIndexed for a description of steps.
	Step() Step
}

StepIndexed describes values that are uniquely indexed by "step", a non-negative integer that increases with time (potentially non-consecutively).

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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