Beispiel #1
0
// CreateDomain ...
func (m *Manager) CreateDomain(info *datamodel.Info) error {
	infos := make(map[string]*datamodel.Info)
	for _, typ := range datamodel.GetTypesPb() {
		styp := pb.SketchType(typ)
		tmpInfo := info.Copy()
		tmpInfo.Type = &styp
		infos[tmpInfo.ID()] = tmpInfo
	}
	return m.domains.create(info.GetName(), infos)
}
Beispiel #2
0
// Copy sketch
func (info *Info) Copy() *Info {
	typ := pb.SketchType(info.GetType())
	return &Info{
		Sketch: &pb.Sketch{
			Properties: &pb.SketchProperties{
				ErrorRate:      utils.Float32p(info.Properties.GetErrorRate()),
				MaxUniqueItems: utils.Int64p(info.Properties.GetMaxUniqueItems()),
				Size:           utils.Int64p(info.Properties.GetSize()),
			},
			State: &pb.SketchState{
				FillRate:     utils.Float32p(info.State.GetFillRate()),
				LastSnapshot: utils.Int64p(info.State.GetLastSnapshot()),
			},
			Name: utils.Stringp(info.GetName()),
			Type: &typ,
		},
	}
}