func (b *Buffered) Write(stats Stats) ([]Stats, error) {
	return b.write(stats)
}
Write buffers data. When size pieces of data are buffered, Write bulk
clears the buffer, and returns the pieces written or the pieces that would
have been written if there was any error.
When simply adding to the buffer instead of bulk writing, Write always
returns nil, nil.
package cis
import (
	"github.com/Symantec/scotty/lib/queuesender"
	"github.com/Symantec/scotty/lib/synchttp"
	"github.com/Symantec/scotty/metrics"
	"sync"
	"time"
)
type PackageEntry struct {
	Name string
	Version string
	Size uint64
}
type PackageInfo struct {
	ManagementType string
	Packages []PackageEntry
}
func (p *PackageInfo) Equals(rhs *PackageInfo) bool {
	return p.equals(rhs)
}
type Stats struct {
	TimeStamp time.Time
	InstanceId string
	Packages PackageInfo
}
func (s *Stats) Key() interface{} {
	return s.InstanceId
}
func GetStats(list metrics.List, optInstanceId string) *Stats {
	return getStats(list, optInstanceId)
}
type Config struct {
	Endpoint string
	DataCenter string
	Name string
}
type Client struct {
	endpoint   string
	dataCenter string
	sync       synchttp.JSONWriter
	async      *queuesender.Sender
}
func NewClient(config Config) (*Client, error) {
	if config.Name != "" {
		sender, err := queuesender.New(config.Endpoint, 2000, "", nil)
		if err != nil {
			return nil, err
		}
		sender.Register(config.Name)
		return &Client{
			endpoint:   config.Endpoint,
			dataCenter: config.DataCenter,
			async:      sender,
		}, nil
	} else {
		writer, err := synchttp.NewSyncJSONWriter()
		if err != nil {
			return nil, err
		}
		return &Client{
			endpoint:   config.Endpoint,
			dataCenter: config.DataCenter,
			sync:       writer,
		}, nil
	}
}
func (c *Client) Write(stats *Stats) error {
	return c.write(stats)
}
func (c *Client) WriteAll(stats []Stats) error {
	return c.writeAll(stats)
}
type BulkWriter interface {
	WriteAll(stats []Stats) error
}
type Buffered struct {
	mu        sync.Mutex
	statsList []Stats
	writer    BulkWriter
}
func NewBuffered(size int, writer BulkWriter) *Buffered {
	return &Buffered{
		statsList: make([]Stats, 0, size),
		writer:    writer,
	}
}