func RetrieveData(viewName string) ([]*Row, error) {
	return defaultWorker.RetrieveData(viewName)
}
RetrieveData gets a snapshot of the data collected for the the view registered
with the given name. It is intended for testing only.
package view
import (
	"fmt"
	"sync"
	"time"
	"go.opencensus.io/resource"
	"go.opencensus.io/metric/metricdata"
	"go.opencensus.io/metric/metricproducer"
	"go.opencensus.io/stats"
	"go.opencensus.io/stats/internal"
	"go.opencensus.io/tag"
)
func init() {
	defaultWorker = NewMeter().(*worker)
	go defaultWorker.start()
	internal.DefaultRecorder = record
}
type measureRef struct {
	measure string
	views   map[*viewInternal]struct{}
}
type worker struct {
	measures       map[string]*measureRef
	views          map[string]*viewInternal
	viewStartTimes map[*viewInternal]time.Time
	timer      *time.Ticker
	c          chan command
	quit, done chan bool
	mu         sync.RWMutex
	r          *resource.Resource
	exportersMu sync.RWMutex
	exporters   map[Exporter]struct{}
}
type Meter interface {
	stats.Recorder
	Find(name string) *View
	Register(views ...*View) error
	Unregister(views ...*View)
	SetReportingPeriod(time.Duration)
	RegisterExporter(Exporter)
	UnregisterExporter(Exporter)
	SetResource(*resource.Resource)
	Start()
	Stop()
	RetrieveData(viewName string) ([]*Row, error)
}
var _ Meter = (*worker)(nil)
var defaultWorker *worker
var defaultReportingDuration = 10 * time.Second
func Find(name string) (v *View) {
	return defaultWorker.Find(name)
}
func (w *worker) Find(name string) (v *View) {
	req := &getViewByNameReq{
		name: name,
		c:    make(chan *getViewByNameResp),
	}
	w.c <- req
	resp := <-req.c
	return resp.v
}
func Register(views ...*View) error {
	return defaultWorker.Register(views...)
}
func (w *worker) Register(views ...*View) error {
	req := &registerViewReq{
		views: views,
		err:   make(chan error),
	}
	w.c <- req
	return <-req.err
}
func Unregister(views ...*View) {
	defaultWorker.Unregister(views...)
}
func (w *worker) Unregister(views ...*View) {
	names := make([]string, len(views))
	for i := range views {
		names[i] = views[i].Name
	}
	req := &unregisterFromViewReq{
		views: names,
		done:  make(chan struct{}),
	}
	w.c <- req
	<-req.done
}