github.com/annwntech/go-micro/v2@v2.9.5/debug/trace/options.go (about)

     1  package trace
     2  
     3  type Options struct {
     4  	// Size is the size of ring buffer
     5  	Size int
     6  }
     7  
     8  type Option func(o *Options)
     9  
    10  type ReadOptions struct {
    11  	// Trace id
    12  	Trace string
    13  }
    14  
    15  type ReadOption func(o *ReadOptions)
    16  
    17  // Read the given trace
    18  func ReadTrace(t string) ReadOption {
    19  	return func(o *ReadOptions) {
    20  		o.Trace = t
    21  	}
    22  }
    23  
    24  const (
    25  	// DefaultSize of the buffer
    26  	DefaultSize = 64
    27  )
    28  
    29  // DefaultOptions returns default options
    30  func DefaultOptions() Options {
    31  	return Options{
    32  		Size: DefaultSize,
    33  	}
    34  }