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 ¶
func (t *TraceSetBuilder) Build(ctx context.Context) (types.TraceSet, paramtools.ReadOnlyParamSet)
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.