micro/tracer/options.go

38 lines
563 B
Go
Raw Normal View History

package tracer
2020-01-18 13:20:46 +03:00
// Options struct
2020-01-29 18:45:11 +03:00
type Options struct {
// Size is the size of ring buffer
Size int
}
2020-01-18 13:20:46 +03:00
// Option func
2020-01-18 13:20:46 +03:00
type Option func(o *Options)
type ReadOptions struct {
// Trace id
Trace string
}
// ReadOption func
2020-01-18 13:20:46 +03:00
type ReadOption func(o *ReadOptions)
2020-01-25 00:24:51 +03:00
// ReadTracer read the given trace
2020-01-25 00:24:51 +03:00
func ReadTrace(t string) ReadOption {
return func(o *ReadOptions) {
o.Trace = t
}
}
2020-01-29 18:45:11 +03:00
const (
// DefaultSize of the buffer
DefaultSize = 64
)
// DefaultOptions returns default options
func DefaultOptions() Options {
return Options{
Size: DefaultSize,
}
}