package dump
import "github.com/zeebo/rothko/dump"
package dump provides periodic dumping from a scribbler to disk.
Usage
type Dumper
type Dumper struct {
}
Dumper is a worker that periodically dumps from a Writer into a database.
func New
func New(opts Options) *Dumper
New constructs a Dumper with the given options.
func (*Dumper) Dump
func (d *Dumper) Dump(ctx context.Context, w *data.Writer)
Dump writes all of the metrics Captured from the Writer into the DB associated
with the Dumper.
func (*Dumper) Run
func (d *Dumper) Run(ctx context.Context, w *data.Writer) (err error)
Run dumps periodically, until the context is canceled. When the context is
canceled, it waits for any active Dump and returns.
type Options
type Options struct {
// The database to dump into.
DB database.DB
// How often to dump.
Period time.Duration
// How big a buffer to use for records. Defaults to 1024.
Bufsize int
}
Options controls the options to the dumper.