tracesetbuilder

package
v0.0.0-...-1092e40 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TraceSetBuilder

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

TraceSetBuilder builds a TraceSet from traces found in Tiles.

The mergeWorkers are selected based on the md5 hash of the decoded key for
a trace, this ensures that the same trace id will always be processed by
the same mergeWorker. This way we ensure that each mergeWorker sees only
their subset of the traces and we can avoid mutexes.

The Build() func will consolidate all the work of the mergeWorkers and shut down the worker pools. Because of that a TraceSetBuilder cannot be reused.

func New

func New(size int) *TraceSetBuilder

New creates a new TraceSetBuilder and starts the worker pools.

size is the length of the traces in the final TraceSet.

The caller should call Close() on the returned builder once they are done with it to close down all the workers.

func (*TraceSetBuilder) Add

func (t *TraceSetBuilder) Add(commitNumberToOutputIndex map[types.CommitNumber]int32, commits []provider.Commit, traces types.TraceSet)

Add traces to the TraceSet.

traceMap says where each trace value should be placed in the final trace. traces are keyed by traceId (unencoded) and the traces are just a single tile length.

func (*TraceSetBuilder) Build

Build returns the built TraceSet and ParamSet for that TraceSet.

Don't call Build until Add() has been called for every tile to be added.

func (*TraceSetBuilder) Close

func (t *TraceSetBuilder) Close()

Close down all the workers.

Always call this to clean up the workers.

Jump to

Keyboard shortcuts

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