func (s *Admin) DeleteSeries(_ context.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) {
	mint, maxt, err := extractTimeRange(r.MinTime, r.MaxTime)
	if err != nil {
		return nil, status.Error(codes.InvalidArgument, err.Error())
	}
	var matchers tsdbLabels.Selector

	for _, m := range r.Matchers {
		var lm tsdbLabels.Matcher
		var err error

		switch m.Type {
		case pb.LabelMatcher_EQ:
			lm = tsdbLabels.NewEqualMatcher(m.Name, m.Value)
		case pb.LabelMatcher_NEQ:
			lm = tsdbLabels.Not(tsdbLabels.NewEqualMatcher(m.Name, m.Value))
		case pb.LabelMatcher_RE:
			lm, err = tsdbLabels.NewRegexpMatcher(m.Name, m.Value)
			if err != nil {
				return nil, status.Errorf(codes.InvalidArgument, "bad regexp matcher: %s", err)
			}
		case pb.LabelMatcher_NRE:
			lm, err = tsdbLabels.NewRegexpMatcher(m.Name, m.Value)
			if err != nil {
				return nil, status.Errorf(codes.InvalidArgument, "bad regexp matcher: %s", err)
			}
			lm = tsdbLabels.Not(lm)
		default:
			return nil, status.Error(codes.InvalidArgument, "unknown matcher type")
		}

		matchers = append(matchers, lm)
	}
	db := s.db()
	if db == nil {
		return nil, errTSDBNotReady
	}
	if err := db.Delete(timestamp.FromTime(mint), timestamp.FromTime(maxt), matchers...); err != nil {
		return nil, status.Error(codes.Internal, err.Error())
	}
	return &pb.SeriesDeleteResponse{}, nil
}
func (s *Admin) DeleteSeries(_ context.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) {
	mint, maxt, err := extractTimeRange(r.MinTime, r.MaxTime)
	if err != nil {
		return nil, status.Error(codes.InvalidArgument, err.Error())
	}
	var matchers tsdbLabels.Selector

	for _, m := range r.Matchers {
		var lm tsdbLabels.Matcher
		var err error

		switch m.Type {
		case pb.LabelMatcher_EQ:
			lm = tsdbLabels.NewEqualMatcher(m.Name, m.Value)
		case pb.LabelMatcher_NEQ:
			lm = tsdbLabels.Not(tsdbLabels.NewEqualMatcher(m.Name, m.Value))
		case pb.LabelMatcher_RE:
			lm, err = tsdbLabels.NewRegexpMatcher(m.Name, m.Value)
			if err != nil {
				return nil, status.Errorf(codes.InvalidArgument, "bad regexp matcher: %s", err)
			}
		case pb.LabelMatcher_NRE:
			lm, err = tsdbLabels.NewRegexpMatcher(m.Name, m.Value)
			if err != nil {
				return nil, status.Errorf(codes.InvalidArgument, "bad regexp matcher: %s", err)
			}
			lm = tsdbLabels.Not(lm)
		default:
			return nil, status.Error(codes.InvalidArgument, "unknown matcher type")
		}

		matchers = append(matchers, lm)
	}
	db := s.db()
	if db == nil {
		return nil, errTSDBNotReady
	}
	if err := db.Delete(timestamp.FromTime(mint), timestamp.FromTime(maxt), matchers...); err != nil {
		return nil, status.Error(codes.Internal, err.Error())
	}
	return &pb.SeriesDeleteResponse{}, nil
}
func ( s * Admin ) DeleteSeries ( _ context . Context , r * pb . SeriesDeleteRequest ) ( * pb . SeriesDeleteResponse , error ) { mint , maxt , err := extractTimeRange ( r . MinTime , r . MaxTime ) if err != nil { return nil , status . Error ( codes . InvalidArgument , err . Error ( ) ) } var matchers tsdbLabels . Selector for _ , m := range r . Matchers { var lm tsdbLabels . Matcher var err error switch m . Type { case pb . LabelMatcher_EQ : lm = tsdbLabels . NewEqualMatcher ( m . Name , m . Value ) case pb . LabelMatcher_NEQ : lm = tsdbLabels . Not ( tsdbLabels . NewEqualMatcher ( m . Name , m . Value ) ) case pb . LabelMatcher_RE : lm , err = tsdbLabels . NewRegexpMatcher ( m . Name , m . Value ) if err != nil { return nil , status . Errorf ( codes . InvalidArgument , " " , err ) } case pb . LabelMatcher_NRE : lm , err = tsdbLabels . NewRegexpMatcher ( m . Name , m . Value ) if err != nil { return nil , status . Errorf ( codes . InvalidArgument , " " , err ) } lm = tsdbLabels . Not ( lm ) default : return nil , status . Error ( codes . InvalidArgument , " " ) } matchers = append ( matchers , lm ) } db := s . db ( ) if db == nil { return nil , errTSDBNotReady } if err := db . Delete ( timestamp . FromTime ( mint ) , timestamp . FromTime ( maxt ) , matchers ... ) ; err != nil { return nil , status . Error ( codes . Internal , err . Error ( ) ) } return & pb . SeriesDeleteResponse { } , nil }
// DeleteSeries implements pb.AdminServer.
DeleteSeries implements pb . AdminServer .