func (r *ReflectorCtl) Start(ctx context.Context) {
	start := time.Now()
	defer func() {
		stats.Observe("reflector-ctl-latency", time.Now().Sub(start), stats.Tag{
			Name:  "op",
			Value: "start",
		})
	}()
	events.Log("Starting reflector")
	r.assertNotClosed()
	r.initLifecycle(ctx)
	result := make(chan error)
	select {
	case r.messages <- reflectorCtlMsg{desired: true, result: result}:
	case <-ctx.Done():
		return
	}
	select {
	case err := <-result:
		if err != nil {
			panic("could not start reflector: " + err.Error())
		}
	case <-ctx.Done():
		return
	}
}
Start sends a start msg to the lifecycle goroutine. The lifecycle
goroutine manages the state machine of the reflector. Since the
lifecycle is a single goroutine it is last-write-wins.
package reflector
import (
	"context"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/segmentio/ctlstore/pkg/errs"
	"github.com/segmentio/ctlstore/pkg/utils"
	"github.com/segmentio/events/v2"
	"github.com/segmentio/stats/v4"
)
const (
	reflectorCtlTimeout = 5 * time.Second
)
type (
	ReflectorCtl struct {
		reflector ReflectorI
		closed    utils.AtomicBool
		messages  chan reflectorCtlMsg
		once      sync.Once
	}
	reflectorCtlMsg struct {
		desired bool        
		result  chan error  
	}
	ReflectorI interface {
		Start(ctx context.Context) error
		Close() error
	}
)
func NewReflectorCtl(reflector ReflectorI) *ReflectorCtl {
	ctl := &ReflectorCtl{
		reflector: reflector,
		messages:  make(chan reflectorCtlMsg),
	}
	return ctl
}
func (r *ReflectorCtl) initLifecycle(ctx context.Context) {
	r.once.Do(func() {
		go r.lifecycle(ctx)
	})
}