github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/objstorage/objstorageprovider/objiotracing/obj_io_tracing_off.go (about)

     1  // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  //go:build !pebble_obj_io_tracing
     6  // +build !pebble_obj_io_tracing
     7  
     8  package objiotracing
     9  
    10  import (
    11  	"context"
    12  
    13  	"github.com/cockroachdb/pebble/internal/base"
    14  	"github.com/cockroachdb/pebble/objstorage"
    15  	"github.com/cockroachdb/pebble/vfs"
    16  )
    17  
    18  // Enabled is used to short circuit tracing-related code in regular builds.
    19  const Enabled = false
    20  
    21  // Tracer manages the writing of object IO traces to files.
    22  type Tracer struct{}
    23  
    24  // Open creates a Tracer which generates trace files in the given directory.
    25  // Each trace file contains a series of Events (as they are in memory).
    26  func Open(fs vfs.FS, fsDir string) *Tracer {
    27  	return nil
    28  }
    29  
    30  // Close the tracer, flushing any remaining events.
    31  func (*Tracer) Close() {}
    32  
    33  // WrapReadable wraps an objstorage.Readable with one that generates tracing
    34  // events.
    35  func (*Tracer) WrapReadable(
    36  	ctx context.Context, r objstorage.Readable, fileNum base.DiskFileNum,
    37  ) objstorage.Readable {
    38  	return r
    39  }
    40  
    41  // WrapWritable wraps an objstorage.Writable with one that generates tracing
    42  // events.
    43  func (t *Tracer) WrapWritable(
    44  	ctx context.Context, w objstorage.Writable, fileNum base.DiskFileNum,
    45  ) objstorage.Writable {
    46  	return w
    47  }
    48  
    49  // WithReason creates a context that has an associated Reason (which ends up in
    50  // traces created under that context).
    51  func WithReason(ctx context.Context, reason Reason) context.Context { return ctx }
    52  
    53  // WithBlockType creates a context that has an associated BlockType (which ends up in
    54  // traces created under that context).
    55  func WithBlockType(ctx context.Context, blockType BlockType) context.Context { return ctx }
    56  
    57  // WithLevel creates a context that has an associated level (which ends up in
    58  // traces created under that context).
    59  func WithLevel(ctx context.Context, level int) context.Context { return ctx }