github.com/MetalBlockchain/metalgo@v1.11.9/snow/engine/common/traced_bootstrapable_engine.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package common 5 6 import ( 7 "context" 8 9 "github.com/MetalBlockchain/metalgo/trace" 10 ) 11 12 var _ BootstrapableEngine = (*tracedBootstrapableEngine)(nil) 13 14 type tracedBootstrapableEngine struct { 15 Engine 16 bootstrapableEngine BootstrapableEngine 17 tracer trace.Tracer 18 } 19 20 func TraceBootstrapableEngine(bootstrapableEngine BootstrapableEngine, tracer trace.Tracer) BootstrapableEngine { 21 return &tracedBootstrapableEngine{ 22 Engine: TraceEngine(bootstrapableEngine, tracer), 23 bootstrapableEngine: bootstrapableEngine, 24 } 25 } 26 27 func (e *tracedBootstrapableEngine) Clear(ctx context.Context) error { 28 ctx, span := e.tracer.Start(ctx, "tracedBootstrapableEngine.Clear") 29 defer span.End() 30 31 return e.bootstrapableEngine.Clear(ctx) 32 }