func (s *MetricsStore) Replace(list []interface{}, _ string) error {
	s.mutex.Lock()
	s.metrics = map[types.UID][][]byte{}
	s.mutex.Unlock()
	for _, o := range list {
		err := s.Add(o)
		if err != nil {
			return err
		}
	}
	return nil
}
Replace will delete the contents of the store, using instead the
given list.
package metricsstore
import (
	"io"
	"sync"
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/types"
)
type FamilyByteSlicer interface {
	ByteSlice() []byte
}
type MetricsStore struct {
	mutex sync.RWMutex
	metrics map[types.UID][][]byte
	headers []string
	generateMetricsFunc func(interface{}) []FamilyByteSlicer
}
func NewMetricsStore(headers []string, generateFunc func(interface{}) []FamilyByteSlicer) *MetricsStore {
	return &MetricsStore{
		generateMetricsFunc: generateFunc,
		headers:             headers,
		metrics:             map[types.UID][][]byte{},
	}
}
func (s *MetricsStore) Add(obj interface{}) error {
	o, err := meta.Accessor(obj)
	if err != nil {
		return err
	}
	s.mutex.Lock()
	defer s.mutex.Unlock()
	families := s.generateMetricsFunc(obj)
	familyStrings := make([][]byte, len(families))
	for i, f := range families {
		familyStrings[i] = f.ByteSlice()
	}
	s.metrics[o.GetUID()] = familyStrings
	return nil
}
func (s *MetricsStore) Update(obj interface{}) error {
	return s.Add(obj)
}
func (s *MetricsStore) Delete(obj interface{}) error {
	o, err := meta.Accessor(obj)
	if err != nil {
		return err
	}
	s.mutex.Lock()
	defer s.mutex.Unlock()
	delete(s.metrics, o.GetUID())
	return nil
}
func (s *MetricsStore) List() []interface{} {
	return nil
}
func (s *MetricsStore) ListKeys() []string {
	return nil
}
func (s *MetricsStore) Get(obj interface{}) (item interface{}, exists bool, err error) {
	return nil, false, nil
}
func (s *MetricsStore) GetByKey(key string) (item interface{}, exists bool, err error) {
	return nil, false, nil
}