diff --git a/CHANGELOG.md b/CHANGELOG.md index df0598395a..ff02c9152c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ ### Bug Fixes +1. [17257](https://github.com/influxdata/influxdb/pull/17769): Fix retention policy after bucket is migrated 1. [17612](https://github.com/influxdata/influxdb/pull/17612): Fix card size and layout jank in dashboards index view 1. [17651](https://github.com/influxdata/influxdb/pull/17651): Fix check graph font and lines defaulting to black causing graph to be unreadable 1. [17660](https://github.com/influxdata/influxdb/pull/17660): Fix text wrapping display issue and popover sizing bug when adding labels to a resource diff --git a/cmd/influx/pkg.go b/cmd/influx/pkg.go index ece0f06876..f0a3308b99 100644 --- a/cmd/influx/pkg.go +++ b/cmd/influx/pkg.go @@ -1080,7 +1080,7 @@ func (b *cmdPkgBuilder) printPkgSummary(sum pkger.Summary) error { v.Description, v.Every, v.Offset, - v.EndpointName, + v.EndpointPkgName, v.EndpointID.String(), v.EndpointType, } diff --git a/cmd/influxd/launcher/pkger_test.go b/cmd/influxd/launcher/pkger_test.go index 7002e011d6..37695bc19a 100644 --- a/cmd/influxd/launcher/pkger_test.go +++ b/cmd/influxd/launcher/pkger_test.go @@ -679,7 +679,7 @@ spec: assert.NotZero(t, rule.ID) assert.Equal(t, "rule_0", rule.Name) assert.Equal(t, pkger.SafeID(endpoints[0].NotificationEndpoint.GetID()), rule.EndpointID) - assert.Equal(t, "http_none_auth_notification_endpoint", rule.EndpointName) + assert.Equal(t, "http_none_auth_notification_endpoint", rule.EndpointPkgName) assert.Equalf(t, "http", rule.EndpointType, "rule: %+v", rule) require.Len(t, sum1.Tasks, 1) @@ -801,7 +801,7 @@ spec: rule := sum.NotificationRules[0] assert.Equal(t, "rule_0", rule.Name) assert.Equal(t, pkger.SafeID(endpoints[0].NotificationEndpoint.GetID()), rule.EndpointID) - assert.NotEmpty(t, rule.EndpointName) + assert.NotEmpty(t, rule.EndpointPkgName) require.Len(t, sum.Tasks, 1) task := sum.Tasks[0] @@ -1107,7 +1107,7 @@ spec: newRule := newSum.NotificationRules[0] assert.Equal(t, "new rule name", newRule.Name) assert.Zero(t, newRule.EndpointID) - assert.NotEmpty(t, newRule.EndpointName) + assert.NotEmpty(t, newRule.EndpointPkgName) hasLabelAssociations(t, newRule.LabelAssociations, 1, "label_1") require.Len(t, newSum.Tasks, 1) @@ -1403,7 +1403,7 @@ spec: assert.Equal(t, "endpoint_threeve", sum.NotificationEndpoints[0].NotificationEndpoint.GetName()) assert.Equal(t, "label_threeve", sum.Labels[0].Name) assert.Equal(t, "rule_threeve", sum.NotificationRules[0].Name) - assert.Equal(t, "endpoint_threeve", sum.NotificationRules[0].EndpointName) + assert.Equal(t, "endpoint_threeve", sum.NotificationRules[0].EndpointPkgName) assert.Equal(t, "telegraf_threeve", sum.TelegrafConfigs[0].TelegrafConfig.Name) assert.Equal(t, "task_threeve", sum.Tasks[0].Name) assert.Equal(t, "var_threeve", sum.Variables[0].Name) diff --git a/go.mod b/go.mod index 66eef18100..fb0073193d 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493 // indirect github.com/go-chi/chi v4.1.0+incompatible - github.com/gogo/protobuf v1.2.1 + github.com/gogo/protobuf v1.3.1 github.com/golang/gddo v0.0.0-20181116215533-9bd4a3295021 github.com/golang/protobuf v1.3.2 github.com/golang/snappy v0.0.1 diff --git a/go.sum b/go.sum index 99541ebf66..828d205664 100644 --- a/go.sum +++ b/go.sum @@ -137,6 +137,8 @@ github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/gddo v0.0.0-20181116215533-9bd4a3295021 h1:HYV500jCgk+IC68L5sWrLFIWMpaUFfXXpJSAb7XOoBk= github.com/golang/gddo v0.0.0-20181116215533-9bd4a3295021/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= @@ -281,6 +283,7 @@ github.com/kamilsk/retry v0.0.0-20181229152359-495c1d672c93/go.mod h1:vW4uuVWZOG github.com/kevinburke/go-bindata v3.11.0+incompatible h1:RcC+GJNmrBHbGaOpQ9MBD8z22rdzlIm0esDRDkyxd4s= github.com/kevinburke/go-bindata v3.11.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= @@ -587,6 +590,7 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= diff --git a/http/swagger.yml b/http/swagger.yml index 1bf975cf4b..8d769b8096 100644 --- a/http/swagger.yml +++ b/http/swagger.yml @@ -7432,7 +7432,7 @@ components: type: string description: type: string - endpointName: + endpointPkgName: type: string endpointID: type: string @@ -7677,8 +7677,8 @@ components: items: type: object properties: - remove: - type: boolean + stateStatus: + type: string id: type: string pkgName: diff --git a/pkger/models.go b/pkger/models.go index 4e2c095104..2f056f0a3b 100644 --- a/pkger/models.go +++ b/pkger/models.go @@ -3,16 +3,12 @@ package pkger import ( "encoding/json" "errors" - "fmt" "reflect" - "sort" "time" "github.com/influxdata/influxdb/v2" - "github.com/influxdata/influxdb/v2/notification" icheck "github.com/influxdata/influxdb/v2/notification/check" "github.com/influxdata/influxdb/v2/notification/endpoint" - "github.com/influxdata/influxdb/v2/notification/rule" ) // Package kind types. @@ -363,78 +359,6 @@ type ( } ) -func newDiffNotificationRule(r *notificationRule, iEndpoint influxdb.NotificationEndpoint) DiffNotificationRule { - sum := DiffNotificationRule{ - DiffIdentifier: DiffIdentifier{ - ID: SafeID(r.ID()), - Remove: r.shouldRemove, - PkgName: r.PkgName(), - }, - New: DiffNotificationRuleValues{ - Name: r.Name(), - Description: r.description, - EndpointName: r.endpointName.String(), - Every: r.every.String(), - Offset: r.offset.String(), - MessageTemplate: r.msgTemplate, - StatusRules: toSummaryStatusRules(r.statusRules), - TagRules: toSummaryTagRules(r.tagRules), - }, - } - if iEndpoint != nil { - sum.New.EndpointID = SafeID(iEndpoint.GetID()) - sum.New.EndpointType = iEndpoint.Type() - } - - if r.existing == nil { - return sum - } - - sum.Old = &DiffNotificationRuleValues{ - Name: r.existing.rule.GetName(), - Description: r.existing.rule.GetDescription(), - EndpointName: r.existing.endpointName, - EndpointID: SafeID(r.existing.rule.GetEndpointID()), - EndpointType: r.existing.endpointType, - } - - assignBase := func(b rule.Base) { - if b.Every != nil { - sum.Old.Every = b.Every.TimeDuration().String() - } - if b.Offset != nil { - sum.Old.Offset = b.Offset.TimeDuration().String() - } - for _, tr := range b.TagRules { - sum.Old.TagRules = append(sum.Old.TagRules, SummaryTagRule{ - Key: tr.Key, - Value: tr.Value, - Operator: tr.Operator.String(), - }) - } - for _, sr := range b.StatusRules { - sRule := SummaryStatusRule{CurrentLevel: sr.CurrentLevel.String()} - if sr.PreviousLevel != nil { - sRule.PreviousLevel = sr.PreviousLevel.String() - } - sum.Old.StatusRules = append(sum.Old.StatusRules, sRule) - } - } - - switch p := r.existing.rule.(type) { - case *rule.HTTP: - assignBase(p.Base) - case *rule.Slack: - assignBase(p.Base) - sum.Old.MessageTemplate = p.MessageTemplate - case *rule.PagerDuty: - assignBase(p.Base) - sum.Old.MessageTemplate = p.MessageTemplate - } - - return sum -} - type ( // DiffTask is a diff of an individual task. DiffTask struct { @@ -636,10 +560,10 @@ type ( Name string `json:"name"` Description string `json:"description"` - // These 3 fields represent the relationship of the rule to the endpoint. - EndpointID SafeID `json:"endpointID"` - EndpointName string `json:"endpointName"` - EndpointType string `json:"endpointType"` + // These fields represent the relationship of the rule to the endpoint. + EndpointID SafeID `json:"endpointID"` + EndpointPkgName string `json:"endpointPkgName"` + EndpointType string `json:"endpointType"` Every string `json:"every"` LabelAssociations []SummaryLabel `json:"labelAssociations"` @@ -719,344 +643,3 @@ type SummaryVariable struct { Arguments *influxdb.VariableArguments `json:"arguments"` LabelAssociations []SummaryLabel `json:"labelAssociations"` } - -const ( - fieldNotificationRuleChannel = "channel" - fieldNotificationRuleCurrentLevel = "currentLevel" - fieldNotificationRuleEndpointName = "endpointName" - fieldNotificationRuleMessageTemplate = "messageTemplate" - fieldNotificationRulePreviousLevel = "previousLevel" - fieldNotificationRuleStatusRules = "statusRules" - fieldNotificationRuleTagRules = "tagRules" -) - -type notificationRule struct { - identity - - id influxdb.ID - orgID influxdb.ID - - channel string - description string - every time.Duration - msgTemplate string - offset time.Duration - status string - statusRules []struct{ curLvl, prevLvl string } - tagRules []struct{ k, v, op string } - - endpointID influxdb.ID - endpointName *references - endpointType string - - existing *existingRule - - labels sortedLabels -} - -type existingRule struct { - rule influxdb.NotificationRule - endpointName string - endpointType string -} - -func (r *notificationRule) Exists() bool { - return r.existing != nil -} - -func (r *notificationRule) ID() influxdb.ID { - if r.existing != nil { - return r.existing.rule.GetID() - } - return r.id -} - -func (r *notificationRule) Labels() []*label { - return r.labels -} - -func (r *notificationRule) ResourceType() influxdb.ResourceType { - return KindNotificationRule.ResourceType() -} - -func (r *notificationRule) Status() influxdb.Status { - if r.status == "" { - return influxdb.Active - } - return influxdb.Status(r.status) -} - -func (r *notificationRule) summarize() SummaryNotificationRule { - return SummaryNotificationRule{ - ID: SafeID(r.ID()), - PkgName: r.PkgName(), - Name: r.Name(), - EndpointID: SafeID(r.endpointID), - EndpointName: r.endpointName.String(), - EndpointType: r.endpointType, - Description: r.description, - Every: r.every.String(), - LabelAssociations: toSummaryLabels(r.labels...), - Offset: r.offset.String(), - MessageTemplate: r.msgTemplate, - Status: r.Status(), - StatusRules: toSummaryStatusRules(r.statusRules), - TagRules: toSummaryTagRules(r.tagRules), - } -} - -func (r *notificationRule) toInfluxRule() influxdb.NotificationRule { - base := rule.Base{ - ID: r.ID(), - Name: r.Name(), - Description: r.description, - EndpointID: r.endpointID, - OrgID: r.orgID, - Every: toNotificationDuration(r.every), - Offset: toNotificationDuration(r.offset), - } - for _, sr := range r.statusRules { - var prevLvl *notification.CheckLevel - if lvl := notification.ParseCheckLevel(sr.prevLvl); lvl != notification.Unknown { - prevLvl = &lvl - } - base.StatusRules = append(base.StatusRules, notification.StatusRule{ - CurrentLevel: notification.ParseCheckLevel(sr.curLvl), - PreviousLevel: prevLvl, - }) - } - for _, tr := range r.tagRules { - op, _ := influxdb.ToOperator(tr.op) - base.TagRules = append(base.TagRules, notification.TagRule{ - Tag: influxdb.Tag{ - Key: tr.k, - Value: tr.v, - }, - Operator: op, - }) - } - - switch r.endpointType { - case "http": - return &rule.HTTP{Base: base} - case "pagerduty": - return &rule.PagerDuty{ - Base: base, - MessageTemplate: r.msgTemplate, - } - case "slack": - return &rule.Slack{ - Base: base, - Channel: r.channel, - MessageTemplate: r.msgTemplate, - } - } - return nil -} - -func (r *notificationRule) valid() []validationErr { - var vErrs []validationErr - if !r.endpointName.hasValue() { - vErrs = append(vErrs, validationErr{ - Field: fieldNotificationRuleEndpointName, - Msg: "must be provided", - }) - } - if r.every == 0 { - vErrs = append(vErrs, validationErr{ - Field: fieldEvery, - Msg: "must be provided", - }) - } - if status := r.Status(); status != influxdb.Active && status != influxdb.Inactive { - vErrs = append(vErrs, validationErr{ - Field: fieldStatus, - Msg: fmt.Sprintf("must be 1 in [active, inactive]; got=%q", r.status), - }) - } - - if len(r.statusRules) == 0 { - vErrs = append(vErrs, validationErr{ - Field: fieldNotificationRuleStatusRules, - Msg: "must provide at least 1", - }) - } - - var sRuleErrs []validationErr - for i, sRule := range r.statusRules { - if notification.ParseCheckLevel(sRule.curLvl) == notification.Unknown { - sRuleErrs = append(sRuleErrs, validationErr{ - Field: fieldNotificationRuleCurrentLevel, - Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", sRule.curLvl), - Index: intPtr(i), - }) - } - if sRule.prevLvl != "" && notification.ParseCheckLevel(sRule.prevLvl) == notification.Unknown { - sRuleErrs = append(sRuleErrs, validationErr{ - Field: fieldNotificationRulePreviousLevel, - Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", sRule.prevLvl), - Index: intPtr(i), - }) - } - } - if len(sRuleErrs) > 0 { - vErrs = append(vErrs, validationErr{ - Field: fieldNotificationRuleStatusRules, - Nested: sRuleErrs, - }) - } - - var tagErrs []validationErr - for i, tRule := range r.tagRules { - if _, ok := influxdb.ToOperator(tRule.op); !ok { - tagErrs = append(tagErrs, validationErr{ - Field: fieldOperator, - Msg: fmt.Sprintf("must be 1 in [equal]; got=%q", tRule.op), - Index: intPtr(i), - }) - } - } - if len(tagErrs) > 0 { - vErrs = append(vErrs, validationErr{ - Field: fieldNotificationRuleTagRules, - Nested: tagErrs, - }) - } - - if len(vErrs) > 0 { - return []validationErr{ - objectValidationErr(fieldSpec, vErrs...), - } - } - - return nil -} - -func toSummaryStatusRules(statusRules []struct{ curLvl, prevLvl string }) []SummaryStatusRule { - out := make([]SummaryStatusRule, 0, len(statusRules)) - for _, sRule := range statusRules { - out = append(out, SummaryStatusRule{ - CurrentLevel: sRule.curLvl, - PreviousLevel: sRule.prevLvl, - }) - } - sort.Slice(out, func(i, j int) bool { - si, sj := out[i], out[j] - if si.CurrentLevel == sj.CurrentLevel { - return si.PreviousLevel < sj.PreviousLevel - } - return si.CurrentLevel < sj.CurrentLevel - }) - return out -} - -func toSummaryTagRules(tagRules []struct{ k, v, op string }) []SummaryTagRule { - out := make([]SummaryTagRule, 0, len(tagRules)) - for _, tRule := range tagRules { - out = append(out, SummaryTagRule{ - Key: tRule.k, - Value: tRule.v, - Operator: tRule.op, - }) - } - sort.Slice(out, func(i, j int) bool { - ti, tj := out[i], out[j] - if ti.Key == tj.Key && ti.Value == tj.Value { - return ti.Operator < tj.Operator - } - if ti.Key == tj.Key { - return ti.Value < tj.Value - } - return ti.Key < tj.Key - }) - return out -} - -type mapperNotificationRules []*notificationRule - -func (r mapperNotificationRules) Association(i int) labelAssociater { - return r[i] -} - -func (r mapperNotificationRules) Len() int { - return len(r) -} - -const ( - fieldReferencesEnv = "envRef" - fieldReferencesSecret = "secretRef" -) - -type references struct { - val interface{} - EnvRef string - Secret string -} - -func (r *references) hasValue() bool { - return r.EnvRef != "" || r.Secret != "" || r.val != nil -} - -func (r *references) String() string { - if r == nil { - return "" - } - if v := r.StringVal(); v != "" { - return v - } - if r.EnvRef != "" { - return "$" + r.EnvRef - } - return "" -} - -func (r *references) StringVal() string { - if r.val != nil { - s, _ := r.val.(string) - return s - } - return "" -} - -func (r *references) SecretField() influxdb.SecretField { - if secret := r.Secret; secret != "" { - return influxdb.SecretField{Key: secret} - } - if str := r.StringVal(); str != "" { - return influxdb.SecretField{Value: &str} - } - return influxdb.SecretField{} -} - -func isValidName(name string, minLength int) (validationErr, bool) { - if len(name) >= minLength { - return validationErr{}, true - } - return validationErr{ - Field: fieldName, - Msg: fmt.Sprintf("must be a string of at least %d chars in length", minLength), - }, false -} - -func toNotificationDuration(dur time.Duration) *notification.Duration { - d, _ := notification.FromTimeDuration(dur) - return &d -} - -func durToStr(dur time.Duration) string { - if dur == 0 { - return "" - } - return dur.String() -} - -func flt64Ptr(f float64) *float64 { - if f != 0 { - return &f - } - return nil -} - -func intPtr(i int) *int { - return &i -} diff --git a/pkger/parser.go b/pkger/parser.go index 543fd54b67..3af13e9253 100644 --- a/pkger/parser.go +++ b/pkger/parser.go @@ -385,58 +385,36 @@ func (p *Pkg) applySecrets(secrets map[string]string) { // Contains identifies if a pkg contains a given object identified // by its kind and metadata.Name (PkgName) field. func (p *Pkg) Contains(k Kind, pkgName string) bool { - _, ok := p.getObjectIDSetter(k, pkgName) - return ok -} - -// setObjectID sets the id for the resource graphed from the object the key identifies. -func (p *Pkg) setObjectID(k Kind, pkgName string, id influxdb.ID) { - idSetFn, ok := p.getObjectIDSetter(k, pkgName) - if !ok { - return - } - idSetFn(id) -} - -// setObjectID sets the id for the resource graphed from the object the key identifies. -// The pkgName and kind are used as the unique identifier, when calling this it will -// overwrite any existing value if one exists. If desired, check for the value by using -// the Contains method. -func (p *Pkg) addObjectForRemoval(k Kind, pkgName string, id influxdb.ID) { - newIdentity := identity{ - name: &references{val: pkgName}, - shouldRemove: true, - } - switch k { + case KindBucket: + _, ok := p.mBuckets[pkgName] + return ok + case KindCheck, KindCheckDeadman, KindCheckThreshold: + _, ok := p.mChecks[pkgName] + return ok case KindLabel: - p.mLabels[pkgName] = &label{ - identity: newIdentity, - id: id, - } + _, ok := p.mLabels[pkgName] + return ok + case KindNotificationEndpoint, + KindNotificationEndpointHTTP, + KindNotificationEndpointPagerDuty, + KindNotificationEndpointSlack: + _, ok := p.mNotificationEndpoints[pkgName] + return ok case KindNotificationRule: - p.mNotificationRules[pkgName] = ¬ificationRule{ - identity: newIdentity, - id: id, - } - } -} - -func (p *Pkg) getObjectIDSetter(k Kind, pkgName string) (func(influxdb.ID), bool) { - switch k { - case KindLabel: - l, ok := p.mLabels[pkgName] - return func(id influxdb.ID) { - l.id = id - }, ok - case KindNotificationRule: - r, ok := p.mNotificationRules[pkgName] - return func(id influxdb.ID) { - r.id = id - }, ok - default: - return nil, false + _, ok := p.mNotificationRules[pkgName] + return ok + case KindTask: + _, ok := p.mTasks[pkgName] + return ok + case KindTelegraf: + _, ok := p.mTelegrafs[pkgName] + return ok + case KindVariable: + _, ok := p.mVariables[pkgName] + return ok } + return false } // Combine combines pkgs together. Is useful when you want to take multiple disparate pkgs @@ -996,6 +974,8 @@ func (p *Pkg) graphNotificationRules() *parseErr { }) } + rule.associatedEndpoint = p.mNotificationEndpoints[rule.endpointName.String()] + failures := p.parseNestedLabels(o.Spec, func(l *label) error { rule.labels = append(rule.labels, l) p.mLabels[l.PkgName()].setMapping(rule, false) diff --git a/pkger/parser_models.go b/pkger/parser_models.go index 79c6b7575b..dbe1befee3 100644 --- a/pkger/parser_models.go +++ b/pkger/parser_models.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" "regexp" + "sort" "strconv" "strings" "time" @@ -12,6 +13,7 @@ import ( "github.com/influxdata/influxdb/v2/notification" icheck "github.com/influxdata/influxdb/v2/notification/check" "github.com/influxdata/influxdb/v2/notification/endpoint" + "github.com/influxdata/influxdb/v2/notification/rule" ) type identity struct { @@ -307,6 +309,83 @@ func (c *check) valid() []validationErr { return nil } +type thresholdType string + +const ( + thresholdTypeGreater thresholdType = "greater" + thresholdTypeLesser thresholdType = "lesser" + thresholdTypeInsideRange thresholdType = "inside_range" + thresholdTypeOutsideRange thresholdType = "outside_range" +) + +var thresholdTypes = map[thresholdType]bool{ + thresholdTypeGreater: true, + thresholdTypeLesser: true, + thresholdTypeInsideRange: true, + thresholdTypeOutsideRange: true, +} + +type threshold struct { + threshType thresholdType + allVals bool + level string + val float64 + min, max float64 +} + +func (t threshold) valid() []validationErr { + var vErrs []validationErr + if notification.ParseCheckLevel(t.level) == notification.Unknown { + vErrs = append(vErrs, validationErr{ + Field: fieldLevel, + Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", t.level), + }) + } + if !thresholdTypes[t.threshType] { + vErrs = append(vErrs, validationErr{ + Field: fieldType, + Msg: fmt.Sprintf("must be 1 in [Lesser, Greater, Inside_Range, Outside_Range]; got=%q", t.threshType), + }) + } + if t.min > t.max { + vErrs = append(vErrs, validationErr{ + Field: fieldMin, + Msg: "min must be < max", + }) + } + return vErrs +} + +func toInfluxThresholds(thresholds ...threshold) []icheck.ThresholdConfig { + var iThresh []icheck.ThresholdConfig + for _, th := range thresholds { + base := icheck.ThresholdConfigBase{ + AllValues: th.allVals, + Level: notification.ParseCheckLevel(th.level), + } + switch th.threshType { + case thresholdTypeGreater: + iThresh = append(iThresh, icheck.Greater{ + ThresholdConfigBase: base, + Value: th.val, + }) + case thresholdTypeLesser: + iThresh = append(iThresh, icheck.Lesser{ + ThresholdConfigBase: base, + Value: th.val, + }) + case thresholdTypeInsideRange, thresholdTypeOutsideRange: + iThresh = append(iThresh, icheck.Range{ + ThresholdConfigBase: base, + Max: th.max, + Min: th.min, + Within: th.threshType == thresholdTypeInsideRange, + }) + } + } + return iThresh +} + // chartKind identifies what kind of chart is eluded too. Each // chart kind has their own requirements for what constitutes // a chart. @@ -996,13 +1075,6 @@ type assocMapVal struct { v interface{} } -func (l assocMapVal) ID() influxdb.ID { - if t, ok := l.v.(labelAssociater); ok { - return t.ID() - } - return 0 -} - func (l assocMapVal) PkgName() string { t, ok := l.v.(interface{ PkgName() string }) if ok { @@ -1055,17 +1127,11 @@ const ( const labelNameMinLength = 2 type label struct { - id influxdb.ID identity Color string Description string associationMapping - - // exists provides context for a resource that already - // exists in the platform. If a resource already exists(exists=true) - // then the ID should be populated. - existing *influxdb.Label } func (l *label) summarize() SummaryLabel { @@ -1093,11 +1159,9 @@ func (l *label) mappingSummary() []SummaryLabelMapping { mappings = append(mappings, SummaryLabelMapping{ exists: v.exists, Status: status, - ResourceID: SafeID(v.ID()), ResourcePkgName: v.PkgName(), ResourceName: resource.name, ResourceType: resource.resType, - LabelID: SafeID(l.ID()), LabelPkgName: l.PkgName(), LabelName: l.Name(), }) @@ -1107,16 +1171,6 @@ func (l *label) mappingSummary() []SummaryLabelMapping { return mappings } -func (l *label) ID() influxdb.ID { - if l.id != 0 { - return l.id - } - if l.existing != nil { - return l.existing.ID - } - return 0 -} - func (l *label) valid() []validationErr { var vErrs []validationErr if err, ok := isValidName(l.Name(), labelNameMinLength); !ok { @@ -1152,83 +1206,6 @@ func (s sortedLabels) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -type thresholdType string - -const ( - thresholdTypeGreater thresholdType = "greater" - thresholdTypeLesser thresholdType = "lesser" - thresholdTypeInsideRange thresholdType = "inside_range" - thresholdTypeOutsideRange thresholdType = "outside_range" -) - -var thresholdTypes = map[thresholdType]bool{ - thresholdTypeGreater: true, - thresholdTypeLesser: true, - thresholdTypeInsideRange: true, - thresholdTypeOutsideRange: true, -} - -type threshold struct { - threshType thresholdType - allVals bool - level string - val float64 - min, max float64 -} - -func (t threshold) valid() []validationErr { - var vErrs []validationErr - if notification.ParseCheckLevel(t.level) == notification.Unknown { - vErrs = append(vErrs, validationErr{ - Field: fieldLevel, - Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", t.level), - }) - } - if !thresholdTypes[t.threshType] { - vErrs = append(vErrs, validationErr{ - Field: fieldType, - Msg: fmt.Sprintf("must be 1 in [Lesser, Greater, Inside_Range, Outside_Range]; got=%q", t.threshType), - }) - } - if t.min > t.max { - vErrs = append(vErrs, validationErr{ - Field: fieldMin, - Msg: "min must be < max", - }) - } - return vErrs -} - -func toInfluxThresholds(thresholds ...threshold) []icheck.ThresholdConfig { - var iThresh []icheck.ThresholdConfig - for _, th := range thresholds { - base := icheck.ThresholdConfigBase{ - AllValues: th.allVals, - Level: notification.ParseCheckLevel(th.level), - } - switch th.threshType { - case thresholdTypeGreater: - iThresh = append(iThresh, icheck.Greater{ - ThresholdConfigBase: base, - Value: th.val, - }) - case thresholdTypeLesser: - iThresh = append(iThresh, icheck.Lesser{ - ThresholdConfigBase: base, - Value: th.val, - }) - case thresholdTypeInsideRange, thresholdTypeOutsideRange: - iThresh = append(iThresh, icheck.Range{ - ThresholdConfigBase: base, - Max: th.max, - Min: th.min, - Within: th.threshType == thresholdTypeInsideRange, - }) - } - } - return iThresh -} - type notificationEndpointKind int const ( @@ -1237,6 +1214,17 @@ const ( notificationKindSlack ) +func (n notificationEndpointKind) String() string { + if n > 0 && n < 4 { + return [...]string{ + endpoint.HTTPType, + endpoint.PagerDutyType, + endpoint.SlackType, + }[n-1] + } + return "" +} + const ( notificationHTTPAuthTypeBasic = "basic" notificationHTTPAuthTypeBearer = "bearer" @@ -1423,6 +1411,242 @@ func (n *notificationEndpoint) valid() []validationErr { return nil } +const ( + fieldNotificationRuleChannel = "channel" + fieldNotificationRuleCurrentLevel = "currentLevel" + fieldNotificationRuleEndpointName = "endpointName" + fieldNotificationRuleMessageTemplate = "messageTemplate" + fieldNotificationRulePreviousLevel = "previousLevel" + fieldNotificationRuleStatusRules = "statusRules" + fieldNotificationRuleTagRules = "tagRules" +) + +type notificationRule struct { + identity + + channel string + description string + every time.Duration + msgTemplate string + offset time.Duration + status string + statusRules []struct{ curLvl, prevLvl string } + tagRules []struct{ k, v, op string } + + associatedEndpoint *notificationEndpoint + endpointName *references + + labels sortedLabels +} + +func (r *notificationRule) Labels() []*label { + return r.labels +} + +func (r *notificationRule) ResourceType() influxdb.ResourceType { + return KindNotificationRule.ResourceType() +} + +func (r *notificationRule) Status() influxdb.Status { + if r.status == "" { + return influxdb.Active + } + return influxdb.Status(r.status) +} + +func (r *notificationRule) summarize() SummaryNotificationRule { + var endpointPkgName, endpointType string + if r.associatedEndpoint != nil { + endpointPkgName = r.associatedEndpoint.PkgName() + endpointType = r.associatedEndpoint.kind.String() + } + + return SummaryNotificationRule{ + PkgName: r.PkgName(), + Name: r.Name(), + EndpointPkgName: endpointPkgName, + EndpointType: endpointType, + Description: r.description, + Every: r.every.String(), + LabelAssociations: toSummaryLabels(r.labels...), + Offset: r.offset.String(), + MessageTemplate: r.msgTemplate, + Status: r.Status(), + StatusRules: toSummaryStatusRules(r.statusRules), + TagRules: toSummaryTagRules(r.tagRules), + } +} + +func (r *notificationRule) toInfluxRule() influxdb.NotificationRule { + base := rule.Base{ + Name: r.Name(), + Description: r.description, + Every: toNotificationDuration(r.every), + Offset: toNotificationDuration(r.offset), + } + for _, sr := range r.statusRules { + var prevLvl *notification.CheckLevel + if lvl := notification.ParseCheckLevel(sr.prevLvl); lvl != notification.Unknown { + prevLvl = &lvl + } + base.StatusRules = append(base.StatusRules, notification.StatusRule{ + CurrentLevel: notification.ParseCheckLevel(sr.curLvl), + PreviousLevel: prevLvl, + }) + } + for _, tr := range r.tagRules { + op, _ := influxdb.ToOperator(tr.op) + base.TagRules = append(base.TagRules, notification.TagRule{ + Tag: influxdb.Tag{ + Key: tr.k, + Value: tr.v, + }, + Operator: op, + }) + } + + switch r.associatedEndpoint.kind { + case notificationKindHTTP: + return &rule.HTTP{Base: base} + case notificationKindPagerDuty: + return &rule.PagerDuty{ + Base: base, + MessageTemplate: r.msgTemplate, + } + case notificationKindSlack: + return &rule.Slack{ + Base: base, + Channel: r.channel, + MessageTemplate: r.msgTemplate, + } + } + return nil +} + +func (r *notificationRule) valid() []validationErr { + var vErrs []validationErr + if !r.endpointName.hasValue() { + vErrs = append(vErrs, validationErr{ + Field: fieldNotificationRuleEndpointName, + Msg: "must be provided", + }) + } else if r.associatedEndpoint == nil { + vErrs = append(vErrs, validationErr{ + Field: fieldNotificationRuleEndpointName, + Msg: fmt.Sprintf("notification endpoint %q does not exist in pkg", r.endpointName.String()), + }) + } + + if r.every == 0 { + vErrs = append(vErrs, validationErr{ + Field: fieldEvery, + Msg: "must be provided", + }) + } + if status := r.Status(); status != influxdb.Active && status != influxdb.Inactive { + vErrs = append(vErrs, validationErr{ + Field: fieldStatus, + Msg: fmt.Sprintf("must be 1 in [active, inactive]; got=%q", r.status), + }) + } + + if len(r.statusRules) == 0 { + vErrs = append(vErrs, validationErr{ + Field: fieldNotificationRuleStatusRules, + Msg: "must provide at least 1", + }) + } + + var sRuleErrs []validationErr + for i, sRule := range r.statusRules { + if notification.ParseCheckLevel(sRule.curLvl) == notification.Unknown { + sRuleErrs = append(sRuleErrs, validationErr{ + Field: fieldNotificationRuleCurrentLevel, + Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", sRule.curLvl), + Index: intPtr(i), + }) + } + if sRule.prevLvl != "" && notification.ParseCheckLevel(sRule.prevLvl) == notification.Unknown { + sRuleErrs = append(sRuleErrs, validationErr{ + Field: fieldNotificationRulePreviousLevel, + Msg: fmt.Sprintf("must be 1 in [CRIT, WARN, INFO, OK]; got=%q", sRule.prevLvl), + Index: intPtr(i), + }) + } + } + if len(sRuleErrs) > 0 { + vErrs = append(vErrs, validationErr{ + Field: fieldNotificationRuleStatusRules, + Nested: sRuleErrs, + }) + } + + var tagErrs []validationErr + for i, tRule := range r.tagRules { + if _, ok := influxdb.ToOperator(tRule.op); !ok { + tagErrs = append(tagErrs, validationErr{ + Field: fieldOperator, + Msg: fmt.Sprintf("must be 1 in [equal]; got=%q", tRule.op), + Index: intPtr(i), + }) + } + } + if len(tagErrs) > 0 { + vErrs = append(vErrs, validationErr{ + Field: fieldNotificationRuleTagRules, + Nested: tagErrs, + }) + } + + if len(vErrs) > 0 { + return []validationErr{ + objectValidationErr(fieldSpec, vErrs...), + } + } + + return nil +} + +func toSummaryStatusRules(statusRules []struct{ curLvl, prevLvl string }) []SummaryStatusRule { + out := make([]SummaryStatusRule, 0, len(statusRules)) + for _, sRule := range statusRules { + out = append(out, SummaryStatusRule{ + CurrentLevel: sRule.curLvl, + PreviousLevel: sRule.prevLvl, + }) + } + sort.Slice(out, func(i, j int) bool { + si, sj := out[i], out[j] + if si.CurrentLevel == sj.CurrentLevel { + return si.PreviousLevel < sj.PreviousLevel + } + return si.CurrentLevel < sj.CurrentLevel + }) + return out +} + +func toSummaryTagRules(tagRules []struct{ k, v, op string }) []SummaryTagRule { + out := make([]SummaryTagRule, 0, len(tagRules)) + for _, tRule := range tagRules { + out = append(out, SummaryTagRule{ + Key: tRule.k, + Value: tRule.v, + Operator: tRule.op, + }) + } + sort.Slice(out, func(i, j int) bool { + ti, tj := out[i], out[j] + if ti.Key == tj.Key && ti.Value == tj.Value { + return ti.Operator < tj.Operator + } + if ti.Key == tj.Key { + return ti.Value < tj.Value + } + return ti.Key < tj.Key + }) + return out +} + const ( fieldTaskCron = "cron" ) @@ -1724,3 +1948,82 @@ func (v *variable) valid() []validationErr { return nil } + +const ( + fieldReferencesEnv = "envRef" + fieldReferencesSecret = "secretRef" +) + +type references struct { + val interface{} + EnvRef string + Secret string +} + +func (r *references) hasValue() bool { + return r.EnvRef != "" || r.Secret != "" || r.val != nil +} + +func (r *references) String() string { + if r == nil { + return "" + } + if v := r.StringVal(); v != "" { + return v + } + if r.EnvRef != "" { + return "$" + r.EnvRef + } + return "" +} + +func (r *references) StringVal() string { + if r.val != nil { + s, _ := r.val.(string) + return s + } + return "" +} + +func (r *references) SecretField() influxdb.SecretField { + if secret := r.Secret; secret != "" { + return influxdb.SecretField{Key: secret} + } + if str := r.StringVal(); str != "" { + return influxdb.SecretField{Value: &str} + } + return influxdb.SecretField{} +} + +func isValidName(name string, minLength int) (validationErr, bool) { + if len(name) >= minLength { + return validationErr{}, true + } + return validationErr{ + Field: fieldName, + Msg: fmt.Sprintf("must be a string of at least %d chars in length", minLength), + }, false +} + +func toNotificationDuration(dur time.Duration) *notification.Duration { + d, _ := notification.FromTimeDuration(dur) + return &d +} + +func durToStr(dur time.Duration) string { + if dur == 0 { + return "" + } + return dur.String() +} + +func flt64Ptr(f float64) *float64 { + if f != 0 { + return &f + } + return nil +} + +func intPtr(i int) *int { + return &i +} diff --git a/pkger/parser_test.go b/pkger/parser_test.go index a469c49a35..75b60e92ba 100644 --- a/pkger/parser_test.go +++ b/pkger/parser_test.go @@ -3088,7 +3088,7 @@ spec: rule := rules[0] assert.Equal(t, "rule_0", rule.Name) - assert.Equal(t, "endpoint_0", rule.EndpointName) + assert.Equal(t, "endpoint_0", rule.EndpointPkgName) assert.Equal(t, "desc_0", rule.Description) assert.Equal(t, (10 * time.Minute).String(), rule.Every) assert.Equal(t, (30 * time.Second).String(), rule.Offset) @@ -3108,12 +3108,27 @@ spec: } assert.Equal(t, expectedTagRules, rule.TagRules) - require.Len(t, sum.Labels, 1) - require.Len(t, rule.LabelAssociations, 1) + require.Len(t, sum.Labels, 2) + require.Len(t, rule.LabelAssociations, 2) + assert.Equal(t, "label_1", rule.LabelAssociations[0].PkgName) + assert.Equal(t, "label_2", rule.LabelAssociations[1].PkgName) }) }) t.Run("handles bad config", func(t *testing.T) { + pkgWithValidEndpint := func(resource string) string { + return fmt.Sprintf(` +apiVersion: influxdata.com/v2alpha1 +kind: NotificationEndpointSlack +metadata: + name: endpoint_0 +spec: + url: https://hooks.slack.com/services/bip/piddy/boppidy +--- +%s +`, resource) + } + tests := []struct { kind Kind resErr testPkgResourceError @@ -3121,10 +3136,9 @@ spec: { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "missing name", - validationErrs: 1, - valFields: []string{fieldMetadata, fieldName}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "missing name", + valFields: []string{fieldMetadata, fieldName}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: spec: @@ -3133,16 +3147,15 @@ spec: messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" statusRules: - currentLevel: WARN -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "missing endpoint name", - validationErrs: 1, - valFields: []string{fieldSpec, fieldNotificationRuleEndpointName}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "missing endpoint name", + valFields: []string{fieldSpec, fieldNotificationRuleEndpointName}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3151,16 +3164,15 @@ spec: messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" statusRules: - currentLevel: WARN -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "missing every", - validationErrs: 1, - valFields: []string{fieldSpec, fieldEvery}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "missing every", + valFields: []string{fieldSpec, fieldEvery}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3169,52 +3181,49 @@ spec: messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" statusRules: - currentLevel: WARN -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "missing status rules", - validationErrs: 1, - valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "missing status rules", + valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 spec: every: 10m - endpointName: 10m + endpointName: endpoint_0 messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "bad current status rule level", - validationErrs: 1, - valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "bad current status rule level", + valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 spec: every: 10m - endpointName: 10m + endpointName: endpoint_0 messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" statusRules: - currentLevel: WRONGO -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "bad previous status rule level", - validationErrs: 1, - valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "bad previous status rule level", + valFields: []string{fieldSpec, fieldNotificationRuleStatusRules}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3225,16 +3234,15 @@ spec: statusRules: - currentLevel: CRIT previousLevel: WRONG -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "bad tag rule operator", - validationErrs: 1, - valFields: []string{fieldSpec, fieldNotificationRuleTagRules}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "bad tag rule operator", + valFields: []string{fieldSpec, fieldNotificationRuleTagRules}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3248,16 +3256,15 @@ spec: - key: k1 value: v2 operator: WRONG -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "bad status provided", - validationErrs: 1, - valFields: []string{fieldSpec, fieldStatus}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "bad status provided", + valFields: []string{fieldSpec, fieldStatus}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3268,16 +3275,15 @@ spec: status: RANDO STATUS statusRules: - currentLevel: WARN -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "label association does not exist", - validationErrs: 1, - valFields: []string{fieldSpec, fieldAssociations}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "label association does not exist", + valFields: []string{fieldSpec, fieldAssociations}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_0 @@ -3290,16 +3296,15 @@ spec: associations: - kind: Label name: label_1 -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "label association dupe", - validationErrs: 1, - valFields: []string{fieldSpec, fieldAssociations}, - pkgStr: `apiVersion: influxdata.com/v2alpha1 + name: "label association dupe", + valFields: []string{fieldSpec, fieldAssociations}, + pkgStr: pkgWithValidEndpint(`apiVersion: influxdata.com/v2alpha1 kind: Label metadata: name: label_1 @@ -3319,16 +3324,15 @@ spec: name: label_1 - kind: Label name: label_1 -`, +`), }, }, { kind: KindNotificationRule, resErr: testPkgResourceError{ - name: "duplicate meta names", - validationErrs: 1, - valFields: []string{fieldMetadata, fieldName}, - pkgStr: ` + name: "duplicate meta names", + valFields: []string{fieldMetadata, fieldName}, + pkgStr: pkgWithValidEndpint(` apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: @@ -3350,6 +3354,25 @@ spec: messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" statusRules: - currentLevel: WARN +`), + }, + }, + { + kind: KindNotificationRule, + resErr: testPkgResourceError{ + name: "missing endpoint association in pkg", + valFields: []string{fieldSpec, fieldNotificationRuleEndpointName}, + pkgStr: ` +apiVersion: influxdata.com/v2alpha1 +kind: NotificationRule +metadata: + name: rule_0 +spec: + endpointName: RANDO_ENDPOINT_NAME + every: 10m + messageTemplate: "Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }: ${ r._message }" + statusRules: + - currentLevel: WARN `, }, }, @@ -3932,7 +3955,7 @@ spec: require.Len(t, sum.NotificationRules, 1) assert.Equal(t, "$rule-1-name-ref", sum.NotificationRules[0].Name) - assert.Equal(t, "$endpoint-1-name-ref", sum.NotificationRules[0].EndpointName) + assert.Equal(t, "$endpoint-1-name-ref", sum.NotificationRules[0].EndpointPkgName) hasEnv(t, pkg.mEnv, "rule-1-name-ref") require.Len(t, sum.Tasks, 1) diff --git a/pkger/service.go b/pkger/service.go index c3dc24f976..8673525a96 100644 --- a/pkger/service.go +++ b/pkger/service.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "net/url" - "sort" "strings" "sync" "time" @@ -636,11 +635,14 @@ func (s *Service) filterOrgResourceKinds(resourceKindFilters []Kind) []struct { // for later calls to Apply. This func will be run on an Apply if it has not been run // already. func (s *Service) DryRun(ctx context.Context, orgID, userID influxdb.ID, pkg *Pkg, opts ...ApplyOptFn) (Summary, Diff, error) { - sum, diff, _, err := s.dryRun(ctx, orgID, pkg, opts...) - return sum, diff, err + state, err := s.dryRun(ctx, orgID, pkg, opts...) + if err != nil { + return Summary{}, Diff{}, err + } + return newSummaryFromStatePkg(state, pkg), state.diff(), nil } -func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts ...ApplyOptFn) (Summary, Diff, *stateCoordinator, error) { +func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts ...ApplyOptFn) (*stateCoordinator, error) { // so here's the deal, when we have issues with the parsing validation, we // continue to do the diff anyhow. any resource that does not have a name // will be skipped, and won't bleed into the dry run here. We can now return @@ -649,7 +651,7 @@ func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts if !pkg.isParsed { err := pkg.Validate() if err != nil && !IsParseErr(err) { - return Summary{}, Diff{}, nil, internalErr(err) + return nil, internalErr(err) } parseErr = err } @@ -659,7 +661,7 @@ func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts if len(opt.EnvRefs) > 0 { err := pkg.applyEnvRefs(opt.EnvRefs) if err != nil && !IsParseErr(err) { - return Summary{}, Diff{}, nil, internalErr(err) + return nil, internalErr(err) } parseErr = err } @@ -667,13 +669,13 @@ func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts state := newStateCoordinator(pkg) if opt.StackID > 0 { - if err := s.addStackState(ctx, opt.StackID, pkg, state); err != nil { - return Summary{}, Diff{}, nil, internalErr(err) + if err := s.addStackState(ctx, opt.StackID, state); err != nil { + return nil, internalErr(err) } } if err := s.dryRunSecrets(ctx, orgID, pkg); err != nil { - return Summary{}, Diff{}, nil, err + return nil, err } s.dryRunBuckets(ctx, orgID, state.mBuckets) @@ -682,41 +684,21 @@ func (s *Service) dryRun(ctx context.Context, orgID influxdb.ID, pkg *Pkg, opts s.dryRunVariables(ctx, orgID, state.mVariables) err := s.dryRunNotificationEndpoints(ctx, orgID, state.mEndpoints) if err != nil { - return Summary{}, Diff{}, nil, ierrors.Wrap(err, "failed to dry run notification endpoints") + return nil, ierrors.Wrap(err, "failed to dry run notification endpoints") } - var diff Diff - diffRules, err := s.dryRunNotificationRules(ctx, orgID, pkg) + err = s.dryRunNotificationRules(ctx, orgID, state.mRules, state.mEndpoints) if err != nil { - return Summary{}, Diff{}, nil, err + return nil, err } - diff.NotificationRules = diffRules - stateLabelMappings, err := s.dryRunLabelMappingsV2(ctx, state) + stateLabelMappings, err := s.dryRunLabelMappings(ctx, state) if err != nil { - return Summary{}, Diff{}, nil, err + return nil, err } state.labelMappings = stateLabelMappings - stateDiff := state.diff() - - diffLabelMappings, err := s.dryRunLabelMappings(ctx, pkg, state) - if err != nil { - return Summary{}, Diff{}, nil, err - } - diff.LabelMappings = append(diffLabelMappings, diffLabelMappings...) - - diff.Buckets = stateDiff.Buckets - diff.Checks = stateDiff.Checks - diff.Dashboards = stateDiff.Dashboards - diff.NotificationEndpoints = stateDiff.NotificationEndpoints - diff.Labels = stateDiff.Labels - diff.Tasks = stateDiff.Tasks - diff.Telegrafs = stateDiff.Telegrafs - diff.Variables = stateDiff.Variables - diff.LabelMappings = append(stateDiff.LabelMappings, diff.LabelMappings...) - - return newSummaryFromStatePkg(pkg, state), diff, state, parseErr + return state, parseErr } func (s *Service) dryRunBuckets(ctx context.Context, orgID influxdb.ID, bkts map[string]*stateBucket) { @@ -804,26 +786,12 @@ func (s *Service) dryRunNotificationEndpoints(ctx context.Context, orgID influxd return nil } -func (s *Service) dryRunNotificationRules(ctx context.Context, orgID influxdb.ID, pkg *Pkg) ([]DiffNotificationRule, error) { - iEndpoints, _, err := s.endpointSVC.FindNotificationEndpoints(ctx, influxdb.NotificationEndpointFilter{ - OrgID: &orgID, - }) - if err != nil { - return nil, internalErr(err) - } - - mExistingEndpointsByName := make(map[string]influxdb.NotificationEndpoint) - mExistingEndpointsByID := make(map[influxdb.ID]influxdb.NotificationEndpoint) - for _, e := range iEndpoints { - mExistingEndpointsByName[e.GetName()] = e - mExistingEndpointsByID[e.GetID()] = e - } - +func (s *Service) dryRunNotificationRules(ctx context.Context, orgID influxdb.ID, rules map[string]*stateRule, endpoints map[string]*stateEndpoint) error { iRules, _, err := s.ruleSVC.FindNotificationRules(ctx, influxdb.NotificationRuleFilter{ OrgID: &orgID, }, influxdb.FindOptions{Limit: 100}) if err != nil { - return nil, internalErr(err) + return internalErr(err) } mExistingRulesByID := make(map[influxdb.ID]influxdb.NotificationRule) @@ -831,41 +799,20 @@ func (s *Service) dryRunNotificationRules(ctx context.Context, orgID influxdb.ID mExistingRulesByID[r.GetID()] = r } - mPkgEndpoints := make(map[string]influxdb.NotificationEndpoint) - for _, e := range pkg.mNotificationEndpoints { - influxEndpoint := e.summarize().NotificationEndpoint - mPkgEndpoints[e.PkgName()] = influxEndpoint - } - - diffs := make([]DiffNotificationRule, 0) - for _, r := range pkg.notificationRules() { - e, ok := mExistingEndpointsByName[r.endpointName.String()] + for _, r := range rules { + e, ok := endpoints[r.parserRule.associatedEndpoint.PkgName()] if !ok { - influxEndpoint, ok := mPkgEndpoints[r.endpointName.String()] - if !ok { - err := fmt.Errorf("failed to find notification endpoint %q dependency for notification rule %q", r.endpointName, r.Name()) - return nil, &influxdb.Error{Code: influxdb.EUnprocessableEntity, Err: err} - } - e = influxEndpoint - } - - if iRule, ok := mExistingRulesByID[r.ID()]; ok { - var endpointName, endpointType string - if e, ok := mExistingRulesByID[iRule.GetEndpointID()]; ok { - endpointName = e.GetName() - endpointType = e.Type() - } - r.existing = &existingRule{ - rule: iRule, - endpointName: endpointName, - endpointType: endpointType, + err := fmt.Errorf("failed to find notification endpoint %q dependency for notification rule %q", r.parserRule.endpointName, r.parserRule.Name()) + return &influxdb.Error{ + Code: influxdb.EUnprocessableEntity, + Err: err, } } - - diffs = append(diffs, newDiffNotificationRule(r, e)) - + r.associatedEndpoint = e + r.existing = mExistingRulesByID[r.ID()] } - return diffs, nil + + return nil } func (s *Service) dryRunSecrets(ctx context.Context, orgID influxdb.ID, pkg *Pkg) error { @@ -910,121 +857,7 @@ func (s *Service) dryRunVariables(ctx context.Context, orgID influxdb.ID, vars m } } -type ( - labelMappingDiffFn func(labelID influxdb.ID, labelPkgName, labelName string, isNew bool) - - labelMappers interface { - Association(i int) labelAssociater - Len() int - } - - labelAssociater interface { - ID() influxdb.ID - Name() string - PkgName() string - Labels() []*label - ResourceType() influxdb.ResourceType - Exists() bool - } -) - -func (s *Service) dryRunLabelMappings(ctx context.Context, pkg *Pkg, state *stateCoordinator) ([]DiffLabelMapping, error) { - mappers := []labelMappers{ - mapperNotificationRules(pkg.notificationRules()), - } - - diffs := make([]DiffLabelMapping, 0) - for _, mapper := range mappers { - for i := 0; i < mapper.Len(); i++ { - la := mapper.Association(i) - err := s.dryRunResourceLabelMapping(ctx, la, func(labelID influxdb.ID, labelPkgName, labelName string, isNew bool) { - existingLabel, ok := state.mLabels[labelName] - if !ok { - return - } - existingLabel.parserLabel.setMapping(la, !isNew) - - status := StateStatusExists - if isNew { - status = StateStatusNew - } - diffs = append(diffs, DiffLabelMapping{ - StateStatus: status, - ResType: la.ResourceType(), - ResID: SafeID(la.ID()), - ResPkgName: la.PkgName(), - ResName: la.Name(), - LabelID: SafeID(labelID), - LabelPkgName: labelPkgName, - LabelName: labelName, - }) - }) - if err != nil { - return nil, internalErr(err) - } - } - } - - // sort by res type ASC, then res name ASC, then label name ASC - sort.Slice(diffs, func(i, j int) bool { - n, m := diffs[i], diffs[j] - if n.ResType < m.ResType { - return true - } - if n.ResType > m.ResType { - return false - } - if n.ResName < m.ResName { - return true - } - if n.ResName > m.ResName { - return false - } - return n.LabelName < m.LabelName - }) - - return diffs, nil -} - -func (s *Service) dryRunResourceLabelMapping(ctx context.Context, la labelAssociater, mappingFn labelMappingDiffFn) error { - if !la.Exists() { - for _, l := range la.Labels() { - mappingFn(l.ID(), l.PkgName(), l.Name(), true) - } - return nil - } - - // loop through and hit api for all labels associated with a bkt - // lookup labels in pkg, add it to the label mapping, if exists in - // the results from API, mark it exists - existingLabels, err := s.labelSVC.FindResourceLabels(ctx, influxdb.LabelMappingFilter{ - ResourceID: la.ID(), - ResourceType: la.ResourceType(), - }) - if err != nil { - // TODO: inspect err, if its a not found error, do nothing, if any other error - // handle it better - return err - } - - pkgLabels := labelSlcToMap(la.Labels()) - for _, l := range existingLabels { - // if label is found in state then we track the mapping and mark it existing - // otherwise we continue on - delete(pkgLabels, l.Name) - if pkgLabel, ok := pkgLabels[l.Name]; ok { - mappingFn(l.ID, pkgLabel.PkgName(), l.Name, false) - } - } - - // now we add labels that were not apart of the existing labels - for _, l := range pkgLabels { - mappingFn(l.ID(), l.PkgName(), l.Name(), true) - } - return nil -} - -func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordinator) ([]stateLabelMapping, error) { +func (s *Service) dryRunLabelMappings(ctx context.Context, state *stateCoordinator) ([]stateLabelMapping, error) { stateLabelsByResName := make(map[string]*stateLabel) for _, l := range state.mLabels { if IsRemoval(l.stateStatus) { @@ -1038,7 +871,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(b.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, b) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, b) if err != nil { return nil, err } @@ -1049,7 +882,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(c.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, c) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, c) if err != nil { return nil, err } @@ -1060,7 +893,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(d.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, d) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, d) if err != nil { return nil, err } @@ -1071,7 +904,18 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(e.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, e) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, e) + if err != nil { + return nil, err + } + mappings = append(mappings, mm...) + } + + for _, r := range state.mRules { + if IsRemoval(r.stateStatus) { + continue + } + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, r) if err != nil { return nil, err } @@ -1082,7 +926,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(t.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, t) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, t) if err != nil { return nil, err } @@ -1093,7 +937,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(t.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, t) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, t) if err != nil { return nil, err } @@ -1104,7 +948,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin if IsRemoval(v.stateStatus) { continue } - mm, err := s.dryRunResourceLabelMappingV2(ctx, state, stateLabelsByResName, v) + mm, err := s.dryRunResourceLabelMapping(ctx, state, stateLabelsByResName, v) if err != nil { return nil, err } @@ -1114,7 +958,7 @@ func (s *Service) dryRunLabelMappingsV2(ctx context.Context, state *stateCoordin return mappings, nil } -func (s *Service) dryRunResourceLabelMappingV2(ctx context.Context, state *stateCoordinator, stateLabelsByResName map[string]*stateLabel, associatedResource interface { +func (s *Service) dryRunResourceLabelMapping(ctx context.Context, state *stateCoordinator, stateLabelsByResName map[string]*stateLabel, associatedResource interface { labels() []*label stateIdentity() stateIdentity }) ([]stateLabelMapping, error) { @@ -1168,43 +1012,16 @@ func (s *Service) dryRunResourceLabelMappingV2(ctx context.Context, state *state return mappings, nil } -func (s *Service) addStackState(ctx context.Context, stackID influxdb.ID, pkg *Pkg, state *stateCoordinator) error { +func (s *Service) addStackState(ctx context.Context, stackID influxdb.ID, state *stateCoordinator) error { stack, err := s.store.ReadStackByID(ctx, stackID) if err != nil { return ierrors.Wrap(internalErr(err), "reading stack") } - type stateMapper interface { - Contains(kind Kind, pkgName string) bool - setObjectID(kind Kind, pkgName string, id influxdb.ID) - addObjectForRemoval(kind Kind, pkgName string, id influxdb.ID) - } - - stateKinds := []Kind{ - KindBucket, - KindCheck, - KindLabel, - KindNotificationEndpoint, - KindTask, - KindVariable, - } - - // check resource exists in pkg - // if exists - // set id on existing pkg resource - // else - // add stub pkg resource that indicates it should be deleted for _, r := range stack.Resources { - var mapper stateMapper = pkg - if r.Kind.is(stateKinds...) { - // hack for time being while we transition state out of pkg. - // this will take several passes to finish up. - mapper = state - } - - updateFn := mapper.setObjectID - if !mapper.Contains(r.Kind, r.Name) { - updateFn = mapper.addObjectForRemoval + updateFn := state.setObjectID + if !state.Contains(r.Kind, r.Name) { + updateFn = state.addObjectForRemoval } updateFn(r.Kind, r.Name, r.ID) } @@ -1267,7 +1084,7 @@ func (s *Service) Apply(ctx context.Context, orgID, userID influxdb.ID, pkg *Pkg return Summary{}, Diff{}, failedValidationErr(err) } - _, diff, state, err := s.dryRun(ctx, orgID, pkg, opts...) + state, err := s.dryRun(ctx, orgID, pkg, opts...) if err != nil { return Summary{}, Diff{}, err } @@ -1281,7 +1098,7 @@ func (s *Service) Apply(ctx context.Context, orgID, userID influxdb.ID, pkg *Pkg if e != nil { updateStackFn = s.updateStackAfterRollback } - if err := updateStackFn(ctx, stackID, pkg, state); err != nil { + if err := updateStackFn(ctx, stackID, state); err != nil { s.log.Error("failed to update stack", zap.Error(err)) } }(opt.StackID) @@ -1289,15 +1106,17 @@ func (s *Service) Apply(ctx context.Context, orgID, userID influxdb.ID, pkg *Pkg coordinator := &rollbackCoordinator{sem: make(chan struct{}, s.applyReqLimit)} defer coordinator.rollback(s.log, &e, orgID) - sum, err = s.apply(ctx, coordinator, orgID, userID, pkg, state, opt.MissingSecrets) + err = s.applyState(ctx, coordinator, orgID, userID, state, opt.MissingSecrets) if err != nil { return Summary{}, Diff{}, err } - return sum, diff, err + pkg.applySecrets(opt.MissingSecrets) + + return newSummaryFromStatePkg(state, pkg), state.diff(), err } -func (s *Service) apply(ctx context.Context, coordinator *rollbackCoordinator, orgID, userID influxdb.ID, pkg *Pkg, state *stateCoordinator, missingSecrets map[string]string) (sum Summary, e error) { +func (s *Service) applyState(ctx context.Context, coordinator *rollbackCoordinator, orgID, userID influxdb.ID, state *stateCoordinator, missingSecrets map[string]string) (e error) { // each grouping here runs for its entirety, then returns an error that // is indicative of running all appliers provided. For instance, the labels // may have 1 variable fail and one of the buckets fails. The errors aggregate so @@ -1331,33 +1150,28 @@ func (s *Service) apply(ctx context.Context, coordinator *rollbackCoordinator, o for _, group := range appliers { if err := coordinator.runTilEnd(ctx, orgID, userID, group...); err != nil { - return Summary{}, internalErr(err) + return internalErr(err) } } // this has to be run after the above primary resources, because it relies on // notification endpoints already being applied. - app, err := s.applyNotificationRulesGenerator(ctx, orgID, pkg, state.endpoints()) + app, err := s.applyNotificationRulesGenerator(state.rules(), state.mEndpoints) if err != nil { - return Summary{}, err + return err } if err := coordinator.runTilEnd(ctx, orgID, userID, app); err != nil { - return Summary{}, err + return err } // secondary resources // this last grouping relies on the above 2 steps having completely successfully - secondary := []applier{ - s.applyLabelMappings(pkg.labelMappings()), - s.applyLabelMappingsV2(state.labelMappings), - } + secondary := []applier{s.applyLabelMappings(state.labelMappings)} if err := coordinator.runTilEnd(ctx, orgID, userID, secondary...); err != nil { - return Summary{}, internalErr(err) + return internalErr(err) } - pkg.applySecrets(missingSecrets) - - return newSummaryFromStatePkg(pkg, state), nil + return nil } func (s *Service) applyBuckets(ctx context.Context, buckets []*stateBucket) applier { @@ -1688,7 +1502,6 @@ func (s *Service) applyLabels(ctx context.Context, labels []*stateLabel) applier mutex.Do(func() { labels[i].id = influxLabel.ID - labels[i].parserLabel.id = influxLabel.ID rollBackLabels = append(rollBackLabels, labels[i]) }) @@ -1891,56 +1704,21 @@ func (s *Service) rollbackNotificationEndpoints(ctx context.Context, userID infl return nil } -func (s *Service) applyNotificationRulesGenerator(ctx context.Context, orgID influxdb.ID, pkg *Pkg, stateEndpoints []*stateEndpoint) (applier, error) { - endpoints, _, err := s.endpointSVC.FindNotificationEndpoints(ctx, influxdb.NotificationEndpointFilter{ - OrgID: &orgID, - }) - if err != nil { - return applier{}, internalErr(err) - } - - type mVal struct { - id influxdb.ID - eType string - } - mEndpointsByPkgName := make(map[string]mVal) - for _, e := range endpoints { - mEndpointsByPkgName[e.GetName()] = mVal{ - id: e.GetID(), - eType: e.Type(), - } - } - for _, e := range stateEndpoints { - if IsRemoval(e.stateStatus) { - continue - } - - if _, ok := mEndpointsByPkgName[e.parserEndpoint.PkgName()]; ok { - continue - } - mEndpointsByPkgName[e.parserEndpoint.PkgName()] = mVal{ - id: e.ID(), - eType: e.summarize().NotificationEndpoint.Type(), - } - } - - rules := pkg.notificationRules() - +func (s *Service) applyNotificationRulesGenerator(rules []*stateRule, stateEndpoints map[string]*stateEndpoint) (applier, error) { var errs applyErrs for _, r := range rules { - v, ok := mEndpointsByPkgName[r.endpointName.String()] + v, ok := stateEndpoints[r.parserRule.associatedEndpoint.PkgName()] if !ok { errs = append(errs, &applyErrBody{ - name: r.Name(), - msg: fmt.Sprintf("notification rule endpoint dependency does not exist; endpointName=%q", r.endpointName), + name: r.parserRule.Name(), + msg: fmt.Sprintf("notification rule endpoint dependency does not exist; endpointName=%q", r.parserRule.associatedEndpoint.PkgName()), }) continue } - r.endpointID = v.id - r.endpointType = v.eType + r.associatedEndpoint = v } - err = errs.toError("notification_rules", "failed to find dependency") + err := errs.toError("notification_rules", "failed to find dependency") if err != nil { return applier{}, err } @@ -1948,23 +1726,23 @@ func (s *Service) applyNotificationRulesGenerator(ctx context.Context, orgID inf return s.applyNotificationRules(rules), nil } -func (s *Service) applyNotificationRules(rules []*notificationRule) applier { +func (s *Service) applyNotificationRules(rules []*stateRule) applier { const resource = "notification_rules" mutex := new(doMutex) - rollbackEndpoints := make([]*notificationRule, 0, len(rules)) + rollbackEndpoints := make([]*stateRule, 0, len(rules)) createFn := func(ctx context.Context, i int, orgID, userID influxdb.ID) *applyErrBody { - var rule notificationRule + var rule *stateRule mutex.Do(func() { rules[i].orgID = orgID - rule = *rules[i] + rule = rules[i] }) influxRule, err := s.applyNotificationRule(ctx, rule, userID) if err != nil { return &applyErrBody{ - name: rule.Name(), + name: rule.parserRule.PkgName(), msg: err.Error(), } } @@ -1991,20 +1769,20 @@ func (s *Service) applyNotificationRules(rules []*notificationRule) applier { } } -func (s *Service) applyNotificationRule(ctx context.Context, e notificationRule, userID influxdb.ID) (influxdb.NotificationRule, error) { - actual := influxdb.NotificationRuleCreate{ - NotificationRule: e.toInfluxRule(), - Status: e.Status(), +func (s *Service) applyNotificationRule(ctx context.Context, r *stateRule, userID influxdb.ID) (influxdb.NotificationRule, error) { + influxRule := influxdb.NotificationRuleCreate{ + NotificationRule: r.toInfluxRule(), + Status: r.parserRule.Status(), } - err := s.ruleSVC.CreateNotificationRule(ctx, actual, userID) + err := s.ruleSVC.CreateNotificationRule(ctx, influxRule, userID) if err != nil { return nil, err } - return actual, nil + return influxRule, nil } -func (s *Service) rollbackNotificationRules(rules []*notificationRule) error { +func (s *Service) rollbackNotificationRules(rules []*stateRule) error { var errs []string for _, e := range rules { err := s.ruleSVC.DeleteNotificationRule(context.Background(), e.ID()) @@ -2265,7 +2043,7 @@ func (s *Service) applyVariable(ctx context.Context, v *stateVariable) (influxdb } } -func (s *Service) applyLabelMappingsV2(labelMappings []stateLabelMapping) applier { +func (s *Service) applyLabelMappings(labelMappings []stateLabelMapping) applier { const resource = "label_mapping" mutex := new(doMutex) @@ -2315,12 +2093,12 @@ func (s *Service) applyLabelMappingsV2(labelMappings []stateLabelMapping) applie }, rollbacker: rollbacker{ resource: resource, - fn: func(_ influxdb.ID) error { return s.rollbackLabelMappingsV2(rollbackMappings) }, + fn: func(_ influxdb.ID) error { return s.rollbackLabelMappings(rollbackMappings) }, }, } } -func (s *Service) rollbackLabelMappingsV2(mappings []stateLabelMapping) error { +func (s *Service) rollbackLabelMappings(mappings []stateLabelMapping) error { var errs []string for _, stateMapping := range mappings { influxMapping := stateLabelMappingToInfluxLabelMapping(stateMapping) @@ -2337,77 +2115,6 @@ func (s *Service) rollbackLabelMappingsV2(mappings []stateLabelMapping) error { return nil } -func (s *Service) applyLabelMappings(labelMappings []SummaryLabelMapping) applier { - const resource = "label_mapping" - - mutex := new(doMutex) - rollbackMappings := make([]influxdb.LabelMapping, 0, len(labelMappings)) - - createFn := func(ctx context.Context, i int, orgID, userID influxdb.ID) *applyErrBody { - var mapping SummaryLabelMapping - mutex.Do(func() { - mapping = labelMappings[i] - }) - - if IsExisting(mapping.Status) || mapping.LabelID == 0 || mapping.ResourceID == 0 { - // this block here does 2 things, it does not write a - // mapping when one exists. it also avoids having to worry - // about deleting an existing mapping since it will not be - // passed to the delete function below b/c it is never added - // to the list of mappings that is referenced in the delete - // call. - return nil - } - - m := influxdb.LabelMapping{ - LabelID: influxdb.ID(mapping.LabelID), - ResourceID: influxdb.ID(mapping.ResourceID), - ResourceType: mapping.ResourceType, - } - err := s.labelSVC.CreateLabelMapping(ctx, &m) - if err != nil { - return &applyErrBody{ - name: fmt.Sprintf("%s:%s:%s", mapping.ResourceType, mapping.ResourceID, mapping.LabelID), - msg: err.Error(), - } - } - - mutex.Do(func() { - rollbackMappings = append(rollbackMappings, m) - }) - - return nil - } - - return applier{ - creater: creater{ - entries: len(labelMappings), - fn: createFn, - }, - rollbacker: rollbacker{ - resource: resource, - fn: func(_ influxdb.ID) error { return s.rollbackLabelMappings(rollbackMappings) }, - }, - } -} - -func (s *Service) rollbackLabelMappings(mappings []influxdb.LabelMapping) error { - var errs []string - for i := range mappings { - l := mappings[i] - err := s.labelSVC.DeleteLabelMapping(context.Background(), &l) - if err != nil { - errs = append(errs, fmt.Sprintf("%s:%s", l.LabelID.String(), l.ResourceID.String())) - } - } - - if len(errs) > 0 { - return fmt.Errorf(`label_resource_id_pairs=[%s] err="unable to delete label"`, strings.Join(errs, ", ")) - } - - return nil -} - func (s *Service) deleteByIDs(resource string, numIDs int, deleteFn func(context.Context, influxdb.ID) error, iterFn func(int) influxdb.ID) error { var errs []string for i := range make([]struct{}, numIDs) { @@ -2425,7 +2132,7 @@ func (s *Service) deleteByIDs(resource string, numIDs int, deleteFn func(context return nil } -func (s *Service) updateStackAfterSuccess(ctx context.Context, stackID influxdb.ID, pkg *Pkg, state *stateCoordinator) error { +func (s *Service) updateStackAfterSuccess(ctx context.Context, stackID influxdb.ID, state *stateCoordinator) error { stack, err := s.store.ReadStackByID(ctx, stackID) if err != nil { return err @@ -2493,7 +2200,7 @@ func (s *Service) updateStackAfterSuccess(ctx context.Context, stackID influxdb. return s.store.UpdateStack(ctx, stack) } -func (s *Service) updateStackAfterRollback(ctx context.Context, stackID influxdb.ID, pkg *Pkg, state *stateCoordinator) error { +func (s *Service) updateStackAfterRollback(ctx context.Context, stackID influxdb.ID, state *stateCoordinator) error { stack, err := s.store.ReadStackByID(ctx, stackID) if err != nil { return err @@ -2607,40 +2314,11 @@ func (s *Service) getAllPlatformVariables(ctx context.Context, orgID influxdb.ID return existingVars, nil } -// temporary hack while integrations are needed. -func newSummaryFromStatePkg(pkg *Pkg, state *stateCoordinator) Summary { +func newSummaryFromStatePkg(state *stateCoordinator, pkg *Pkg) Summary { stateSum := state.summary() - - pkgSum := pkg.Summary() - pkgSum.Buckets = stateSum.Buckets - pkgSum.Checks = stateSum.Checks - pkgSum.Dashboards = stateSum.Dashboards - pkgSum.NotificationEndpoints = stateSum.NotificationEndpoints - pkgSum.Labels = stateSum.Labels - pkgSum.Tasks = stateSum.Tasks - pkgSum.TelegrafConfigs = stateSum.TelegrafConfigs - pkgSum.Variables = stateSum.Variables - - // filter out label mappings that are from pgk and replace with those - // in state. This is temporary hack to provide a bridge to the promise land... - resourcesToSkip := map[influxdb.ResourceType]bool{ - influxdb.BucketsResourceType: true, - influxdb.ChecksResourceType: true, - influxdb.DashboardsResourceType: true, - influxdb.NotificationEndpointResourceType: true, - influxdb.TasksResourceType: true, - influxdb.TelegrafsResourceType: true, - influxdb.VariablesResourceType: true, - } - for _, lm := range pkgSum.LabelMappings { - if resourcesToSkip[lm.ResourceType] { - continue - } - stateSum.LabelMappings = append(stateSum.LabelMappings, lm) - } - pkgSum.LabelMappings = stateSum.LabelMappings - - return pkgSum + stateSum.MissingEnvs = pkg.missingEnvRefs() + stateSum.MissingSecrets = pkg.missingSecrets() + return stateSum } func getLabelIDMap(ctx context.Context, labelSVC influxdb.LabelService, labelNames []string) (map[influxdb.ID]bool, error) { diff --git a/pkger/service_models.go b/pkger/service_models.go index 52e1003a26..22fc724243 100644 --- a/pkger/service_models.go +++ b/pkger/service_models.go @@ -5,6 +5,7 @@ import ( "sort" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/notification/rule" ) type stateCoordinator struct { @@ -13,6 +14,7 @@ type stateCoordinator struct { mDashboards map[string]*stateDashboard mEndpoints map[string]*stateEndpoint mLabels map[string]*stateLabel + mRules map[string]*stateRule mTasks map[string]*stateTask mTelegrafs map[string]*stateTelegraf mVariables map[string]*stateVariable @@ -27,6 +29,7 @@ func newStateCoordinator(pkg *Pkg) *stateCoordinator { mDashboards: make(map[string]*stateDashboard), mEndpoints: make(map[string]*stateEndpoint), mLabels: make(map[string]*stateLabel), + mRules: make(map[string]*stateRule), mTasks: make(map[string]*stateTask), mTelegrafs: make(map[string]*stateTelegraf), mVariables: make(map[string]*stateVariable), @@ -62,6 +65,12 @@ func newStateCoordinator(pkg *Pkg) *stateCoordinator { stateStatus: StateStatusNew, } } + for _, pkgRule := range pkg.notificationRules() { + state.mRules[pkgRule.PkgName()] = &stateRule{ + parserRule: pkgRule, + stateStatus: StateStatusNew, + } + } for _, pkgTask := range pkg.tasks() { state.mTasks[pkgTask.PkgName()] = &stateTask{ parserTask: pkgTask, @@ -124,6 +133,14 @@ func (s *stateCoordinator) labels() []*stateLabel { return out } +func (s *stateCoordinator) rules() []*stateRule { + out := make([]*stateRule, 0, len(s.mRules)) + for _, r := range s.mRules { + out = append(out, r) + } + return out +} + func (s *stateCoordinator) tasks() []*stateTask { out := make([]*stateTask, 0, len(s.mTasks)) for _, t := range s.mTasks { @@ -185,6 +202,13 @@ func (s *stateCoordinator) diff() Diff { return diff.Labels[i].PkgName < diff.Labels[j].PkgName }) + for _, r := range s.mRules { + diff.NotificationRules = append(diff.NotificationRules, r.diffRule()) + } + sort.Slice(diff.NotificationRules, func(i, j int) bool { + return diff.NotificationRules[i].PkgName < diff.NotificationRules[j].PkgName + }) + for _, t := range s.mTasks { diff.Tasks = append(diff.Tasks, t.diffTask()) } @@ -281,6 +305,16 @@ func (s *stateCoordinator) summary() Summary { return sum.Labels[i].PkgName < sum.Labels[j].PkgName }) + for _, v := range s.mRules { + if IsRemoval(v.stateStatus) { + continue + } + sum.NotificationRules = append(sum.NotificationRules, v.summarize()) + } + sort.Slice(sum.NotificationRules, func(i, j int) bool { + return sum.NotificationRules[i].PkgName < sum.NotificationRules[j].PkgName + }) + for _, t := range s.mTasks { if IsRemoval(t.stateStatus) { continue @@ -383,6 +417,12 @@ func (s *stateCoordinator) addObjectForRemoval(k Kind, pkgName string, id influx parserEndpoint: ¬ificationEndpoint{identity: newIdentity}, stateStatus: StateStatusRemove, } + case KindNotificationRule: + s.mRules[pkgName] = &stateRule{ + id: id, + parserRule: ¬ificationRule{identity: newIdentity}, + stateStatus: StateStatusRemove, + } case KindTask: s.mTasks[pkgName] = &stateTask{ id: id, @@ -433,6 +473,12 @@ func (s *stateCoordinator) getObjectIDSetter(k Kind, pkgName string) (func(influ r.id = id r.stateStatus = StateStatusExists }, ok + case KindNotificationRule: + r, ok := s.mRules[pkgName] + return func(id influxdb.ID) { + r.id = id + r.stateStatus = StateStatusExists + }, ok case KindTask: r, ok := s.mTasks[pkgName] return func(id influxdb.ID) { @@ -883,6 +929,140 @@ func (e *stateEndpoint) summarize() SummaryNotificationEndpoint { return sum } +type stateRule struct { + id, orgID influxdb.ID + stateStatus StateStatus + + associatedEndpoint *stateEndpoint + + parserRule *notificationRule + existing influxdb.NotificationRule +} + +func (r *stateRule) ID() influxdb.ID { + if !IsNew(r.stateStatus) && r.existing != nil { + return r.existing.GetID() + } + return r.id +} + +func (r *stateRule) diffRule() DiffNotificationRule { + sum := DiffNotificationRule{ + DiffIdentifier: DiffIdentifier{ + ID: SafeID(r.ID()), + Remove: r.parserRule.shouldRemove, + PkgName: r.parserRule.PkgName(), + }, + New: DiffNotificationRuleValues{ + Name: r.parserRule.Name(), + Description: r.parserRule.description, + EndpointName: r.associatedEndpoint.parserEndpoint.Name(), + EndpointID: SafeID(r.associatedEndpoint.ID()), + EndpointType: r.associatedEndpoint.parserEndpoint.kind.String(), + Every: r.parserRule.every.String(), + Offset: r.parserRule.offset.String(), + MessageTemplate: r.parserRule.msgTemplate, + StatusRules: toSummaryStatusRules(r.parserRule.statusRules), + TagRules: toSummaryTagRules(r.parserRule.tagRules), + }, + } + + if r.existing == nil { + return sum + } + + sum.Old = &DiffNotificationRuleValues{ + Name: r.existing.GetName(), + Description: r.existing.GetDescription(), + EndpointName: r.existing.GetName(), + EndpointID: SafeID(r.existing.GetEndpointID()), + EndpointType: r.existing.Type(), + } + + assignBase := func(b rule.Base) { + if b.Every != nil { + sum.Old.Every = b.Every.TimeDuration().String() + } + if b.Offset != nil { + sum.Old.Offset = b.Offset.TimeDuration().String() + } + for _, tr := range b.TagRules { + sum.Old.TagRules = append(sum.Old.TagRules, SummaryTagRule{ + Key: tr.Key, + Value: tr.Value, + Operator: tr.Operator.String(), + }) + } + for _, sr := range b.StatusRules { + sRule := SummaryStatusRule{CurrentLevel: sr.CurrentLevel.String()} + if sr.PreviousLevel != nil { + sRule.PreviousLevel = sr.PreviousLevel.String() + } + sum.Old.StatusRules = append(sum.Old.StatusRules, sRule) + } + } + + switch p := r.existing.(type) { + case *rule.HTTP: + assignBase(p.Base) + case *rule.Slack: + assignBase(p.Base) + sum.Old.MessageTemplate = p.MessageTemplate + case *rule.PagerDuty: + assignBase(p.Base) + sum.Old.MessageTemplate = p.MessageTemplate + } + + return sum +} + +func (r *stateRule) labels() []*label { + return r.parserRule.labels +} + +func (r *stateRule) resourceType() influxdb.ResourceType { + return KindNotificationRule.ResourceType() +} + +func (r *stateRule) stateIdentity() stateIdentity { + return stateIdentity{ + id: r.ID(), + name: r.parserRule.Name(), + pkgName: r.parserRule.PkgName(), + resourceType: r.resourceType(), + stateStatus: r.stateStatus, + } +} + +func (r *stateRule) summarize() SummaryNotificationRule { + sum := r.parserRule.summarize() + sum.ID = SafeID(r.id) + sum.EndpointID = SafeID(r.associatedEndpoint.ID()) + sum.EndpointPkgName = r.associatedEndpoint.parserEndpoint.PkgName() + sum.EndpointType = r.associatedEndpoint.parserEndpoint.kind.String() + return sum +} + +func (r *stateRule) toInfluxRule() influxdb.NotificationRule { + influxRule := r.parserRule.toInfluxRule() + if r.ID() > 0 { + influxRule.SetID(r.ID()) + } + if r.orgID > 0 { + influxRule.SetOrgID(r.orgID) + } + switch e := influxRule.(type) { + case *rule.HTTP: + e.EndpointID = r.associatedEndpoint.ID() + case *rule.PagerDuty: + e.EndpointID = r.associatedEndpoint.ID() + case *rule.Slack: + e.EndpointID = r.associatedEndpoint.ID() + } + + return influxRule +} + type stateTask struct { id, orgID influxdb.ID stateStatus StateStatus diff --git a/pkger/service_test.go b/pkger/service_test.go index 9d4ccfba9f..c593e83a9f 100644 --- a/pkger/service_test.go +++ b/pkger/service_test.go @@ -356,7 +356,7 @@ func TestService(t *testing.T) { actual := diff.NotificationRules[0].New assert.Equal(t, "rule_0", actual.Name) assert.Equal(t, "desc_0", actual.Description) - assert.Equal(t, "http", actual.EndpointType) + assert.Equal(t, "slack", actual.EndpointType) assert.Equal(t, existing.Name, actual.EndpointName) assert.Equal(t, SafeID(*existing.ID), actual.EndpointID) assert.Equal(t, (10 * time.Minute).String(), actual.Every) @@ -374,15 +374,6 @@ func TestService(t *testing.T) { } assert.Equal(t, expectedTagRules, actual.TagRules) }) - - t.Run("should error if endpoint name is not in pkg or in platform", func(t *testing.T) { - testfileRunner(t, "testdata/notification_rule.yml", func(t *testing.T, pkg *Pkg) { - svc := newTestService() - - _, _, err := svc.DryRun(context.TODO(), influxdb.ID(100), 0, pkg) - require.Error(t, err) - }) - }) }) t.Run("secrets not returns missing secrets", func(t *testing.T) { @@ -944,91 +935,6 @@ func TestService(t *testing.T) { }) } - testLabelMappingFn := func(t *testing.T, filename string, numExpected int, settersFn func() []ServiceSetterFn) { - t.Helper() - - t.Run("applies successfully", func(t *testing.T) { - t.Helper() - testfileRunner(t, filename, func(t *testing.T, pkg *Pkg) { - t.Helper() - - fakeLabelSVC := mock.NewLabelService() - fakeLabelSVC.CreateLabelFn = func(_ context.Context, l *influxdb.Label) error { - l.ID = influxdb.ID(rand.Int()) - return nil - } - fakeLabelSVC.CreateLabelMappingFn = func(_ context.Context, mapping *influxdb.LabelMapping) error { - if mapping.ResourceID == 0 { - return errors.New("did not get a resource ID") - } - if mapping.ResourceType == "" { - return errors.New("did not get a resource type") - } - return nil - } - svc := newTestService(append(settersFn(), - WithLabelSVC(fakeLabelSVC), - WithLogger(zaptest.NewLogger(t)), - )...) - - orgID := influxdb.ID(9000) - - _, _, err := svc.Apply(context.TODO(), orgID, 0, pkg) - require.NoError(t, err) - - assert.Equal(t, numExpected, fakeLabelSVC.CreateLabelMappingCalls.Count()) - }) - }) - - t.Run("deletes new label mappings on error", func(t *testing.T) { - t.Helper() - testfileRunner(t, filename, func(t *testing.T, pkg *Pkg) { - t.Helper() - - for _, l := range pkg.mLabels { - for resource, vals := range l.mappings { - // create extra label mappings, enough for delete to ahve head room - l.mappings[resource] = append(l.mappings[resource], vals...) - l.mappings[resource] = append(l.mappings[resource], vals...) - l.mappings[resource] = append(l.mappings[resource], vals...) - } - } - - fakeLabelSVC := mock.NewLabelService() - fakeLabelSVC.CreateLabelFn = func(_ context.Context, l *influxdb.Label) error { - l.ID = influxdb.ID(fakeLabelSVC.CreateLabelCalls.Count() + 1) - return nil - } - fakeLabelSVC.DeleteLabelMappingFn = func(_ context.Context, m *influxdb.LabelMapping) error { - return nil - } - fakeLabelSVC.CreateLabelMappingFn = func(_ context.Context, mapping *influxdb.LabelMapping) error { - if mapping.ResourceID == 0 { - return errors.New("did not get a resource ID") - } - if mapping.ResourceType == "" { - return errors.New("did not get a resource type") - } - if fakeLabelSVC.CreateLabelMappingCalls.Count() > numExpected { - return errors.New("hit last label") - } - return nil - } - svc := newTestService(append(settersFn(), - WithLabelSVC(fakeLabelSVC), - WithLogger(zaptest.NewLogger(t)), - )...) - - orgID := influxdb.ID(9000) - - _, _, err := svc.Apply(context.TODO(), orgID, 0, pkg) - require.Error(t, err) - - assert.GreaterOrEqual(t, fakeLabelSVC.DeleteLabelMappingCalls.Count(), numExpected) - }) - }) - } - t.Run("maps buckets with labels", func(t *testing.T) { bktOpt := func() []ServiceSetterFn { fakeBktSVC := mock.NewBucketService() @@ -1114,35 +1020,24 @@ func TestService(t *testing.T) { }) t.Run("maps notification rules with labels", func(t *testing.T) { - testLabelMappingFn( - t, - "testdata/notification_rule.yml", - 1, - func() []ServiceSetterFn { - fakeEndpointSVC := mock.NewNotificationEndpointService() - fakeEndpointSVC.FindNotificationEndpointsF = func(ctx context.Context, f influxdb.NotificationEndpointFilter, _ ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error) { - id := influxdb.ID(9) - return []influxdb.NotificationEndpoint{ - &endpoint.HTTP{ - Base: endpoint.Base{ - ID: &id, - Name: "endpoint_0", - }, - AuthMethod: "none", - }, - }, 1, nil - } - fakeRuleStore := mock.NewNotificationRuleStore() - fakeRuleStore.CreateNotificationRuleF = func(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error { - nr.SetID(influxdb.ID(fakeRuleStore.CreateNotificationRuleCalls.Count() + 1)) - return nil - } - return []ServiceSetterFn{ - WithNotificationEndpointSVC(fakeEndpointSVC), - WithNotificationRuleSVC(fakeRuleStore), - } - }, - ) + opts := func() []ServiceSetterFn { + fakeRuleStore := mock.NewNotificationRuleStore() + fakeRuleStore.CreateNotificationRuleF = func(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error { + nr.SetID(influxdb.ID(fakeRuleStore.CreateNotificationRuleCalls.Count() + 1)) + return nil + } + return []ServiceSetterFn{ + WithNotificationRuleSVC(fakeRuleStore), + } + } + + t.Run("applies successfully", func(t *testing.T) { + testLabelMappingV2ApplyFn(t, "testdata/notification_rule.yml", 2, opts) + }) + + t.Run("deletes new label mappings on error", func(t *testing.T) { + testLabelMappingV2RollbackFn(t, "testdata/notification_rule.yml", 1, opts) + }) }) t.Run("maps tasks with labels", func(t *testing.T) { @@ -1289,16 +1184,9 @@ func TestService(t *testing.T) { t.Run("successfuly creates", func(t *testing.T) { testfileRunner(t, "testdata/notification_rule.yml", func(t *testing.T, pkg *Pkg) { fakeEndpointSVC := mock.NewNotificationEndpointService() - fakeEndpointSVC.FindNotificationEndpointsF = func(ctx context.Context, f influxdb.NotificationEndpointFilter, _ ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error) { - id := influxdb.ID(9) - return []influxdb.NotificationEndpoint{ - &endpoint.HTTP{ - Base: endpoint.Base{ - ID: &id, - Name: "endpoint_0", - }, - }, - }, 1, nil + fakeEndpointSVC.CreateNotificationEndpointF = func(ctx context.Context, nr influxdb.NotificationEndpoint, userID influxdb.ID) error { + nr.SetID(influxdb.ID(fakeEndpointSVC.CreateNotificationEndpointCalls.Count() + 1)) + return nil } fakeRuleStore := mock.NewNotificationRuleStore() fakeRuleStore.CreateNotificationRuleF = func(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error { @@ -1319,33 +1207,17 @@ func TestService(t *testing.T) { require.Len(t, sum.NotificationRules, 1) assert.Equal(t, "rule_0", sum.NotificationRules[0].Name) assert.Equal(t, "desc_0", sum.NotificationRules[0].Description) - assert.Equal(t, SafeID(9), sum.NotificationRules[0].EndpointID) - assert.Equal(t, "endpoint_0", sum.NotificationRules[0].EndpointName) - assert.Equal(t, "http", sum.NotificationRules[0].EndpointType) + assert.Equal(t, SafeID(1), sum.NotificationRules[0].EndpointID) + assert.Equal(t, "endpoint_0", sum.NotificationRules[0].EndpointPkgName) + assert.Equal(t, "slack", sum.NotificationRules[0].EndpointType) }) }) t.Run("rolls back all created notification rules on an error", func(t *testing.T) { testfileRunner(t, "testdata/notification_rule.yml", func(t *testing.T, pkg *Pkg) { - fakeEndpointSVC := mock.NewNotificationEndpointService() - fakeEndpointSVC.FindNotificationEndpointsF = func(ctx context.Context, f influxdb.NotificationEndpointFilter, _ ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error) { - id := influxdb.ID(9) - return []influxdb.NotificationEndpoint{ - &endpoint.HTTP{ - Base: endpoint.Base{ - ID: &id, - Name: "endpoint_0", - }, - AuthMethod: "none", - }, - }, 1, nil - } fakeRuleStore := mock.NewNotificationRuleStore() fakeRuleStore.CreateNotificationRuleF = func(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error { - if fakeRuleStore.CreateNotificationRuleCalls.Count() == 1 { - return errors.New("limit hit") - } - nr.SetID(1) + nr.SetID(influxdb.ID(fakeRuleStore.CreateNotificationRuleCalls.Count() + 1)) return nil } fakeRuleStore.DeleteNotificationRuleF = func(ctx context.Context, id influxdb.ID) error { @@ -1354,11 +1226,17 @@ func TestService(t *testing.T) { } return nil } - - pkg.mNotificationRules["rule_UUID_copy"] = pkg.mNotificationRules["rule_UUID"] + fakeLabelSVC := mock.NewLabelService() + fakeLabelSVC.CreateLabelFn = func(ctx context.Context, l *influxdb.Label) error { + l.ID = influxdb.ID(fakeLabelSVC.CreateLabelCalls.Count() + 1) + return nil + } + fakeLabelSVC.CreateLabelMappingFn = func(ctx context.Context, m *influxdb.LabelMapping) error { + return errors.New("start the rollack") + } svc := newTestService( - WithNotificationEndpointSVC(fakeEndpointSVC), + WithLabelSVC(fakeLabelSVC), WithNotificationRuleSVC(fakeRuleStore), ) @@ -2527,8 +2405,8 @@ func TestService(t *testing.T) { actualRule := sum.NotificationRules[0] assert.Zero(t, actualRule.ID) assert.Zero(t, actualRule.EndpointID) - assert.Zero(t, actualRule.EndpointType) - assert.NotEmpty(t, actualRule.EndpointName) + assert.NotEmpty(t, actualRule.EndpointType) + assert.NotEmpty(t, actualRule.EndpointPkgName) baseEqual := func(t *testing.T, base rule.Base) { t.Helper() @@ -2625,7 +2503,7 @@ func TestService(t *testing.T) { sum := newPkg.Summary() require.Len(t, sum.NotificationRules, len(resourcesToClone)) - expectedSameEndpointName := sum.NotificationRules[0].EndpointName + expectedSameEndpointName := sum.NotificationRules[0].EndpointPkgName assert.NotZero(t, expectedSameEndpointName) assert.NotEqual(t, "endpoint_0", expectedSameEndpointName) @@ -2633,7 +2511,7 @@ func TestService(t *testing.T) { actual := sum.NotificationRules[i] assert.Equal(t, "old_name", actual.Name) assert.Equal(t, "desc", actual.Description) - assert.Equal(t, expectedSameEndpointName, actual.EndpointName) + assert.Equal(t, expectedSameEndpointName, actual.EndpointPkgName) } require.Len(t, sum.NotificationEndpoints, 1) @@ -3233,7 +3111,7 @@ func TestService(t *testing.T) { rules := summary.NotificationRules require.Len(t, rules, 1) assert.Equal(t, expectedRule.Name, rules[0].Name) - assert.NotEmpty(t, rules[0].EndpointName) + assert.NotEmpty(t, rules[0].EndpointPkgName) require.Len(t, summary.Tasks, 1) task1 := summary.Tasks[0] diff --git a/pkger/testdata/notification_rule.json b/pkger/testdata/notification_rule.json index ad1926c7e9..bc36cca269 100644 --- a/pkger/testdata/notification_rule.json +++ b/pkger/testdata/notification_rule.json @@ -6,6 +6,13 @@ "name": "label_1" } }, + { + "apiVersion": "influxdata.com/v2alpha1", + "kind": "Label", + "metadata": { + "name": "label_2" + } + }, { "apiVersion": "influxdata.com/v2alpha1", "kind": "NotificationRule", @@ -46,9 +53,24 @@ { "kind": "Label", "name": "label_1" + }, + + { + "kind": "Label", + "name": "label_2" } ] } + }, + { + "apiVersion": "influxdata.com/v2alpha1", + "kind": "NotificationEndpointSlack", + "metadata": { + "name": "endpoint_0" + }, + "spec": { + "url": "https://hooks.slack.com/services/bip/piddy/boppidy" + } } ] diff --git a/pkger/testdata/notification_rule.yml b/pkger/testdata/notification_rule.yml index ba2174ff1f..4803b29da5 100644 --- a/pkger/testdata/notification_rule.yml +++ b/pkger/testdata/notification_rule.yml @@ -5,6 +5,11 @@ metadata: name: label_1 --- apiVersion: influxdata.com/v2alpha1 +kind: Label +metadata: + name: label_2 +--- +apiVersion: influxdata.com/v2alpha1 kind: NotificationRule metadata: name: rule_UUID @@ -31,3 +36,12 @@ spec: associations: - kind: Label name: label_1 + - kind: Label + name: label_2 +--- +apiVersion: influxdata.com/v2alpha1 +kind: NotificationEndpointSlack +metadata: + name: endpoint_0 +spec: + url: https://hooks.slack.com/services/bip/piddy/boppidy diff --git a/storage/engine_measurement_schema.go b/storage/engine_measurement_schema.go index 6af6c09833..137a044ac0 100644 --- a/storage/engine_measurement_schema.go +++ b/storage/engine_measurement_schema.go @@ -45,7 +45,7 @@ func (e *Engine) MeasurementTagValues(ctx context.Context, orgID, bucketID influ // MeasurementTagKeys returns an iterator which enumerates the tag keys for the given // bucket and measurement, filtered using the optional the predicate and limited to the -//// time range [start, end]. +// time range [start, end]. // // MeasurementTagKeys will always return a StringIterator if there is no error. // @@ -63,7 +63,7 @@ func (e *Engine) MeasurementTagKeys(ctx context.Context, orgID, bucketID influxd // MeasurementFields returns an iterator which enumerates the field schema for the given // bucket and measurement, filtered using the optional the predicate and limited to the -//// time range [start, end]. +// time range [start, end]. // // MeasurementFields will always return a MeasurementFieldsIterator if there is no error. // diff --git a/storage/reads/datatypes/predicate.pb.go b/storage/reads/datatypes/predicate.pb.go index 068385c250..1546df83ed 100644 --- a/storage/reads/datatypes/predicate.pb.go +++ b/storage/reads/datatypes/predicate.pb.go @@ -10,6 +10,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Node_Type int32 @@ -163,7 +164,7 @@ func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Node.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -189,34 +190,34 @@ type isNode_Value interface { } type Node_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof" json:"string_value,omitempty"` } type Node_BooleanValue struct { - BooleanValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` + BooleanValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof" json:"bool_value,omitempty"` } type Node_IntegerValue struct { - IntegerValue int64 `protobuf:"varint,5,opt,name=int_value,json=intValue,proto3,oneof"` + IntegerValue int64 `protobuf:"varint,5,opt,name=int_value,json=intValue,proto3,oneof" json:"int_value,omitempty"` } type Node_UnsignedValue struct { - UnsignedValue uint64 `protobuf:"varint,6,opt,name=uint_value,json=uintValue,proto3,oneof"` + UnsignedValue uint64 `protobuf:"varint,6,opt,name=uint_value,json=uintValue,proto3,oneof" json:"uint_value,omitempty"` } type Node_FloatValue struct { - FloatValue float64 `protobuf:"fixed64,7,opt,name=float_value,json=floatValue,proto3,oneof"` + FloatValue float64 `protobuf:"fixed64,7,opt,name=float_value,json=floatValue,proto3,oneof" json:"float_value,omitempty"` } type Node_RegexValue struct { - RegexValue string `protobuf:"bytes,8,opt,name=regex_value,json=regexValue,proto3,oneof"` + RegexValue string `protobuf:"bytes,8,opt,name=regex_value,json=regexValue,proto3,oneof" json:"regex_value,omitempty"` } type Node_TagRefValue struct { - TagRefValue string `protobuf:"bytes,9,opt,name=tag_ref_value,json=tagRefValue,proto3,oneof"` + TagRefValue string `protobuf:"bytes,9,opt,name=tag_ref_value,json=tagRefValue,proto3,oneof" json:"tag_ref_value,omitempty"` } type Node_FieldRefValue struct { - FieldRefValue string `protobuf:"bytes,10,opt,name=field_ref_value,json=fieldRefValue,proto3,oneof"` + FieldRefValue string `protobuf:"bytes,10,opt,name=field_ref_value,json=fieldRefValue,proto3,oneof" json:"field_ref_value,omitempty"` } type Node_Logical_ struct { - Logical Node_Logical `protobuf:"varint,11,opt,name=logical,proto3,enum=influxdata.platform.storage.Node_Logical,oneof"` + Logical Node_Logical `protobuf:"varint,11,opt,name=logical,proto3,enum=influxdata.platform.storage.Node_Logical,oneof" json:"logical,omitempty"` } type Node_Comparison_ struct { - Comparison Node_Comparison `protobuf:"varint,12,opt,name=comparison,proto3,enum=influxdata.platform.storage.Node_Comparison,oneof"` + Comparison Node_Comparison `protobuf:"varint,12,opt,name=comparison,proto3,enum=influxdata.platform.storage.Node_Comparison,oneof" json:"comparison,omitempty"` } func (*Node_StringValue) isNode_Value() {} @@ -321,9 +322,9 @@ func (m *Node) GetComparison() Node_Comparison { return ComparisonEqual } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Node) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Node_OneofMarshaler, _Node_OneofUnmarshaler, _Node_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Node) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Node_StringValue)(nil), (*Node_BooleanValue)(nil), (*Node_IntegerValue)(nil), @@ -337,174 +338,6 @@ func (*Node) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, f } } -func _Node_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Node) - // value - switch x := m.Value.(type) { - case *Node_StringValue: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.StringValue) - case *Node_BooleanValue: - t := uint64(0) - if x.BooleanValue { - t = 1 - } - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case *Node_IntegerValue: - _ = b.EncodeVarint(5<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.IntegerValue)) - case *Node_UnsignedValue: - _ = b.EncodeVarint(6<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.UnsignedValue)) - case *Node_FloatValue: - _ = b.EncodeVarint(7<<3 | proto.WireFixed64) - _ = b.EncodeFixed64(math.Float64bits(x.FloatValue)) - case *Node_RegexValue: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.RegexValue) - case *Node_TagRefValue: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.TagRefValue) - case *Node_FieldRefValue: - _ = b.EncodeVarint(10<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.FieldRefValue) - case *Node_Logical_: - _ = b.EncodeVarint(11<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Logical)) - case *Node_Comparison_: - _ = b.EncodeVarint(12<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Comparison)) - case nil: - default: - return fmt.Errorf("Node.Value has unexpected type %T", x) - } - return nil -} - -func _Node_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Node) - switch tag { - case 3: // value.string_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &Node_StringValue{x} - return true, err - case 4: // value.bool_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &Node_BooleanValue{x != 0} - return true, err - case 5: // value.int_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &Node_IntegerValue{int64(x)} - return true, err - case 6: // value.uint_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &Node_UnsignedValue{x} - return true, err - case 7: // value.float_value - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Value = &Node_FloatValue{math.Float64frombits(x)} - return true, err - case 8: // value.regex_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &Node_RegexValue{x} - return true, err - case 9: // value.tag_ref_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &Node_TagRefValue{x} - return true, err - case 10: // value.field_ref_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &Node_FieldRefValue{x} - return true, err - case 11: // value.logical - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &Node_Logical_{Node_Logical(x)} - return true, err - case 12: // value.comparison - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &Node_Comparison_{Node_Comparison(x)} - return true, err - default: - return false, nil - } -} - -func _Node_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Node) - // value - switch x := m.Value.(type) { - case *Node_StringValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.StringValue))) - n += len(x.StringValue) - case *Node_BooleanValue: - n += 1 // tag and wire - n += 1 - case *Node_IntegerValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.IntegerValue)) - case *Node_UnsignedValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.UnsignedValue)) - case *Node_FloatValue: - n += 1 // tag and wire - n += 8 - case *Node_RegexValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.RegexValue))) - n += len(x.RegexValue) - case *Node_TagRefValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.TagRefValue))) - n += len(x.TagRefValue) - case *Node_FieldRefValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.FieldRefValue))) - n += len(x.FieldRefValue) - case *Node_Logical_: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Logical)) - case *Node_Comparison_: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Comparison)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Predicate struct { Root *Node `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"` } @@ -523,7 +356,7 @@ func (m *Predicate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Predicate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -621,7 +454,7 @@ var fileDescriptor_87cba9804b436f42 = []byte{ func (m *Node) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -629,121 +462,184 @@ func (m *Node) Marshal() (dAtA []byte, err error) { } func (m *Node) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.NodeType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintPredicate(dAtA, i, uint64(m.NodeType)) - } - if len(m.Children) > 0 { - for _, msg := range m.Children { - dAtA[i] = 0x12 - i++ - i = encodeVarintPredicate(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n } } - if m.Value != nil { - nn1, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Children) > 0 { + for iNdEx := len(m.Children) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Children[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPredicate(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i += nn1 } - return i, nil + if m.NodeType != 0 { + i = encodeVarintPredicate(dAtA, i, uint64(m.NodeType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Node_StringValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x1a - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_StringValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.StringValue) + copy(dAtA[i:], m.StringValue) i = encodeVarintPredicate(dAtA, i, uint64(len(m.StringValue))) - i += copy(dAtA[i:], m.StringValue) - return i, nil + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil } func (m *Node_BooleanValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_BooleanValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i-- if m.BooleanValue { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - return i, nil + i-- + dAtA[i] = 0x20 + return len(dAtA) - i, nil } func (m *Node_IntegerValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x28 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_IntegerValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintPredicate(dAtA, i, uint64(m.IntegerValue)) - return i, nil + i-- + dAtA[i] = 0x28 + return len(dAtA) - i, nil } func (m *Node_UnsignedValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x30 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_UnsignedValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintPredicate(dAtA, i, uint64(m.UnsignedValue)) - return i, nil + i-- + dAtA[i] = 0x30 + return len(dAtA) - i, nil } func (m *Node_FloatValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x39 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_FloatValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.FloatValue)))) - i += 8 - return i, nil + i-- + dAtA[i] = 0x39 + return len(dAtA) - i, nil } func (m *Node_RegexValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x42 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_RegexValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.RegexValue) + copy(dAtA[i:], m.RegexValue) i = encodeVarintPredicate(dAtA, i, uint64(len(m.RegexValue))) - i += copy(dAtA[i:], m.RegexValue) - return i, nil + i-- + dAtA[i] = 0x42 + return len(dAtA) - i, nil } func (m *Node_TagRefValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x4a - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_TagRefValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.TagRefValue) + copy(dAtA[i:], m.TagRefValue) i = encodeVarintPredicate(dAtA, i, uint64(len(m.TagRefValue))) - i += copy(dAtA[i:], m.TagRefValue) - return i, nil + i-- + dAtA[i] = 0x4a + return len(dAtA) - i, nil } func (m *Node_FieldRefValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x52 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_FieldRefValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.FieldRefValue) + copy(dAtA[i:], m.FieldRefValue) i = encodeVarintPredicate(dAtA, i, uint64(len(m.FieldRefValue))) - i += copy(dAtA[i:], m.FieldRefValue) - return i, nil + i-- + dAtA[i] = 0x52 + return len(dAtA) - i, nil } func (m *Node_Logical_) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x58 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_Logical_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintPredicate(dAtA, i, uint64(m.Logical)) - return i, nil + i-- + dAtA[i] = 0x58 + return len(dAtA) - i, nil } func (m *Node_Comparison_) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x60 - i++ + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Node_Comparison_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintPredicate(dAtA, i, uint64(m.Comparison)) - return i, nil + i-- + dAtA[i] = 0x60 + return len(dAtA) - i, nil } func (m *Predicate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -751,31 +647,40 @@ func (m *Predicate) Marshal() (dAtA []byte, err error) { } func (m *Predicate) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Predicate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Root != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPredicate(dAtA, i, uint64(m.Root.Size())) - n2, err := m.Root.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Root.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPredicate(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintPredicate(dAtA []byte, offset int, v uint64) int { + offset -= sovPredicate(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Node) Size() (n int) { if m == nil { @@ -906,14 +811,7 @@ func (m *Predicate) Size() (n int) { } func sovPredicate(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozPredicate(x uint64) (n int) { return sovPredicate(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1356,6 +1254,7 @@ func (m *Predicate) Unmarshal(dAtA []byte) error { func skipPredicate(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1387,10 +1286,8 @@ func skipPredicate(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1411,55 +1308,30 @@ func skipPredicate(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthPredicate } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthPredicate - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPredicate - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipPredicate(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthPredicate - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPredicate + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthPredicate + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthPredicate = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPredicate = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthPredicate = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPredicate = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPredicate = fmt.Errorf("proto: unexpected end of group") ) diff --git a/storage/reads/datatypes/storage_common.pb.go b/storage/reads/datatypes/storage_common.pb.go index 84e216d709..de6f0bb776 100644 --- a/storage/reads/datatypes/storage_common.pb.go +++ b/storage/reads/datatypes/storage_common.pb.go @@ -11,6 +11,7 @@ import ( types "github.com/gogo/protobuf/types" io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -22,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ReadGroupRequest_Group int32 @@ -175,6 +176,43 @@ func (ReadResponse_DataType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_715e4bf4cdf1f73d, []int{4, 1} } +type MeasurementFieldsResponse_FieldType int32 + +const ( + FieldTypeFloat MeasurementFieldsResponse_FieldType = 0 + FieldTypeInteger MeasurementFieldsResponse_FieldType = 1 + FieldTypeUnsigned MeasurementFieldsResponse_FieldType = 2 + FieldTypeString MeasurementFieldsResponse_FieldType = 3 + FieldTypeBoolean MeasurementFieldsResponse_FieldType = 4 + FieldTypeUndefined MeasurementFieldsResponse_FieldType = 5 +) + +var MeasurementFieldsResponse_FieldType_name = map[int32]string{ + 0: "FLOAT", + 1: "INTEGER", + 2: "UNSIGNED", + 3: "STRING", + 4: "BOOLEAN", + 5: "UNDEFINED", +} + +var MeasurementFieldsResponse_FieldType_value = map[string]int32{ + "FLOAT": 0, + "INTEGER": 1, + "UNSIGNED": 2, + "STRING": 3, + "BOOLEAN": 4, + "UNDEFINED": 5, +} + +func (x MeasurementFieldsResponse_FieldType) String() string { + return proto.EnumName(MeasurementFieldsResponse_FieldType_name, int32(x)) +} + +func (MeasurementFieldsResponse_FieldType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{14, 0} +} + type ReadFilterRequest struct { ReadSource *types.Any `protobuf:"bytes,1,opt,name=read_source,json=readSource,proto3" json:"read_source,omitempty"` Range TimestampRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range"` @@ -195,7 +233,7 @@ func (m *ReadFilterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ReadFilterRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -240,7 +278,7 @@ func (m *ReadGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_ReadGroupRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -277,7 +315,7 @@ func (m *Aggregate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Aggregate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -315,7 +353,7 @@ func (m *Tag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Tag.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -353,7 +391,7 @@ func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -398,7 +436,7 @@ func (m *ReadResponse_Frame) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_ReadResponse_Frame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -424,25 +462,25 @@ type isReadResponse_Frame_Data interface { } type ReadResponse_Frame_Group struct { - Group *ReadResponse_GroupFrame `protobuf:"bytes,7,opt,name=group,proto3,oneof"` + Group *ReadResponse_GroupFrame `protobuf:"bytes,7,opt,name=group,proto3,oneof" json:"group,omitempty"` } type ReadResponse_Frame_Series struct { - Series *ReadResponse_SeriesFrame `protobuf:"bytes,1,opt,name=series,proto3,oneof"` + Series *ReadResponse_SeriesFrame `protobuf:"bytes,1,opt,name=series,proto3,oneof" json:"series,omitempty"` } type ReadResponse_Frame_FloatPoints struct { - FloatPoints *ReadResponse_FloatPointsFrame `protobuf:"bytes,2,opt,name=float_points,json=floatPoints,proto3,oneof"` + FloatPoints *ReadResponse_FloatPointsFrame `protobuf:"bytes,2,opt,name=float_points,json=floatPoints,proto3,oneof" json:"float_points,omitempty"` } type ReadResponse_Frame_IntegerPoints struct { - IntegerPoints *ReadResponse_IntegerPointsFrame `protobuf:"bytes,3,opt,name=integer_points,json=integerPoints,proto3,oneof"` + IntegerPoints *ReadResponse_IntegerPointsFrame `protobuf:"bytes,3,opt,name=integer_points,json=integerPoints,proto3,oneof" json:"integer_points,omitempty"` } type ReadResponse_Frame_UnsignedPoints struct { - UnsignedPoints *ReadResponse_UnsignedPointsFrame `protobuf:"bytes,4,opt,name=unsigned_points,json=unsignedPoints,proto3,oneof"` + UnsignedPoints *ReadResponse_UnsignedPointsFrame `protobuf:"bytes,4,opt,name=unsigned_points,json=unsignedPoints,proto3,oneof" json:"unsigned_points,omitempty"` } type ReadResponse_Frame_BooleanPoints struct { - BooleanPoints *ReadResponse_BooleanPointsFrame `protobuf:"bytes,5,opt,name=boolean_points,json=booleanPoints,proto3,oneof"` + BooleanPoints *ReadResponse_BooleanPointsFrame `protobuf:"bytes,5,opt,name=boolean_points,json=booleanPoints,proto3,oneof" json:"boolean_points,omitempty"` } type ReadResponse_Frame_StringPoints struct { - StringPoints *ReadResponse_StringPointsFrame `protobuf:"bytes,6,opt,name=string_points,json=stringPoints,proto3,oneof"` + StringPoints *ReadResponse_StringPointsFrame `protobuf:"bytes,6,opt,name=string_points,json=stringPoints,proto3,oneof" json:"string_points,omitempty"` } func (*ReadResponse_Frame_Group) isReadResponse_Frame_Data() {} @@ -509,9 +547,9 @@ func (m *ReadResponse_Frame) GetStringPoints() *ReadResponse_StringPointsFrame { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ReadResponse_Frame) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ReadResponse_Frame_OneofMarshaler, _ReadResponse_Frame_OneofUnmarshaler, _ReadResponse_Frame_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ReadResponse_Frame) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ReadResponse_Frame_Group)(nil), (*ReadResponse_Frame_Series)(nil), (*ReadResponse_Frame_FloatPoints)(nil), @@ -522,162 +560,6 @@ func (*ReadResponse_Frame) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Bu } } -func _ReadResponse_Frame_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ReadResponse_Frame) - // data - switch x := m.Data.(type) { - case *ReadResponse_Frame_Group: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Group); err != nil { - return err - } - case *ReadResponse_Frame_Series: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Series); err != nil { - return err - } - case *ReadResponse_Frame_FloatPoints: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.FloatPoints); err != nil { - return err - } - case *ReadResponse_Frame_IntegerPoints: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.IntegerPoints); err != nil { - return err - } - case *ReadResponse_Frame_UnsignedPoints: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.UnsignedPoints); err != nil { - return err - } - case *ReadResponse_Frame_BooleanPoints: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BooleanPoints); err != nil { - return err - } - case *ReadResponse_Frame_StringPoints: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.StringPoints); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ReadResponse_Frame.Data has unexpected type %T", x) - } - return nil -} - -func _ReadResponse_Frame_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ReadResponse_Frame) - switch tag { - case 7: // data.group - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_GroupFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_Group{msg} - return true, err - case 1: // data.series - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_SeriesFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_Series{msg} - return true, err - case 2: // data.float_points - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_FloatPointsFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_FloatPoints{msg} - return true, err - case 3: // data.integer_points - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_IntegerPointsFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_IntegerPoints{msg} - return true, err - case 4: // data.unsigned_points - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_UnsignedPointsFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_UnsignedPoints{msg} - return true, err - case 5: // data.boolean_points - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_BooleanPointsFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_BooleanPoints{msg} - return true, err - case 6: // data.string_points - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ReadResponse_StringPointsFrame) - err := b.DecodeMessage(msg) - m.Data = &ReadResponse_Frame_StringPoints{msg} - return true, err - default: - return false, nil - } -} - -func _ReadResponse_Frame_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ReadResponse_Frame) - // data - switch x := m.Data.(type) { - case *ReadResponse_Frame_Group: - s := proto.Size(x.Group) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_Series: - s := proto.Size(x.Series) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_FloatPoints: - s := proto.Size(x.FloatPoints) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_IntegerPoints: - s := proto.Size(x.IntegerPoints) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_UnsignedPoints: - s := proto.Size(x.UnsignedPoints) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_BooleanPoints: - s := proto.Size(x.BooleanPoints) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ReadResponse_Frame_StringPoints: - s := proto.Size(x.StringPoints) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type ReadResponse_GroupFrame struct { // TagKeys TagKeys [][]byte `protobuf:"bytes,1,rep,name=tag_keys,json=tagKeys,proto3" json:"tag_keys,omitempty"` @@ -699,7 +581,7 @@ func (m *ReadResponse_GroupFrame) XXX_Marshal(b []byte, deterministic bool) ([]b return xxx_messageInfo_ReadResponse_GroupFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -737,7 +619,7 @@ func (m *ReadResponse_SeriesFrame) XXX_Marshal(b []byte, deterministic bool) ([] return xxx_messageInfo_ReadResponse_SeriesFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -775,7 +657,7 @@ func (m *ReadResponse_FloatPointsFrame) XXX_Marshal(b []byte, deterministic bool return xxx_messageInfo_ReadResponse_FloatPointsFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -813,7 +695,7 @@ func (m *ReadResponse_IntegerPointsFrame) XXX_Marshal(b []byte, deterministic bo return xxx_messageInfo_ReadResponse_IntegerPointsFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -851,7 +733,7 @@ func (m *ReadResponse_UnsignedPointsFrame) XXX_Marshal(b []byte, deterministic b return xxx_messageInfo_ReadResponse_UnsignedPointsFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -889,7 +771,7 @@ func (m *ReadResponse_BooleanPointsFrame) XXX_Marshal(b []byte, deterministic bo return xxx_messageInfo_ReadResponse_BooleanPointsFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -927,7 +809,7 @@ func (m *ReadResponse_StringPointsFrame) XXX_Marshal(b []byte, deterministic boo return xxx_messageInfo_ReadResponse_StringPointsFrame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -964,7 +846,7 @@ func (m *CapabilitiesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return xxx_messageInfo_CapabilitiesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1005,7 +887,7 @@ func (m *TimestampRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_TimestampRange.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1045,7 +927,7 @@ func (m *TagKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_TagKeysRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1086,7 +968,7 @@ func (m *TagValuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_TagValuesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1105,7 +987,8 @@ func (m *TagValuesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_TagValuesRequest proto.InternalMessageInfo -// Response message for Storage.TagKeys and Storage.TagValues. +// Response message for Storage.TagKeys, Storage.TagValues Storage.MeasurementNames, +// Storage.MeasurementTagKeys and Storage.MeasurementTagValues. type StringValuesResponse struct { Values [][]byte `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` } @@ -1124,7 +1007,7 @@ func (m *StringValuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return xxx_messageInfo_StringValuesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1143,12 +1026,255 @@ func (m *StringValuesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_StringValuesResponse proto.InternalMessageInfo +// MeasurementNamesRequest is the request message for Storage.MeasurementNames. +type MeasurementNamesRequest struct { + Source *types.Any `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Range TimestampRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range"` +} + +func (m *MeasurementNamesRequest) Reset() { *m = MeasurementNamesRequest{} } +func (m *MeasurementNamesRequest) String() string { return proto.CompactTextString(m) } +func (*MeasurementNamesRequest) ProtoMessage() {} +func (*MeasurementNamesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{10} +} +func (m *MeasurementNamesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementNamesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementNamesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementNamesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementNamesRequest.Merge(m, src) +} +func (m *MeasurementNamesRequest) XXX_Size() int { + return m.Size() +} +func (m *MeasurementNamesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementNamesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementNamesRequest proto.InternalMessageInfo + +// MeasurementTagKeysRequest is the request message for Storage.MeasurementTagKeys. +type MeasurementTagKeysRequest struct { + Source *types.Any `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"` + Range TimestampRange `protobuf:"bytes,3,opt,name=range,proto3" json:"range"` + Predicate *Predicate `protobuf:"bytes,4,opt,name=predicate,proto3" json:"predicate,omitempty"` +} + +func (m *MeasurementTagKeysRequest) Reset() { *m = MeasurementTagKeysRequest{} } +func (m *MeasurementTagKeysRequest) String() string { return proto.CompactTextString(m) } +func (*MeasurementTagKeysRequest) ProtoMessage() {} +func (*MeasurementTagKeysRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{11} +} +func (m *MeasurementTagKeysRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementTagKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementTagKeysRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementTagKeysRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementTagKeysRequest.Merge(m, src) +} +func (m *MeasurementTagKeysRequest) XXX_Size() int { + return m.Size() +} +func (m *MeasurementTagKeysRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementTagKeysRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementTagKeysRequest proto.InternalMessageInfo + +// MeasurementTagValuesRequest is the request message for Storage.MeasurementTagValues. +type MeasurementTagValuesRequest struct { + Source *types.Any `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"` + TagKey string `protobuf:"bytes,3,opt,name=tag_key,json=tagKey,proto3" json:"tag_key,omitempty"` + Range TimestampRange `protobuf:"bytes,4,opt,name=range,proto3" json:"range"` + Predicate *Predicate `protobuf:"bytes,5,opt,name=predicate,proto3" json:"predicate,omitempty"` +} + +func (m *MeasurementTagValuesRequest) Reset() { *m = MeasurementTagValuesRequest{} } +func (m *MeasurementTagValuesRequest) String() string { return proto.CompactTextString(m) } +func (*MeasurementTagValuesRequest) ProtoMessage() {} +func (*MeasurementTagValuesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{12} +} +func (m *MeasurementTagValuesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementTagValuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementTagValuesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementTagValuesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementTagValuesRequest.Merge(m, src) +} +func (m *MeasurementTagValuesRequest) XXX_Size() int { + return m.Size() +} +func (m *MeasurementTagValuesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementTagValuesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementTagValuesRequest proto.InternalMessageInfo + +// MeasurementFieldsRequest is the request message for Storage.MeasurementFields. +type MeasurementFieldsRequest struct { + Source *types.Any `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"` + Range TimestampRange `protobuf:"bytes,3,opt,name=range,proto3" json:"range"` + Predicate *Predicate `protobuf:"bytes,4,opt,name=predicate,proto3" json:"predicate,omitempty"` +} + +func (m *MeasurementFieldsRequest) Reset() { *m = MeasurementFieldsRequest{} } +func (m *MeasurementFieldsRequest) String() string { return proto.CompactTextString(m) } +func (*MeasurementFieldsRequest) ProtoMessage() {} +func (*MeasurementFieldsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{13} +} +func (m *MeasurementFieldsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementFieldsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementFieldsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementFieldsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementFieldsRequest.Merge(m, src) +} +func (m *MeasurementFieldsRequest) XXX_Size() int { + return m.Size() +} +func (m *MeasurementFieldsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementFieldsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementFieldsRequest proto.InternalMessageInfo + +// MeasurementFieldsResponse is the response message for Storage.MeasurementFields. +type MeasurementFieldsResponse struct { + Fields []MeasurementFieldsResponse_MessageField `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields"` +} + +func (m *MeasurementFieldsResponse) Reset() { *m = MeasurementFieldsResponse{} } +func (m *MeasurementFieldsResponse) String() string { return proto.CompactTextString(m) } +func (*MeasurementFieldsResponse) ProtoMessage() {} +func (*MeasurementFieldsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{14} +} +func (m *MeasurementFieldsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementFieldsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementFieldsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementFieldsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementFieldsResponse.Merge(m, src) +} +func (m *MeasurementFieldsResponse) XXX_Size() int { + return m.Size() +} +func (m *MeasurementFieldsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementFieldsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementFieldsResponse proto.InternalMessageInfo + +type MeasurementFieldsResponse_MessageField struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Type MeasurementFieldsResponse_FieldType `protobuf:"varint,2,opt,name=type,proto3,enum=influxdata.platform.storage.MeasurementFieldsResponse_FieldType" json:"type,omitempty"` + Timestamp int64 `protobuf:"fixed64,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (m *MeasurementFieldsResponse_MessageField) Reset() { + *m = MeasurementFieldsResponse_MessageField{} +} +func (m *MeasurementFieldsResponse_MessageField) String() string { return proto.CompactTextString(m) } +func (*MeasurementFieldsResponse_MessageField) ProtoMessage() {} +func (*MeasurementFieldsResponse_MessageField) Descriptor() ([]byte, []int) { + return fileDescriptor_715e4bf4cdf1f73d, []int{14, 0} +} +func (m *MeasurementFieldsResponse_MessageField) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MeasurementFieldsResponse_MessageField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MeasurementFieldsResponse_MessageField.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MeasurementFieldsResponse_MessageField) XXX_Merge(src proto.Message) { + xxx_messageInfo_MeasurementFieldsResponse_MessageField.Merge(m, src) +} +func (m *MeasurementFieldsResponse_MessageField) XXX_Size() int { + return m.Size() +} +func (m *MeasurementFieldsResponse_MessageField) XXX_DiscardUnknown() { + xxx_messageInfo_MeasurementFieldsResponse_MessageField.DiscardUnknown(m) +} + +var xxx_messageInfo_MeasurementFieldsResponse_MessageField proto.InternalMessageInfo + func init() { proto.RegisterEnum("influxdata.platform.storage.ReadGroupRequest_Group", ReadGroupRequest_Group_name, ReadGroupRequest_Group_value) proto.RegisterEnum("influxdata.platform.storage.ReadGroupRequest_HintFlags", ReadGroupRequest_HintFlags_name, ReadGroupRequest_HintFlags_value) proto.RegisterEnum("influxdata.platform.storage.Aggregate_AggregateType", Aggregate_AggregateType_name, Aggregate_AggregateType_value) proto.RegisterEnum("influxdata.platform.storage.ReadResponse_FrameType", ReadResponse_FrameType_name, ReadResponse_FrameType_value) proto.RegisterEnum("influxdata.platform.storage.ReadResponse_DataType", ReadResponse_DataType_name, ReadResponse_DataType_value) + proto.RegisterEnum("influxdata.platform.storage.MeasurementFieldsResponse_FieldType", MeasurementFieldsResponse_FieldType_name, MeasurementFieldsResponse_FieldType_value) proto.RegisterType((*ReadFilterRequest)(nil), "influxdata.platform.storage.ReadFilterRequest") proto.RegisterType((*ReadGroupRequest)(nil), "influxdata.platform.storage.ReadGroupRequest") proto.RegisterType((*Aggregate)(nil), "influxdata.platform.storage.Aggregate") @@ -1168,106 +1294,128 @@ func init() { proto.RegisterType((*TagKeysRequest)(nil), "influxdata.platform.storage.TagKeysRequest") proto.RegisterType((*TagValuesRequest)(nil), "influxdata.platform.storage.TagValuesRequest") proto.RegisterType((*StringValuesResponse)(nil), "influxdata.platform.storage.StringValuesResponse") + proto.RegisterType((*MeasurementNamesRequest)(nil), "influxdata.platform.storage.MeasurementNamesRequest") + proto.RegisterType((*MeasurementTagKeysRequest)(nil), "influxdata.platform.storage.MeasurementTagKeysRequest") + proto.RegisterType((*MeasurementTagValuesRequest)(nil), "influxdata.platform.storage.MeasurementTagValuesRequest") + proto.RegisterType((*MeasurementFieldsRequest)(nil), "influxdata.platform.storage.MeasurementFieldsRequest") + proto.RegisterType((*MeasurementFieldsResponse)(nil), "influxdata.platform.storage.MeasurementFieldsResponse") + proto.RegisterType((*MeasurementFieldsResponse_MessageField)(nil), "influxdata.platform.storage.MeasurementFieldsResponse.MessageField") } func init() { proto.RegisterFile("storage_common.proto", fileDescriptor_715e4bf4cdf1f73d) } var fileDescriptor_715e4bf4cdf1f73d = []byte{ - // 1402 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xcd, 0x6f, 0x1a, 0xd7, - 0x16, 0x67, 0xf8, 0x34, 0x07, 0x8c, 0xc7, 0x37, 0xbc, 0x3c, 0x67, 0xf2, 0x02, 0xf3, 0xd0, 0x53, - 0x9e, 0xa5, 0xa6, 0x58, 0x72, 0x52, 0x35, 0x4a, 0xdb, 0x85, 0x71, 0xb0, 0xa1, 0xb1, 0xc1, 0x1a, - 0x70, 0xa4, 0x76, 0x83, 0xae, 0xed, 0xeb, 0xc9, 0x28, 0x30, 0x33, 0x9d, 0xb9, 0x44, 0x46, 0xea, - 0xa6, 0xbb, 0x88, 0x55, 0xbb, 0xad, 0x84, 0x54, 0xa9, 0xcb, 0xee, 0xfb, 0x37, 0x64, 0x51, 0xa9, - 0x59, 0x76, 0x85, 0x5a, 0x22, 0x55, 0xea, 0xbf, 0xd0, 0x55, 0x75, 0xef, 0x9d, 0x0b, 0x83, 0x1d, - 0xb9, 0xb0, 0xab, 0xb2, 0x3b, 0xf7, 0x7c, 0xfc, 0xce, 0xc7, 0x9c, 0x0f, 0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, 0x24, 0xc9, 0x4b, 0x75, 0xff, 0xaf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x74, 0x0c, 0xf0, 0x4c, 0x8d, 0x0f, 0x00, 0x00, + // 1652 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x77, 0xfb, 0x33, 0xfd, 0xec, 0x38, 0x9d, 0x5a, 0x33, 0xeb, 0xe9, 0xd9, 0xb1, 0x7b, 0x0d, + 0x2c, 0x91, 0x18, 0x1c, 0x29, 0xbb, 0x88, 0xd5, 0x00, 0x12, 0x71, 0xe2, 0xc4, 0x66, 0x12, 0x3b, + 0x6a, 0x3b, 0x2b, 0xc1, 0xc5, 0xaa, 0xc4, 0xe5, 0xde, 0xd6, 0xda, 0xdd, 0xa6, 0xbb, 0xbd, 0x8a, + 0x25, 0x2e, 0xdc, 0x56, 0x3e, 0x2d, 0x12, 0x5c, 0x90, 0x2c, 0x21, 0x71, 0xe4, 0xce, 0xdf, 0x30, + 0x07, 0x24, 0xe6, 0xc8, 0xc9, 0x02, 0x47, 0x42, 0xe2, 0x4f, 0x60, 0xb8, 0xa0, 0xaa, 0xea, 0x6a, + 0xb7, 0x93, 0x90, 0xb1, 0x47, 0x39, 0xa0, 0xe1, 0x56, 0xf5, 0x3e, 0x7e, 0xef, 0xa3, 0xdf, 0xab, + 0xf7, 0x1a, 0x72, 0xae, 0x67, 0x3b, 0xd8, 0x20, 0x9d, 0x4b, 0x7b, 0x30, 0xb0, 0xad, 0xf2, 0xd0, + 0xb1, 0x3d, 0x1b, 0x3d, 0x31, 0xad, 0x5e, 0x7f, 0x74, 0xd5, 0xc5, 0x1e, 0x2e, 0x0f, 0xfb, 0xd8, + 0xeb, 0xd9, 0xce, 0xa0, 0xec, 0x4b, 0xaa, 0x39, 0xc3, 0x36, 0x6c, 0x26, 0xb7, 0x4b, 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xeb, 0xeb, + 0x42, 0xe4, 0xd5, 0x75, 0x21, 0xf2, 0xd7, 0xeb, 0x42, 0xe4, 0xe7, 0x6c, 0x35, 0xa7, 0xb9, 0x72, + 0x2f, 0x92, 0xac, 0xda, 0x3f, 0xfe, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x2f, 0x94, + 0x12, 0x15, 0x00, 0x00, } func (m *ReadFilterRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1275,45 +1423,56 @@ func (m *ReadFilterRequest) Marshal() (dAtA []byte, err error) { } func (m *ReadFilterRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadFilterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ReadSource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.ReadSource.Size())) - n1, err := m.ReadSource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Range.Size())) - n2, err := m.Range.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Predicate.Size())) - n3, err := m.Predicate.MarshalTo(dAtA[i:]) + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n3 + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0x12 + if m.ReadSource != nil { + { + size, err := m.ReadSource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadGroupRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1321,81 +1480,88 @@ func (m *ReadGroupRequest) Marshal() (dAtA []byte, err error) { } func (m *ReadGroupRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadGroupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ReadSource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.ReadSource.Size())) - n4, err := m.ReadSource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Range.Size())) - n5, err := m.Range.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - if m.Predicate != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Predicate.Size())) - n6, err := m.Predicate.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if len(m.GroupKeys) > 0 { - for _, s := range m.GroupKeys { - dAtA[i] = 0x22 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.Group != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Group)) + if m.Hints != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(m.Hints)) + i-- + dAtA[i] = 0x3d } if m.Aggregate != nil { + { + size, err := m.Aggregate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x32 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Aggregate.Size())) - n7, err := m.Aggregate.MarshalTo(dAtA[i:]) + } + if m.Group != 0 { + i = encodeVarintStorageCommon(dAtA, i, uint64(m.Group)) + i-- + dAtA[i] = 0x28 + } + if len(m.GroupKeys) > 0 { + for iNdEx := len(m.GroupKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.GroupKeys[iNdEx]) + copy(dAtA[i:], m.GroupKeys[iNdEx]) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.GroupKeys[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n7 + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - if m.Hints != 0 { - dAtA[i] = 0x3d - i++ - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(m.Hints)) - i += 4 + i-- + dAtA[i] = 0x12 + if m.ReadSource != nil { + { + size, err := m.ReadSource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Aggregate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1403,22 +1569,27 @@ func (m *Aggregate) Marshal() (dAtA []byte, err error) { } func (m *Aggregate) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Aggregate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Type != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintStorageCommon(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Tag) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1426,29 +1597,36 @@ func (m *Tag) Marshal() (dAtA []byte, err error) { } func (m *Tag) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Tag) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1456,29 +1634,36 @@ func (m *ReadResponse) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Frames) > 0 { - for _, msg := range m.Frames { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Frames) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Frames[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1486,122 +1671,178 @@ func (m *ReadResponse_Frame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_Frame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Data != nil { - nn8, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn8 } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_Series) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_Series) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Series != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Series.Size())) - n9, err := m.Series.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Series.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_FloatPoints) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_FloatPoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.FloatPoints != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.FloatPoints.Size())) - n10, err := m.FloatPoints.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.FloatPoints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n10 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_IntegerPoints) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_IntegerPoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.IntegerPoints != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.IntegerPoints.Size())) - n11, err := m.IntegerPoints.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.IntegerPoints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n11 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_UnsignedPoints) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_UnsignedPoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.UnsignedPoints != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.UnsignedPoints.Size())) - n12, err := m.UnsignedPoints.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.UnsignedPoints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n12 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_BooleanPoints) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_BooleanPoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.BooleanPoints != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.BooleanPoints.Size())) - n13, err := m.BooleanPoints.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BooleanPoints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n13 + i-- + dAtA[i] = 0x2a } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_StringPoints) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_StringPoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.StringPoints != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.StringPoints.Size())) - n14, err := m.StringPoints.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.StringPoints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n14 + i-- + dAtA[i] = 0x32 } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_Frame_Group) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_Frame_Group) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Group != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Group.Size())) - n15, err := m.Group.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Group.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n15 + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_GroupFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1609,33 +1850,40 @@ func (m *ReadResponse_GroupFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_GroupFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_GroupFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.TagKeys) > 0 { - for _, b := range m.TagKeys { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } if len(m.PartitionKeyVals) > 0 { - for _, b := range m.PartitionKeyVals { + for iNdEx := len(m.PartitionKeyVals) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PartitionKeyVals[iNdEx]) + copy(dAtA[i:], m.PartitionKeyVals[iNdEx]) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.PartitionKeyVals[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) } } - return i, nil + if len(m.TagKeys) > 0 { + for iNdEx := len(m.TagKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.TagKeys[iNdEx]) + copy(dAtA[i:], m.TagKeys[iNdEx]) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.TagKeys[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } func (m *ReadResponse_SeriesFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1643,34 +1891,41 @@ func (m *ReadResponse_SeriesFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_SeriesFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_SeriesFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.DataType != 0 { + i = encodeVarintStorageCommon(dAtA, i, uint64(m.DataType)) + i-- + dAtA[i] = 0x10 + } if len(m.Tags) > 0 { - for _, msg := range m.Tags { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Tags) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tags[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.DataType != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.DataType)) - } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse_FloatPointsFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1678,36 +1933,41 @@ func (m *ReadResponse_FloatPointsFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_FloatPointsFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_FloatPointsFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Timestamps) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) - for _, num := range m.Timestamps { - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(num)) - i += 8 - } - } if len(m.Values) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values)*8)) - for _, num := range m.Values { - f16 := math.Float64bits(float64(num)) - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f16)) - i += 8 + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + f15 := math.Float64bits(float64(m.Values[iNdEx])) + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f15)) } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values)*8)) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Timestamps) > 0 { + for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamps[iNdEx])) + } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadResponse_IntegerPointsFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1715,44 +1975,50 @@ func (m *ReadResponse_IntegerPointsFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_IntegerPointsFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_IntegerPointsFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Timestamps) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) - for _, num := range m.Timestamps { - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(num)) - i += 8 - } - } if len(m.Values) > 0 { - dAtA18 := make([]byte, len(m.Values)*10) - var j17 int + dAtA17 := make([]byte, len(m.Values)*10) + var j16 int for _, num1 := range m.Values { num := uint64(num1) for num >= 1<<7 { - dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) + dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j17++ + j16++ } - dAtA18[j17] = uint8(num) - j17++ + dAtA17[j16] = uint8(num) + j16++ } + i -= j16 + copy(dAtA[i:], dAtA17[:j16]) + i = encodeVarintStorageCommon(dAtA, i, uint64(j16)) + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(j17)) - i += copy(dAtA[i:], dAtA18[:j17]) } - return i, nil + if len(m.Timestamps) > 0 { + for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamps[iNdEx])) + } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadResponse_UnsignedPointsFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1760,43 +2026,49 @@ func (m *ReadResponse_UnsignedPointsFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_UnsignedPointsFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_UnsignedPointsFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Timestamps) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) - for _, num := range m.Timestamps { - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(num)) - i += 8 - } - } if len(m.Values) > 0 { - dAtA20 := make([]byte, len(m.Values)*10) - var j19 int + dAtA19 := make([]byte, len(m.Values)*10) + var j18 int for _, num := range m.Values { for num >= 1<<7 { - dAtA20[j19] = uint8(uint64(num)&0x7f | 0x80) + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j19++ + j18++ } - dAtA20[j19] = uint8(num) - j19++ + dAtA19[j18] = uint8(num) + j18++ } + i -= j18 + copy(dAtA[i:], dAtA19[:j18]) + i = encodeVarintStorageCommon(dAtA, i, uint64(j18)) + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(j19)) - i += copy(dAtA[i:], dAtA20[:j19]) } - return i, nil + if len(m.Timestamps) > 0 { + for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamps[iNdEx])) + } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadResponse_BooleanPointsFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1804,39 +2076,44 @@ func (m *ReadResponse_BooleanPointsFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_BooleanPointsFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_BooleanPointsFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Timestamps) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) - for _, num := range m.Timestamps { - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(num)) - i += 8 - } - } if len(m.Values) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values))) - for _, b := range m.Values { - if b { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i-- + if m.Values[iNdEx] { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values))) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Timestamps) > 0 { + for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamps[iNdEx])) + } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ReadResponse_StringPointsFrame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1844,41 +2121,40 @@ func (m *ReadResponse_StringPointsFrame) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse_StringPointsFrame) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse_StringPointsFrame) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Timestamps) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) - for _, num := range m.Timestamps { - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(num)) - i += 8 - } - } if len(m.Values) > 0 { - for _, s := range m.Values { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - return i, nil + if len(m.Timestamps) > 0 { + for iNdEx := len(m.Timestamps) - 1; iNdEx >= 0; iNdEx-- { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamps[iNdEx])) + } + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Timestamps)*8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *CapabilitiesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1886,34 +2162,41 @@ func (m *CapabilitiesResponse) Marshal() (dAtA []byte, err error) { } func (m *CapabilitiesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CapabilitiesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Caps) > 0 { - for k, _ := range m.Caps { - dAtA[i] = 0xa - i++ + for k := range m.Caps { v := m.Caps[k] - mapSize := 1 + len(k) + sovStorageCommon(uint64(len(k))) + 1 + len(v) + sovStorageCommon(uint64(len(v))) - i = encodeVarintStorageCommon(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - dAtA[i] = 0x12 - i++ + baseI := i + i -= len(v) + copy(dAtA[i:], v) i = encodeVarintStorageCommon(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintStorageCommon(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *TimestampRange) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1921,27 +2204,32 @@ func (m *TimestampRange) Marshal() (dAtA []byte, err error) { } func (m *TimestampRange) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TimestampRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Start != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Start)) - } if m.End != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintStorageCommon(dAtA, i, uint64(m.End)) + i-- + dAtA[i] = 0x10 } - return i, nil + if m.Start != 0 { + i = encodeVarintStorageCommon(dAtA, i, uint64(m.Start)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *TagKeysRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1949,45 +2237,56 @@ func (m *TagKeysRequest) Marshal() (dAtA []byte, err error) { } func (m *TagKeysRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TagKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TagsSource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.TagsSource.Size())) - n21, err := m.TagsSource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n21 - } - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Range.Size())) - n22, err := m.Range.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n22 if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Predicate.Size())) - n23, err := m.Predicate.MarshalTo(dAtA[i:]) + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n23 + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0x12 + if m.TagsSource != nil { + { + size, err := m.TagsSource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *TagValuesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1995,51 +2294,63 @@ func (m *TagValuesRequest) Marshal() (dAtA []byte, err error) { } func (m *TagValuesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TagValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TagsSource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.TagsSource.Size())) - n24, err := m.TagsSource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n24 - } - dAtA[i] = 0x12 - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Range.Size())) - n25, err := m.Range.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n25 - if m.Predicate != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(m.Predicate.Size())) - n26, err := m.Predicate.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n26 - } if len(m.TagKey) > 0 { - dAtA[i] = 0x22 - i++ + i -= len(m.TagKey) + copy(dAtA[i:], m.TagKey) i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.TagKey))) - i += copy(dAtA[i:], m.TagKey) + i-- + dAtA[i] = 0x22 } - return i, nil + if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.TagsSource != nil { + { + size, err := m.TagsSource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *StringValuesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -2047,29 +2358,359 @@ func (m *StringValuesResponse) Marshal() (dAtA []byte, err error) { } func (m *StringValuesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StringValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Values) > 0 { - for _, b := range m.Values { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- dAtA[i] = 0xa - i++ - i = encodeVarintStorageCommon(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) } } - return i, nil + return len(dAtA) - i, nil +} + +func (m *MeasurementNamesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementNamesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Source != nil { + { + size, err := m.Source.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MeasurementTagKeysRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementTagKeysRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementTagKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Measurement) > 0 { + i -= len(m.Measurement) + copy(dAtA[i:], m.Measurement) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Measurement))) + i-- + dAtA[i] = 0x12 + } + if m.Source != nil { + { + size, err := m.Source.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MeasurementTagValuesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementTagValuesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementTagValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.TagKey) > 0 { + i -= len(m.TagKey) + copy(dAtA[i:], m.TagKey) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.TagKey))) + i-- + dAtA[i] = 0x1a + } + if len(m.Measurement) > 0 { + i -= len(m.Measurement) + copy(dAtA[i:], m.Measurement) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Measurement))) + i-- + dAtA[i] = 0x12 + } + if m.Source != nil { + { + size, err := m.Source.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MeasurementFieldsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementFieldsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementFieldsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Predicate != nil { + { + size, err := m.Predicate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Measurement) > 0 { + i -= len(m.Measurement) + copy(dAtA[i:], m.Measurement) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Measurement))) + i-- + dAtA[i] = 0x12 + } + if m.Source != nil { + { + size, err := m.Source.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MeasurementFieldsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementFieldsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementFieldsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fields) > 0 { + for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fields[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStorageCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MeasurementFieldsResponse_MessageField) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MeasurementFieldsResponse_MessageField) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MeasurementFieldsResponse_MessageField) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Timestamp != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.Timestamp)) + i-- + dAtA[i] = 0x19 + } + if m.Type != 0 { + i = encodeVarintStorageCommon(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x10 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintStorageCommon(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintStorageCommon(dAtA []byte, offset int, v uint64) int { + offset -= sovStorageCommon(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ReadFilterRequest) Size() (n int) { if m == nil { @@ -2479,16 +3120,131 @@ func (m *StringValuesResponse) Size() (n int) { return n } -func sovStorageCommon(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break +func (m *MeasurementNamesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Source != nil { + l = m.Source.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = m.Range.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + return n +} + +func (m *MeasurementTagKeysRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Source != nil { + l = m.Source.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = len(m.Measurement) + if l > 0 { + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = m.Range.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + if m.Predicate != nil { + l = m.Predicate.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + return n +} + +func (m *MeasurementTagValuesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Source != nil { + l = m.Source.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = len(m.Measurement) + if l > 0 { + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = len(m.TagKey) + if l > 0 { + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = m.Range.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + if m.Predicate != nil { + l = m.Predicate.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + return n +} + +func (m *MeasurementFieldsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Source != nil { + l = m.Source.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = len(m.Measurement) + if l > 0 { + n += 1 + l + sovStorageCommon(uint64(l)) + } + l = m.Range.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + if m.Predicate != nil { + l = m.Predicate.Size() + n += 1 + l + sovStorageCommon(uint64(l)) + } + return n +} + +func (m *MeasurementFieldsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Fields) > 0 { + for _, e := range m.Fields { + l = e.Size() + n += 1 + l + sovStorageCommon(uint64(l)) } } return n } + +func (m *MeasurementFieldsResponse_MessageField) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovStorageCommon(uint64(l)) + } + if m.Type != 0 { + n += 1 + sovStorageCommon(uint64(m.Type)) + } + if m.Timestamp != 0 { + n += 9 + } + return n +} + +func sovStorageCommon(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} func sozStorageCommon(x uint64) (n int) { return sovStorageCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } @@ -5243,9 +5999,935 @@ func (m *StringValuesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MeasurementNamesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MeasurementNamesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MeasurementNamesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Source == nil { + m.Source = &types.Any{} + } + if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MeasurementTagKeysRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MeasurementTagKeysRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MeasurementTagKeysRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Source == nil { + m.Source = &types.Any{} + } + if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Measurement", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Measurement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Predicate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Predicate == nil { + m.Predicate = &Predicate{} + } + if err := m.Predicate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MeasurementTagValuesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MeasurementTagValuesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MeasurementTagValuesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Source == nil { + m.Source = &types.Any{} + } + if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Measurement", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Measurement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TagKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TagKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Predicate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Predicate == nil { + m.Predicate = &Predicate{} + } + if err := m.Predicate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MeasurementFieldsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MeasurementFieldsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MeasurementFieldsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Source == nil { + m.Source = &types.Any{} + } + if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Measurement", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Measurement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Predicate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Predicate == nil { + m.Predicate = &Predicate{} + } + if err := m.Predicate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MeasurementFieldsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MeasurementFieldsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MeasurementFieldsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fields = append(m.Fields, MeasurementFieldsResponse_MessageField{}) + if err := m.Fields[len(m.Fields)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MeasurementFieldsResponse_MessageField) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MessageField: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MessageField: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorageCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorageCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorageCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= MeasurementFieldsResponse_FieldType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + m.Timestamp = int64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + default: + iNdEx = preIndex + skippy, err := skipStorageCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStorageCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipStorageCommon(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -5277,10 +6959,8 @@ func skipStorageCommon(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -5301,55 +6981,30 @@ func skipStorageCommon(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthStorageCommon } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthStorageCommon - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorageCommon - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipStorageCommon(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthStorageCommon - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStorageCommon + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthStorageCommon + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthStorageCommon = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStorageCommon = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthStorageCommon = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStorageCommon = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStorageCommon = fmt.Errorf("proto: unexpected end of group") ) diff --git a/storage/reads/datatypes/storage_common.proto b/storage/reads/datatypes/storage_common.proto index 3f990d4717..c3b55cd033 100644 --- a/storage/reads/datatypes/storage_common.proto +++ b/storage/reads/datatypes/storage_common.proto @@ -3,7 +3,6 @@ package influxdata.platform.storage; option go_package = "datatypes"; import "gogoproto/gogo.proto"; -import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; import "predicate.proto"; @@ -175,7 +174,61 @@ message TagValuesRequest { string tag_key = 4; } -// Response message for Storage.TagKeys and Storage.TagValues. +// Response message for Storage.TagKeys, Storage.TagValues Storage.MeasurementNames, +// Storage.MeasurementTagKeys and Storage.MeasurementTagValues. message StringValuesResponse { repeated bytes values = 1; } + +// MeasurementNamesRequest is the request message for Storage.MeasurementNames. +message MeasurementNamesRequest { + google.protobuf.Any source = 1; + TimestampRange range = 2 [(gogoproto.nullable) = false]; +} + +// MeasurementTagKeysRequest is the request message for Storage.MeasurementTagKeys. +message MeasurementTagKeysRequest { + google.protobuf.Any source = 1; + string measurement = 2; + TimestampRange range = 3 [(gogoproto.nullable) = false]; + Predicate predicate = 4; +} + +// MeasurementTagValuesRequest is the request message for Storage.MeasurementTagValues. +message MeasurementTagValuesRequest { + google.protobuf.Any source = 1; + string measurement = 2; + string tag_key = 3; + TimestampRange range = 4 [(gogoproto.nullable) = false]; + Predicate predicate = 5; +} + +// MeasurementFieldsRequest is the request message for Storage.MeasurementFields. +message MeasurementFieldsRequest { + google.protobuf.Any source = 1; + string measurement = 2; + TimestampRange range = 3 [(gogoproto.nullable) = false]; + Predicate predicate = 4; +} + +// MeasurementFieldsResponse is the response message for Storage.MeasurementFields. +message MeasurementFieldsResponse { + enum FieldType { + option (gogoproto.goproto_enum_prefix) = false; + + FLOAT = 0 [(gogoproto.enumvalue_customname) = "FieldTypeFloat"]; + INTEGER = 1 [(gogoproto.enumvalue_customname) = "FieldTypeInteger"]; + UNSIGNED = 2 [(gogoproto.enumvalue_customname) = "FieldTypeUnsigned"]; + STRING = 3 [(gogoproto.enumvalue_customname) = "FieldTypeString"]; + BOOLEAN = 4 [(gogoproto.enumvalue_customname) = "FieldTypeBoolean"]; + UNDEFINED = 5 [(gogoproto.enumvalue_customname) = "FieldTypeUndefined"]; + } + + message MessageField { + string key = 1; + FieldType type = 2; + sfixed64 timestamp = 3; + } + + repeated MessageField fields = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/tsdb/cursors/fieldtype_string.go b/tsdb/cursors/fieldtype_string.go new file mode 100644 index 0000000000..79414dcc22 --- /dev/null +++ b/tsdb/cursors/fieldtype_string.go @@ -0,0 +1,28 @@ +// Code generated by "stringer -type FieldType"; DO NOT EDIT. + +package cursors + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[Float-0] + _ = x[Integer-1] + _ = x[Unsigned-2] + _ = x[String-3] + _ = x[Boolean-4] + _ = x[Undefined-5] +} + +const _FieldType_name = "FloatIntegerUnsignedStringBooleanUndefined" + +var _FieldType_index = [...]uint8{0, 5, 12, 20, 26, 33, 42} + +func (i FieldType) String() string { + if i < 0 || i >= FieldType(len(_FieldType_index)-1) { + return "FieldType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _FieldType_name[_FieldType_index[i]:_FieldType_index[i+1]] +} diff --git a/tsdb/cursors/gen.go b/tsdb/cursors/gen.go index 63316e5c09..40bcfb2a3c 100644 --- a/tsdb/cursors/gen.go +++ b/tsdb/cursors/gen.go @@ -1,3 +1,4 @@ package cursors //go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@arrayvalues.gen.go.tmpldata arrayvalues.gen.go.tmpl +//go:generate stringer -type FieldType diff --git a/tsdb/cursors/schema.go b/tsdb/cursors/schema.go index 014f00a3ea..2b21aec65b 100644 --- a/tsdb/cursors/schema.go +++ b/tsdb/cursors/schema.go @@ -1,5 +1,7 @@ package cursors +import "github.com/influxdata/influxql" + // FieldType represents the primitive field data types available in tsm. type FieldType int @@ -7,14 +9,82 @@ const ( Float FieldType = iota // means the data type is a float Integer // means the data type is an integer Unsigned // means the data type is an unsigned integer - Boolean // means the data type is a boolean String // means the data type is a string of text + Boolean // means the data type is a boolean Undefined // means the data type in unknown or undefined ) +var ( + fieldTypeToDataTypeMapping = [8]influxql.DataType{ + Float: influxql.Float, + Integer: influxql.Integer, + Unsigned: influxql.Unsigned, + String: influxql.String, + Boolean: influxql.Boolean, + Undefined: influxql.Unknown, + 6: influxql.Unknown, + 7: influxql.Unknown, + } +) + +// FieldTypeToDataType returns the equivalent influxql DataType for the field type ft. +// If ft is an invalid FieldType, the results are undefined. +func FieldTypeToDataType(ft FieldType) influxql.DataType { + return fieldTypeToDataTypeMapping[ft&7] +} + +// IsLower returns true if the other FieldType has greater precedence than the +// current value. Undefined has the lowest precedence. +func (ft FieldType) IsLower(other FieldType) bool { return other < ft } + type MeasurementField struct { - Key string - Type FieldType + Key string // Key is the name of the field + Type FieldType // Type is field type + Timestamp int64 // Timestamp refers to the maximum timestamp observed for the given field +} + +// MeasurementFieldSlice implements sort.Interface and sorts +// the slice from lowest to highest precedence. Use sort.Reverse +// to sort from highest to lowest. +type MeasurementFieldSlice []MeasurementField + +func (m MeasurementFieldSlice) Len() int { + return len(m) +} + +func (m MeasurementFieldSlice) Less(i, j int) bool { + ii, jj := &m[i], &m[j] + return ii.Key < jj.Key || + (ii.Key == jj.Key && + (ii.Timestamp < jj.Timestamp || + (ii.Timestamp == jj.Timestamp && ii.Type.IsLower(jj.Type)))) +} + +func (m MeasurementFieldSlice) Swap(i, j int) { + m[i], m[j] = m[j], m[i] +} + +// UniqueByKey performs an in-place update of m, removing duplicate elements +// by Key, keeping the first occurrence of each. If the slice is not sorted, +// the behavior of UniqueByKey is undefined. +func (m *MeasurementFieldSlice) UniqueByKey() { + mm := *m + if len(mm) < 2 { + return + } + + j := 0 + for i := 1; i < len(mm); i++ { + if mm[j].Key != mm[i].Key { + j++ + if j != i { + // optimization: skip copy if j == i + mm[j] = mm[i] + } + } + } + + *m = mm[:j+1] } type MeasurementFields struct { diff --git a/tsdb/cursors/schema_test.go b/tsdb/cursors/schema_test.go new file mode 100644 index 0000000000..a7ac5f4d62 --- /dev/null +++ b/tsdb/cursors/schema_test.go @@ -0,0 +1,310 @@ +package cursors_test + +import ( + "math/rand" + "sort" + "testing" + + "github.com/influxdata/influxdb/v2/pkg/testing/assert" + "github.com/influxdata/influxdb/v2/tsdb/cursors" +) + +// Verifies FieldType precedence behavior is equivalent to influxql.DataType#LessThan +func TestFieldTypeDataTypePrecedenceEquivalence(t *testing.T) { + var fieldTypes = []cursors.FieldType{ + cursors.Float, + cursors.Integer, + cursors.Unsigned, + cursors.Boolean, + cursors.String, + cursors.Undefined, + } + + for _, fta := range fieldTypes { + for _, ftb := range fieldTypes { + if fta == ftb { + continue + } + + got := fta.IsLower(ftb) + exp := cursors.FieldTypeToDataType(fta).LessThan(cursors.FieldTypeToDataType(ftb)) + assert.Equal(t, got, exp, "failed %s.LessThan(%s)", fta.String(), ftb.String()) + } + } +} + +// Verifies sorting behavior of MeasurementFieldSlice +func TestMeasurementFieldSliceSort(t *testing.T) { + mfs := func(d ...cursors.MeasurementField) cursors.MeasurementFieldSlice { + return d + } + + mf := func(key string, timestamp int64, ft cursors.FieldType) cursors.MeasurementField { + return cursors.MeasurementField{ + Key: key, + Type: ft, + Timestamp: timestamp, + } + } + + fltF := func(key string, ts int64) cursors.MeasurementField { + return mf(key, ts, cursors.Float) + } + intF := func(key string, ts int64) cursors.MeasurementField { + return mf(key, ts, cursors.Integer) + } + strF := func(key string, ts int64) cursors.MeasurementField { + return mf(key, ts, cursors.String) + } + blnF := func(key string, ts int64) cursors.MeasurementField { + return mf(key, ts, cursors.Boolean) + } + + cases := []struct { + name string + in cursors.MeasurementFieldSlice + exp cursors.MeasurementFieldSlice + }{ + { + name: "keys:diff types:same ts:same", + in: mfs( + fltF("bbb", 0), + fltF("aaa", 0), + fltF("ccc", 0), + ), + exp: mfs( + fltF("aaa", 0), + fltF("bbb", 0), + fltF("ccc", 0), + ), + }, + { + name: "keys:same types:same ts:diff", + in: mfs( + fltF("aaa", 10), + fltF("ccc", 20), + fltF("aaa", 0), + fltF("ccc", 0), + ), + exp: mfs( + fltF("aaa", 0), + fltF("aaa", 10), + fltF("ccc", 0), + fltF("ccc", 20), + ), + }, + { + name: "keys:same types:diff ts:same", + in: mfs( + strF("aaa", 0), + intF("aaa", 0), + fltF("aaa", 0), + blnF("aaa", 0), + ), + exp: mfs( + blnF("aaa", 0), + strF("aaa", 0), + intF("aaa", 0), + fltF("aaa", 0), + ), + }, + { + name: "keys:same types:diff ts:diff", + in: mfs( + strF("aaa", 20), + intF("aaa", 10), + fltF("aaa", 0), + blnF("aaa", 30), + ), + exp: mfs( + fltF("aaa", 0), + intF("aaa", 10), + strF("aaa", 20), + blnF("aaa", 30), + ), + }, + { + name: "keys:diff types:diff ts:diff", + in: mfs( + intF("ccc", 10), + blnF("fff", 30), + strF("aaa", 20), + fltF("ddd", 0), + ), + exp: mfs( + strF("aaa", 20), + intF("ccc", 10), + fltF("ddd", 0), + blnF("fff", 30), + ), + }, + { + name: "keys:many types:many ts:same", + in: mfs( + intF("ccc", 10), + blnF("fff", 30), + strF("aaa", 20), + fltF("ddd", 0), + fltF("ccc", 10), + strF("fff", 30), + intF("aaa", 20), + blnF("ddd", 0), + ), + exp: mfs( + strF("aaa", 20), + intF("aaa", 20), + intF("ccc", 10), + fltF("ccc", 10), + blnF("ddd", 0), + fltF("ddd", 0), + blnF("fff", 30), + strF("fff", 30), + ), + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got := tc.in + + // randomize order using fixed seed to + // ensure tests are deterministic on a given platform + rand.Seed(100) + for i := 0; i < 5; i++ { + rand.Shuffle(len(got), func(i, j int) { + got[i], got[j] = got[j], got[i] + }) + + sort.Sort(got) + assert.Equal(t, got, tc.exp, "failed at index", i) + } + }) + } +} + +func TestMeasurementFieldSlice_UniqueByKey(t *testing.T) { + mfs := func(d ...cursors.MeasurementField) cursors.MeasurementFieldSlice { + return d + } + + mf := func(key string, timestamp int64, ft cursors.FieldType) cursors.MeasurementField { + return cursors.MeasurementField{ + Key: key, + Type: ft, + Timestamp: timestamp, + } + } + + fltF := func(key string, ts int64) cursors.MeasurementField { + return mf(key, ts, cursors.Float) + } + + t.Run("multiple start end", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + fltF("aaa", 10), + fltF("bbb", 10), + fltF("ccc", 10), + fltF("ccc", 20), + ) + + exp := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + fltF("ccc", 10), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("multiple at end", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + fltF("ccc", 10), + fltF("ccc", 20), + fltF("ccc", 30), + ) + + exp := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + fltF("ccc", 10), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("no duplicates many", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + fltF("ccc", 20), + ) + + exp := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + fltF("ccc", 20), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("no duplicates two elements", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + ) + + exp := mfs( + fltF("aaa", 0), + fltF("bbb", 10), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("duplicates one key", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + fltF("aaa", 10), + fltF("aaa", 10), + fltF("aaa", 10), + fltF("aaa", 10), + fltF("aaa", 10), + ) + + exp := mfs( + fltF("aaa", 0), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("one element", func(t *testing.T) { + got := mfs( + fltF("aaa", 0), + ) + + exp := mfs( + fltF("aaa", 0), + ) + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) + + t.Run("empty", func(t *testing.T) { + got := mfs() + exp := mfs() + + got.UniqueByKey() + assert.Equal(t, got, exp) + }) +} diff --git a/tsdb/migrate/data_v1.go b/tsdb/migrate/data_v1.go new file mode 100644 index 0000000000..076f5be337 --- /dev/null +++ b/tsdb/migrate/data_v1.go @@ -0,0 +1,75 @@ +package migrate + +import ( + "time" + + "github.com/gogo/protobuf/proto" + "github.com/influxdata/influxdb/v2/tsdb/migrate/internal" +) + +//go:generate protoc --gogo_out=. internal/meta.proto + +// Data represents the top level collection of all metadata. +type Data struct { + Term uint64 // associated raft term + Index uint64 // associated raft index + ClusterID uint64 + Databases []DatabaseInfo + + MaxShardGroupID uint64 + MaxShardID uint64 +} + +// unmarshal deserializes from a protobuf representation. +func (data *Data) unmarshal(pb *internal.Data) { + data.Databases = make([]DatabaseInfo, len(pb.GetDatabases())) + for i, x := range pb.GetDatabases() { + data.Databases[i].unmarshal(x) + } +} + +// UnmarshalBinary decodes the object from a binary format. +func (data *Data) UnmarshalBinary(buf []byte) error { + var pb internal.Data + if err := proto.Unmarshal(buf, &pb); err != nil { + return err + } + data.unmarshal(&pb) + return nil +} + +// DatabaseInfo represents information about a database in the system. +type DatabaseInfo struct { + Name string + DefaultRetentionPolicy string + RetentionPolicies []RetentionPolicyInfo +} + +// unmarshal deserializes from a protobuf representation. +func (di *DatabaseInfo) unmarshal(pb *internal.DatabaseInfo) { + di.Name = pb.GetName() + di.DefaultRetentionPolicy = pb.GetDefaultRetentionPolicy() + + if len(pb.GetRetentionPolicies()) > 0 { + di.RetentionPolicies = make([]RetentionPolicyInfo, len(pb.GetRetentionPolicies())) + for i, x := range pb.GetRetentionPolicies() { + di.RetentionPolicies[i].unmarshal(x) + } + } +} + +// RetentionPolicyInfo represents metadata about a retention policy. +type RetentionPolicyInfo struct { + Name string + ReplicaN int + Duration time.Duration + ShardGroupDuration time.Duration +} + +// unmarshal deserializes from a protobuf representation. +func (rpi *RetentionPolicyInfo) unmarshal(pb *internal.RetentionPolicyInfo) { + rpi.Name = pb.GetName() + rpi.ReplicaN = int(pb.GetReplicaN()) + rpi.Duration = time.Duration(pb.GetDuration()) + rpi.ShardGroupDuration = time.Duration(pb.GetShardGroupDuration()) +} diff --git a/tsdb/migrate/internal/meta.pb.go b/tsdb/migrate/internal/meta.pb.go new file mode 100644 index 0000000000..41e2c7e9e3 --- /dev/null +++ b/tsdb/migrate/internal/meta.pb.go @@ -0,0 +1,2011 @@ +// Code generated by protoc-gen-gogo. +// source: internal/meta.proto +// DO NOT EDIT! + +/* +Package meta is a generated protocol buffer package. + +It is generated from these files: + internal/meta.proto + +It has these top-level messages: + Data + NodeInfo + DatabaseInfo + RetentionPolicySpec + RetentionPolicyInfo + ShardGroupInfo + ShardInfo + SubscriptionInfo + ShardOwner + ContinuousQueryInfo + UserInfo + UserPrivilege + Command + CreateNodeCommand + DeleteNodeCommand + CreateDatabaseCommand + DropDatabaseCommand + CreateRetentionPolicyCommand + DropRetentionPolicyCommand + SetDefaultRetentionPolicyCommand + UpdateRetentionPolicyCommand + CreateShardGroupCommand + DeleteShardGroupCommand + CreateContinuousQueryCommand + DropContinuousQueryCommand + CreateUserCommand + DropUserCommand + UpdateUserCommand + SetPrivilegeCommand + SetDataCommand + SetAdminPrivilegeCommand + UpdateNodeCommand + CreateSubscriptionCommand + DropSubscriptionCommand + RemovePeerCommand + CreateMetaNodeCommand + CreateDataNodeCommand + UpdateDataNodeCommand + DeleteMetaNodeCommand + DeleteDataNodeCommand + Response + SetMetaNodeCommand + DropShardCommand +*/ +package internal + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Command_Type int32 + +const ( + Command_CreateNodeCommand Command_Type = 1 + Command_DeleteNodeCommand Command_Type = 2 + Command_CreateDatabaseCommand Command_Type = 3 + Command_DropDatabaseCommand Command_Type = 4 + Command_CreateRetentionPolicyCommand Command_Type = 5 + Command_DropRetentionPolicyCommand Command_Type = 6 + Command_SetDefaultRetentionPolicyCommand Command_Type = 7 + Command_UpdateRetentionPolicyCommand Command_Type = 8 + Command_CreateShardGroupCommand Command_Type = 9 + Command_DeleteShardGroupCommand Command_Type = 10 + Command_CreateContinuousQueryCommand Command_Type = 11 + Command_DropContinuousQueryCommand Command_Type = 12 + Command_CreateUserCommand Command_Type = 13 + Command_DropUserCommand Command_Type = 14 + Command_UpdateUserCommand Command_Type = 15 + Command_SetPrivilegeCommand Command_Type = 16 + Command_SetDataCommand Command_Type = 17 + Command_SetAdminPrivilegeCommand Command_Type = 18 + Command_UpdateNodeCommand Command_Type = 19 + Command_CreateSubscriptionCommand Command_Type = 21 + Command_DropSubscriptionCommand Command_Type = 22 + Command_RemovePeerCommand Command_Type = 23 + Command_CreateMetaNodeCommand Command_Type = 24 + Command_CreateDataNodeCommand Command_Type = 25 + Command_UpdateDataNodeCommand Command_Type = 26 + Command_DeleteMetaNodeCommand Command_Type = 27 + Command_DeleteDataNodeCommand Command_Type = 28 + Command_SetMetaNodeCommand Command_Type = 29 + Command_DropShardCommand Command_Type = 30 +) + +var Command_Type_name = map[int32]string{ + 1: "CreateNodeCommand", + 2: "DeleteNodeCommand", + 3: "CreateDatabaseCommand", + 4: "DropDatabaseCommand", + 5: "CreateRetentionPolicyCommand", + 6: "DropRetentionPolicyCommand", + 7: "SetDefaultRetentionPolicyCommand", + 8: "UpdateRetentionPolicyCommand", + 9: "CreateShardGroupCommand", + 10: "DeleteShardGroupCommand", + 11: "CreateContinuousQueryCommand", + 12: "DropContinuousQueryCommand", + 13: "CreateUserCommand", + 14: "DropUserCommand", + 15: "UpdateUserCommand", + 16: "SetPrivilegeCommand", + 17: "SetDataCommand", + 18: "SetAdminPrivilegeCommand", + 19: "UpdateNodeCommand", + 21: "CreateSubscriptionCommand", + 22: "DropSubscriptionCommand", + 23: "RemovePeerCommand", + 24: "CreateMetaNodeCommand", + 25: "CreateDataNodeCommand", + 26: "UpdateDataNodeCommand", + 27: "DeleteMetaNodeCommand", + 28: "DeleteDataNodeCommand", + 29: "SetMetaNodeCommand", + 30: "DropShardCommand", +} +var Command_Type_value = map[string]int32{ + "CreateNodeCommand": 1, + "DeleteNodeCommand": 2, + "CreateDatabaseCommand": 3, + "DropDatabaseCommand": 4, + "CreateRetentionPolicyCommand": 5, + "DropRetentionPolicyCommand": 6, + "SetDefaultRetentionPolicyCommand": 7, + "UpdateRetentionPolicyCommand": 8, + "CreateShardGroupCommand": 9, + "DeleteShardGroupCommand": 10, + "CreateContinuousQueryCommand": 11, + "DropContinuousQueryCommand": 12, + "CreateUserCommand": 13, + "DropUserCommand": 14, + "UpdateUserCommand": 15, + "SetPrivilegeCommand": 16, + "SetDataCommand": 17, + "SetAdminPrivilegeCommand": 18, + "UpdateNodeCommand": 19, + "CreateSubscriptionCommand": 21, + "DropSubscriptionCommand": 22, + "RemovePeerCommand": 23, + "CreateMetaNodeCommand": 24, + "CreateDataNodeCommand": 25, + "UpdateDataNodeCommand": 26, + "DeleteMetaNodeCommand": 27, + "DeleteDataNodeCommand": 28, + "SetMetaNodeCommand": 29, + "DropShardCommand": 30, +} + +func (x Command_Type) Enum() *Command_Type { + p := new(Command_Type) + *p = x + return p +} +func (x Command_Type) String() string { + return proto.EnumName(Command_Type_name, int32(x)) +} +func (x *Command_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Command_Type_value, data, "Command_Type") + if err != nil { + return err + } + *x = Command_Type(value) + return nil +} +func (Command_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptorMeta, []int{12, 0} } + +type Data struct { + Term *uint64 `protobuf:"varint,1,req,name=Term" json:"Term,omitempty"` + Index *uint64 `protobuf:"varint,2,req,name=Index" json:"Index,omitempty"` + ClusterID *uint64 `protobuf:"varint,3,req,name=ClusterID" json:"ClusterID,omitempty"` + Nodes []*NodeInfo `protobuf:"bytes,4,rep,name=Nodes" json:"Nodes,omitempty"` + Databases []*DatabaseInfo `protobuf:"bytes,5,rep,name=Databases" json:"Databases,omitempty"` + Users []*UserInfo `protobuf:"bytes,6,rep,name=Users" json:"Users,omitempty"` + MaxNodeID *uint64 `protobuf:"varint,7,req,name=MaxNodeID" json:"MaxNodeID,omitempty"` + MaxShardGroupID *uint64 `protobuf:"varint,8,req,name=MaxShardGroupID" json:"MaxShardGroupID,omitempty"` + MaxShardID *uint64 `protobuf:"varint,9,req,name=MaxShardID" json:"MaxShardID,omitempty"` + // added for 0.10.0 + DataNodes []*NodeInfo `protobuf:"bytes,10,rep,name=DataNodes" json:"DataNodes,omitempty"` + MetaNodes []*NodeInfo `protobuf:"bytes,11,rep,name=MetaNodes" json:"MetaNodes,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Data) Reset() { *m = Data{} } +func (m *Data) String() string { return proto.CompactTextString(m) } +func (*Data) ProtoMessage() {} +func (*Data) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{0} } + +func (m *Data) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +func (m *Data) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +func (m *Data) GetClusterID() uint64 { + if m != nil && m.ClusterID != nil { + return *m.ClusterID + } + return 0 +} + +func (m *Data) GetNodes() []*NodeInfo { + if m != nil { + return m.Nodes + } + return nil +} + +func (m *Data) GetDatabases() []*DatabaseInfo { + if m != nil { + return m.Databases + } + return nil +} + +func (m *Data) GetUsers() []*UserInfo { + if m != nil { + return m.Users + } + return nil +} + +func (m *Data) GetMaxNodeID() uint64 { + if m != nil && m.MaxNodeID != nil { + return *m.MaxNodeID + } + return 0 +} + +func (m *Data) GetMaxShardGroupID() uint64 { + if m != nil && m.MaxShardGroupID != nil { + return *m.MaxShardGroupID + } + return 0 +} + +func (m *Data) GetMaxShardID() uint64 { + if m != nil && m.MaxShardID != nil { + return *m.MaxShardID + } + return 0 +} + +func (m *Data) GetDataNodes() []*NodeInfo { + if m != nil { + return m.DataNodes + } + return nil +} + +func (m *Data) GetMetaNodes() []*NodeInfo { + if m != nil { + return m.MetaNodes + } + return nil +} + +type NodeInfo struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + Host *string `protobuf:"bytes,2,req,name=Host" json:"Host,omitempty"` + TCPHost *string `protobuf:"bytes,3,opt,name=TCPHost" json:"TCPHost,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *NodeInfo) Reset() { *m = NodeInfo{} } +func (m *NodeInfo) String() string { return proto.CompactTextString(m) } +func (*NodeInfo) ProtoMessage() {} +func (*NodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{1} } + +func (m *NodeInfo) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *NodeInfo) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +func (m *NodeInfo) GetTCPHost() string { + if m != nil && m.TCPHost != nil { + return *m.TCPHost + } + return "" +} + +type DatabaseInfo struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + DefaultRetentionPolicy *string `protobuf:"bytes,2,req,name=DefaultRetentionPolicy" json:"DefaultRetentionPolicy,omitempty"` + RetentionPolicies []*RetentionPolicyInfo `protobuf:"bytes,3,rep,name=RetentionPolicies" json:"RetentionPolicies,omitempty"` + ContinuousQueries []*ContinuousQueryInfo `protobuf:"bytes,4,rep,name=ContinuousQueries" json:"ContinuousQueries,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DatabaseInfo) Reset() { *m = DatabaseInfo{} } +func (m *DatabaseInfo) String() string { return proto.CompactTextString(m) } +func (*DatabaseInfo) ProtoMessage() {} +func (*DatabaseInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{2} } + +func (m *DatabaseInfo) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DatabaseInfo) GetDefaultRetentionPolicy() string { + if m != nil && m.DefaultRetentionPolicy != nil { + return *m.DefaultRetentionPolicy + } + return "" +} + +func (m *DatabaseInfo) GetRetentionPolicies() []*RetentionPolicyInfo { + if m != nil { + return m.RetentionPolicies + } + return nil +} + +func (m *DatabaseInfo) GetContinuousQueries() []*ContinuousQueryInfo { + if m != nil { + return m.ContinuousQueries + } + return nil +} + +type RetentionPolicySpec struct { + Name *string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"` + Duration *int64 `protobuf:"varint,2,opt,name=Duration" json:"Duration,omitempty"` + ShardGroupDuration *int64 `protobuf:"varint,3,opt,name=ShardGroupDuration" json:"ShardGroupDuration,omitempty"` + ReplicaN *uint32 `protobuf:"varint,4,opt,name=ReplicaN" json:"ReplicaN,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RetentionPolicySpec) Reset() { *m = RetentionPolicySpec{} } +func (m *RetentionPolicySpec) String() string { return proto.CompactTextString(m) } +func (*RetentionPolicySpec) ProtoMessage() {} +func (*RetentionPolicySpec) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{3} } + +func (m *RetentionPolicySpec) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *RetentionPolicySpec) GetDuration() int64 { + if m != nil && m.Duration != nil { + return *m.Duration + } + return 0 +} + +func (m *RetentionPolicySpec) GetShardGroupDuration() int64 { + if m != nil && m.ShardGroupDuration != nil { + return *m.ShardGroupDuration + } + return 0 +} + +func (m *RetentionPolicySpec) GetReplicaN() uint32 { + if m != nil && m.ReplicaN != nil { + return *m.ReplicaN + } + return 0 +} + +type RetentionPolicyInfo struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Duration *int64 `protobuf:"varint,2,req,name=Duration" json:"Duration,omitempty"` + ShardGroupDuration *int64 `protobuf:"varint,3,req,name=ShardGroupDuration" json:"ShardGroupDuration,omitempty"` + ReplicaN *uint32 `protobuf:"varint,4,req,name=ReplicaN" json:"ReplicaN,omitempty"` + ShardGroups []*ShardGroupInfo `protobuf:"bytes,5,rep,name=ShardGroups" json:"ShardGroups,omitempty"` + Subscriptions []*SubscriptionInfo `protobuf:"bytes,6,rep,name=Subscriptions" json:"Subscriptions,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RetentionPolicyInfo) Reset() { *m = RetentionPolicyInfo{} } +func (m *RetentionPolicyInfo) String() string { return proto.CompactTextString(m) } +func (*RetentionPolicyInfo) ProtoMessage() {} +func (*RetentionPolicyInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{4} } + +func (m *RetentionPolicyInfo) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *RetentionPolicyInfo) GetDuration() int64 { + if m != nil && m.Duration != nil { + return *m.Duration + } + return 0 +} + +func (m *RetentionPolicyInfo) GetShardGroupDuration() int64 { + if m != nil && m.ShardGroupDuration != nil { + return *m.ShardGroupDuration + } + return 0 +} + +func (m *RetentionPolicyInfo) GetReplicaN() uint32 { + if m != nil && m.ReplicaN != nil { + return *m.ReplicaN + } + return 0 +} + +func (m *RetentionPolicyInfo) GetShardGroups() []*ShardGroupInfo { + if m != nil { + return m.ShardGroups + } + return nil +} + +func (m *RetentionPolicyInfo) GetSubscriptions() []*SubscriptionInfo { + if m != nil { + return m.Subscriptions + } + return nil +} + +type ShardGroupInfo struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + StartTime *int64 `protobuf:"varint,2,req,name=StartTime" json:"StartTime,omitempty"` + EndTime *int64 `protobuf:"varint,3,req,name=EndTime" json:"EndTime,omitempty"` + DeletedAt *int64 `protobuf:"varint,4,req,name=DeletedAt" json:"DeletedAt,omitempty"` + Shards []*ShardInfo `protobuf:"bytes,5,rep,name=Shards" json:"Shards,omitempty"` + TruncatedAt *int64 `protobuf:"varint,6,opt,name=TruncatedAt" json:"TruncatedAt,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ShardGroupInfo) Reset() { *m = ShardGroupInfo{} } +func (m *ShardGroupInfo) String() string { return proto.CompactTextString(m) } +func (*ShardGroupInfo) ProtoMessage() {} +func (*ShardGroupInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{5} } + +func (m *ShardGroupInfo) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *ShardGroupInfo) GetStartTime() int64 { + if m != nil && m.StartTime != nil { + return *m.StartTime + } + return 0 +} + +func (m *ShardGroupInfo) GetEndTime() int64 { + if m != nil && m.EndTime != nil { + return *m.EndTime + } + return 0 +} + +func (m *ShardGroupInfo) GetDeletedAt() int64 { + if m != nil && m.DeletedAt != nil { + return *m.DeletedAt + } + return 0 +} + +func (m *ShardGroupInfo) GetShards() []*ShardInfo { + if m != nil { + return m.Shards + } + return nil +} + +func (m *ShardGroupInfo) GetTruncatedAt() int64 { + if m != nil && m.TruncatedAt != nil { + return *m.TruncatedAt + } + return 0 +} + +type ShardInfo struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + OwnerIDs []uint64 `protobuf:"varint,2,rep,name=OwnerIDs" json:"OwnerIDs,omitempty"` + Owners []*ShardOwner `protobuf:"bytes,3,rep,name=Owners" json:"Owners,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ShardInfo) Reset() { *m = ShardInfo{} } +func (m *ShardInfo) String() string { return proto.CompactTextString(m) } +func (*ShardInfo) ProtoMessage() {} +func (*ShardInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{6} } + +func (m *ShardInfo) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *ShardInfo) GetOwnerIDs() []uint64 { + if m != nil { + return m.OwnerIDs + } + return nil +} + +func (m *ShardInfo) GetOwners() []*ShardOwner { + if m != nil { + return m.Owners + } + return nil +} + +type SubscriptionInfo struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Mode *string `protobuf:"bytes,2,req,name=Mode" json:"Mode,omitempty"` + Destinations []string `protobuf:"bytes,3,rep,name=Destinations" json:"Destinations,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SubscriptionInfo) Reset() { *m = SubscriptionInfo{} } +func (m *SubscriptionInfo) String() string { return proto.CompactTextString(m) } +func (*SubscriptionInfo) ProtoMessage() {} +func (*SubscriptionInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{7} } + +func (m *SubscriptionInfo) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *SubscriptionInfo) GetMode() string { + if m != nil && m.Mode != nil { + return *m.Mode + } + return "" +} + +func (m *SubscriptionInfo) GetDestinations() []string { + if m != nil { + return m.Destinations + } + return nil +} + +type ShardOwner struct { + NodeID *uint64 `protobuf:"varint,1,req,name=NodeID" json:"NodeID,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ShardOwner) Reset() { *m = ShardOwner{} } +func (m *ShardOwner) String() string { return proto.CompactTextString(m) } +func (*ShardOwner) ProtoMessage() {} +func (*ShardOwner) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{8} } + +func (m *ShardOwner) GetNodeID() uint64 { + if m != nil && m.NodeID != nil { + return *m.NodeID + } + return 0 +} + +type ContinuousQueryInfo struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Query *string `protobuf:"bytes,2,req,name=Query" json:"Query,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ContinuousQueryInfo) Reset() { *m = ContinuousQueryInfo{} } +func (m *ContinuousQueryInfo) String() string { return proto.CompactTextString(m) } +func (*ContinuousQueryInfo) ProtoMessage() {} +func (*ContinuousQueryInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{9} } + +func (m *ContinuousQueryInfo) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ContinuousQueryInfo) GetQuery() string { + if m != nil && m.Query != nil { + return *m.Query + } + return "" +} + +type UserInfo struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"` + Admin *bool `protobuf:"varint,3,req,name=Admin" json:"Admin,omitempty"` + Privileges []*UserPrivilege `protobuf:"bytes,4,rep,name=Privileges" json:"Privileges,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UserInfo) Reset() { *m = UserInfo{} } +func (m *UserInfo) String() string { return proto.CompactTextString(m) } +func (*UserInfo) ProtoMessage() {} +func (*UserInfo) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{10} } + +func (m *UserInfo) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *UserInfo) GetHash() string { + if m != nil && m.Hash != nil { + return *m.Hash + } + return "" +} + +func (m *UserInfo) GetAdmin() bool { + if m != nil && m.Admin != nil { + return *m.Admin + } + return false +} + +func (m *UserInfo) GetPrivileges() []*UserPrivilege { + if m != nil { + return m.Privileges + } + return nil +} + +type UserPrivilege struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Privilege *int32 `protobuf:"varint,2,req,name=Privilege" json:"Privilege,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UserPrivilege) Reset() { *m = UserPrivilege{} } +func (m *UserPrivilege) String() string { return proto.CompactTextString(m) } +func (*UserPrivilege) ProtoMessage() {} +func (*UserPrivilege) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{11} } + +func (m *UserPrivilege) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *UserPrivilege) GetPrivilege() int32 { + if m != nil && m.Privilege != nil { + return *m.Privilege + } + return 0 +} + +type Command struct { + Type *Command_Type `protobuf:"varint,1,req,name=type,enum=meta.Command_Type" json:"type,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Command) Reset() { *m = Command{} } +func (m *Command) String() string { return proto.CompactTextString(m) } +func (*Command) ProtoMessage() {} +func (*Command) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{12} } + +var extRange_Command = []proto.ExtensionRange{ + {Start: 100, End: 536870911}, +} + +func (*Command) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_Command +} + +func (m *Command) GetType() Command_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return Command_CreateNodeCommand +} + +// This isn't used in >= 0.10.0. Kept around for upgrade purposes. Instead +// look at CreateDataNodeCommand and CreateMetaNodeCommand +type CreateNodeCommand struct { + Host *string `protobuf:"bytes,1,req,name=Host" json:"Host,omitempty"` + Rand *uint64 `protobuf:"varint,2,req,name=Rand" json:"Rand,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateNodeCommand) Reset() { *m = CreateNodeCommand{} } +func (m *CreateNodeCommand) String() string { return proto.CompactTextString(m) } +func (*CreateNodeCommand) ProtoMessage() {} +func (*CreateNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{13} } + +func (m *CreateNodeCommand) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +func (m *CreateNodeCommand) GetRand() uint64 { + if m != nil && m.Rand != nil { + return *m.Rand + } + return 0 +} + +var E_CreateNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateNodeCommand)(nil), + Field: 101, + Name: "meta.CreateNodeCommand.command", + Tag: "bytes,101,opt,name=command", + Filename: "internal/meta.proto", +} + +type DeleteNodeCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + Force *bool `protobuf:"varint,2,req,name=Force" json:"Force,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteNodeCommand) Reset() { *m = DeleteNodeCommand{} } +func (m *DeleteNodeCommand) String() string { return proto.CompactTextString(m) } +func (*DeleteNodeCommand) ProtoMessage() {} +func (*DeleteNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{14} } + +func (m *DeleteNodeCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *DeleteNodeCommand) GetForce() bool { + if m != nil && m.Force != nil { + return *m.Force + } + return false +} + +var E_DeleteNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DeleteNodeCommand)(nil), + Field: 102, + Name: "meta.DeleteNodeCommand.command", + Tag: "bytes,102,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateDatabaseCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + RetentionPolicy *RetentionPolicyInfo `protobuf:"bytes,2,opt,name=RetentionPolicy" json:"RetentionPolicy,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateDatabaseCommand) Reset() { *m = CreateDatabaseCommand{} } +func (m *CreateDatabaseCommand) String() string { return proto.CompactTextString(m) } +func (*CreateDatabaseCommand) ProtoMessage() {} +func (*CreateDatabaseCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{15} } + +func (m *CreateDatabaseCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CreateDatabaseCommand) GetRetentionPolicy() *RetentionPolicyInfo { + if m != nil { + return m.RetentionPolicy + } + return nil +} + +var E_CreateDatabaseCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateDatabaseCommand)(nil), + Field: 103, + Name: "meta.CreateDatabaseCommand.command", + Tag: "bytes,103,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropDatabaseCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropDatabaseCommand) Reset() { *m = DropDatabaseCommand{} } +func (m *DropDatabaseCommand) String() string { return proto.CompactTextString(m) } +func (*DropDatabaseCommand) ProtoMessage() {} +func (*DropDatabaseCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{16} } + +func (m *DropDatabaseCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +var E_DropDatabaseCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropDatabaseCommand)(nil), + Field: 104, + Name: "meta.DropDatabaseCommand.command", + Tag: "bytes,104,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateRetentionPolicyCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + RetentionPolicy *RetentionPolicyInfo `protobuf:"bytes,2,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateRetentionPolicyCommand) Reset() { *m = CreateRetentionPolicyCommand{} } +func (m *CreateRetentionPolicyCommand) String() string { return proto.CompactTextString(m) } +func (*CreateRetentionPolicyCommand) ProtoMessage() {} +func (*CreateRetentionPolicyCommand) Descriptor() ([]byte, []int) { + return fileDescriptorMeta, []int{17} +} + +func (m *CreateRetentionPolicyCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *CreateRetentionPolicyCommand) GetRetentionPolicy() *RetentionPolicyInfo { + if m != nil { + return m.RetentionPolicy + } + return nil +} + +var E_CreateRetentionPolicyCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateRetentionPolicyCommand)(nil), + Field: 105, + Name: "meta.CreateRetentionPolicyCommand.command", + Tag: "bytes,105,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropRetentionPolicyCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropRetentionPolicyCommand) Reset() { *m = DropRetentionPolicyCommand{} } +func (m *DropRetentionPolicyCommand) String() string { return proto.CompactTextString(m) } +func (*DropRetentionPolicyCommand) ProtoMessage() {} +func (*DropRetentionPolicyCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{18} } + +func (m *DropRetentionPolicyCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *DropRetentionPolicyCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +var E_DropRetentionPolicyCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropRetentionPolicyCommand)(nil), + Field: 106, + Name: "meta.DropRetentionPolicyCommand.command", + Tag: "bytes,106,opt,name=command", + Filename: "internal/meta.proto", +} + +type SetDefaultRetentionPolicyCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SetDefaultRetentionPolicyCommand) Reset() { *m = SetDefaultRetentionPolicyCommand{} } +func (m *SetDefaultRetentionPolicyCommand) String() string { return proto.CompactTextString(m) } +func (*SetDefaultRetentionPolicyCommand) ProtoMessage() {} +func (*SetDefaultRetentionPolicyCommand) Descriptor() ([]byte, []int) { + return fileDescriptorMeta, []int{19} +} + +func (m *SetDefaultRetentionPolicyCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *SetDefaultRetentionPolicyCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +var E_SetDefaultRetentionPolicyCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*SetDefaultRetentionPolicyCommand)(nil), + Field: 107, + Name: "meta.SetDefaultRetentionPolicyCommand.command", + Tag: "bytes,107,opt,name=command", + Filename: "internal/meta.proto", +} + +type UpdateRetentionPolicyCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"` + NewName *string `protobuf:"bytes,3,opt,name=NewName" json:"NewName,omitempty"` + Duration *int64 `protobuf:"varint,4,opt,name=Duration" json:"Duration,omitempty"` + ReplicaN *uint32 `protobuf:"varint,5,opt,name=ReplicaN" json:"ReplicaN,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UpdateRetentionPolicyCommand) Reset() { *m = UpdateRetentionPolicyCommand{} } +func (m *UpdateRetentionPolicyCommand) String() string { return proto.CompactTextString(m) } +func (*UpdateRetentionPolicyCommand) ProtoMessage() {} +func (*UpdateRetentionPolicyCommand) Descriptor() ([]byte, []int) { + return fileDescriptorMeta, []int{20} +} + +func (m *UpdateRetentionPolicyCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *UpdateRetentionPolicyCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *UpdateRetentionPolicyCommand) GetNewName() string { + if m != nil && m.NewName != nil { + return *m.NewName + } + return "" +} + +func (m *UpdateRetentionPolicyCommand) GetDuration() int64 { + if m != nil && m.Duration != nil { + return *m.Duration + } + return 0 +} + +func (m *UpdateRetentionPolicyCommand) GetReplicaN() uint32 { + if m != nil && m.ReplicaN != nil { + return *m.ReplicaN + } + return 0 +} + +var E_UpdateRetentionPolicyCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*UpdateRetentionPolicyCommand)(nil), + Field: 108, + Name: "meta.UpdateRetentionPolicyCommand.command", + Tag: "bytes,108,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateShardGroupCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Policy *string `protobuf:"bytes,2,req,name=Policy" json:"Policy,omitempty"` + Timestamp *int64 `protobuf:"varint,3,req,name=Timestamp" json:"Timestamp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateShardGroupCommand) Reset() { *m = CreateShardGroupCommand{} } +func (m *CreateShardGroupCommand) String() string { return proto.CompactTextString(m) } +func (*CreateShardGroupCommand) ProtoMessage() {} +func (*CreateShardGroupCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{21} } + +func (m *CreateShardGroupCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *CreateShardGroupCommand) GetPolicy() string { + if m != nil && m.Policy != nil { + return *m.Policy + } + return "" +} + +func (m *CreateShardGroupCommand) GetTimestamp() int64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +var E_CreateShardGroupCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateShardGroupCommand)(nil), + Field: 109, + Name: "meta.CreateShardGroupCommand.command", + Tag: "bytes,109,opt,name=command", + Filename: "internal/meta.proto", +} + +type DeleteShardGroupCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Policy *string `protobuf:"bytes,2,req,name=Policy" json:"Policy,omitempty"` + ShardGroupID *uint64 `protobuf:"varint,3,req,name=ShardGroupID" json:"ShardGroupID,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteShardGroupCommand) Reset() { *m = DeleteShardGroupCommand{} } +func (m *DeleteShardGroupCommand) String() string { return proto.CompactTextString(m) } +func (*DeleteShardGroupCommand) ProtoMessage() {} +func (*DeleteShardGroupCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{22} } + +func (m *DeleteShardGroupCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *DeleteShardGroupCommand) GetPolicy() string { + if m != nil && m.Policy != nil { + return *m.Policy + } + return "" +} + +func (m *DeleteShardGroupCommand) GetShardGroupID() uint64 { + if m != nil && m.ShardGroupID != nil { + return *m.ShardGroupID + } + return 0 +} + +var E_DeleteShardGroupCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DeleteShardGroupCommand)(nil), + Field: 110, + Name: "meta.DeleteShardGroupCommand.command", + Tag: "bytes,110,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateContinuousQueryCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"` + Query *string `protobuf:"bytes,3,req,name=Query" json:"Query,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateContinuousQueryCommand) Reset() { *m = CreateContinuousQueryCommand{} } +func (m *CreateContinuousQueryCommand) String() string { return proto.CompactTextString(m) } +func (*CreateContinuousQueryCommand) ProtoMessage() {} +func (*CreateContinuousQueryCommand) Descriptor() ([]byte, []int) { + return fileDescriptorMeta, []int{23} +} + +func (m *CreateContinuousQueryCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *CreateContinuousQueryCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CreateContinuousQueryCommand) GetQuery() string { + if m != nil && m.Query != nil { + return *m.Query + } + return "" +} + +var E_CreateContinuousQueryCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateContinuousQueryCommand)(nil), + Field: 111, + Name: "meta.CreateContinuousQueryCommand.command", + Tag: "bytes,111,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropContinuousQueryCommand struct { + Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"` + Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropContinuousQueryCommand) Reset() { *m = DropContinuousQueryCommand{} } +func (m *DropContinuousQueryCommand) String() string { return proto.CompactTextString(m) } +func (*DropContinuousQueryCommand) ProtoMessage() {} +func (*DropContinuousQueryCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{24} } + +func (m *DropContinuousQueryCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *DropContinuousQueryCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +var E_DropContinuousQueryCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropContinuousQueryCommand)(nil), + Field: 112, + Name: "meta.DropContinuousQueryCommand.command", + Tag: "bytes,112,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateUserCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"` + Admin *bool `protobuf:"varint,3,req,name=Admin" json:"Admin,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateUserCommand) Reset() { *m = CreateUserCommand{} } +func (m *CreateUserCommand) String() string { return proto.CompactTextString(m) } +func (*CreateUserCommand) ProtoMessage() {} +func (*CreateUserCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{25} } + +func (m *CreateUserCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CreateUserCommand) GetHash() string { + if m != nil && m.Hash != nil { + return *m.Hash + } + return "" +} + +func (m *CreateUserCommand) GetAdmin() bool { + if m != nil && m.Admin != nil { + return *m.Admin + } + return false +} + +var E_CreateUserCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateUserCommand)(nil), + Field: 113, + Name: "meta.CreateUserCommand.command", + Tag: "bytes,113,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropUserCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropUserCommand) Reset() { *m = DropUserCommand{} } +func (m *DropUserCommand) String() string { return proto.CompactTextString(m) } +func (*DropUserCommand) ProtoMessage() {} +func (*DropUserCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{26} } + +func (m *DropUserCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +var E_DropUserCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropUserCommand)(nil), + Field: 114, + Name: "meta.DropUserCommand.command", + Tag: "bytes,114,opt,name=command", + Filename: "internal/meta.proto", +} + +type UpdateUserCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UpdateUserCommand) Reset() { *m = UpdateUserCommand{} } +func (m *UpdateUserCommand) String() string { return proto.CompactTextString(m) } +func (*UpdateUserCommand) ProtoMessage() {} +func (*UpdateUserCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{27} } + +func (m *UpdateUserCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *UpdateUserCommand) GetHash() string { + if m != nil && m.Hash != nil { + return *m.Hash + } + return "" +} + +var E_UpdateUserCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*UpdateUserCommand)(nil), + Field: 115, + Name: "meta.UpdateUserCommand.command", + Tag: "bytes,115,opt,name=command", + Filename: "internal/meta.proto", +} + +type SetPrivilegeCommand struct { + Username *string `protobuf:"bytes,1,req,name=Username" json:"Username,omitempty"` + Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"` + Privilege *int32 `protobuf:"varint,3,req,name=Privilege" json:"Privilege,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SetPrivilegeCommand) Reset() { *m = SetPrivilegeCommand{} } +func (m *SetPrivilegeCommand) String() string { return proto.CompactTextString(m) } +func (*SetPrivilegeCommand) ProtoMessage() {} +func (*SetPrivilegeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{28} } + +func (m *SetPrivilegeCommand) GetUsername() string { + if m != nil && m.Username != nil { + return *m.Username + } + return "" +} + +func (m *SetPrivilegeCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *SetPrivilegeCommand) GetPrivilege() int32 { + if m != nil && m.Privilege != nil { + return *m.Privilege + } + return 0 +} + +var E_SetPrivilegeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*SetPrivilegeCommand)(nil), + Field: 116, + Name: "meta.SetPrivilegeCommand.command", + Tag: "bytes,116,opt,name=command", + Filename: "internal/meta.proto", +} + +type SetDataCommand struct { + Data *Data `protobuf:"bytes,1,req,name=Data" json:"Data,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SetDataCommand) Reset() { *m = SetDataCommand{} } +func (m *SetDataCommand) String() string { return proto.CompactTextString(m) } +func (*SetDataCommand) ProtoMessage() {} +func (*SetDataCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{29} } + +func (m *SetDataCommand) GetData() *Data { + if m != nil { + return m.Data + } + return nil +} + +var E_SetDataCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*SetDataCommand)(nil), + Field: 117, + Name: "meta.SetDataCommand.command", + Tag: "bytes,117,opt,name=command", + Filename: "internal/meta.proto", +} + +type SetAdminPrivilegeCommand struct { + Username *string `protobuf:"bytes,1,req,name=Username" json:"Username,omitempty"` + Admin *bool `protobuf:"varint,2,req,name=Admin" json:"Admin,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SetAdminPrivilegeCommand) Reset() { *m = SetAdminPrivilegeCommand{} } +func (m *SetAdminPrivilegeCommand) String() string { return proto.CompactTextString(m) } +func (*SetAdminPrivilegeCommand) ProtoMessage() {} +func (*SetAdminPrivilegeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{30} } + +func (m *SetAdminPrivilegeCommand) GetUsername() string { + if m != nil && m.Username != nil { + return *m.Username + } + return "" +} + +func (m *SetAdminPrivilegeCommand) GetAdmin() bool { + if m != nil && m.Admin != nil { + return *m.Admin + } + return false +} + +var E_SetAdminPrivilegeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*SetAdminPrivilegeCommand)(nil), + Field: 118, + Name: "meta.SetAdminPrivilegeCommand.command", + Tag: "bytes,118,opt,name=command", + Filename: "internal/meta.proto", +} + +type UpdateNodeCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + Host *string `protobuf:"bytes,2,req,name=Host" json:"Host,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UpdateNodeCommand) Reset() { *m = UpdateNodeCommand{} } +func (m *UpdateNodeCommand) String() string { return proto.CompactTextString(m) } +func (*UpdateNodeCommand) ProtoMessage() {} +func (*UpdateNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{31} } + +func (m *UpdateNodeCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *UpdateNodeCommand) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +var E_UpdateNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*UpdateNodeCommand)(nil), + Field: 119, + Name: "meta.UpdateNodeCommand.command", + Tag: "bytes,119,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateSubscriptionCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"` + RetentionPolicy *string `protobuf:"bytes,3,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"` + Mode *string `protobuf:"bytes,4,req,name=Mode" json:"Mode,omitempty"` + Destinations []string `protobuf:"bytes,5,rep,name=Destinations" json:"Destinations,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateSubscriptionCommand) Reset() { *m = CreateSubscriptionCommand{} } +func (m *CreateSubscriptionCommand) String() string { return proto.CompactTextString(m) } +func (*CreateSubscriptionCommand) ProtoMessage() {} +func (*CreateSubscriptionCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{32} } + +func (m *CreateSubscriptionCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CreateSubscriptionCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *CreateSubscriptionCommand) GetRetentionPolicy() string { + if m != nil && m.RetentionPolicy != nil { + return *m.RetentionPolicy + } + return "" +} + +func (m *CreateSubscriptionCommand) GetMode() string { + if m != nil && m.Mode != nil { + return *m.Mode + } + return "" +} + +func (m *CreateSubscriptionCommand) GetDestinations() []string { + if m != nil { + return m.Destinations + } + return nil +} + +var E_CreateSubscriptionCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateSubscriptionCommand)(nil), + Field: 121, + Name: "meta.CreateSubscriptionCommand.command", + Tag: "bytes,121,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropSubscriptionCommand struct { + Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"` + Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"` + RetentionPolicy *string `protobuf:"bytes,3,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropSubscriptionCommand) Reset() { *m = DropSubscriptionCommand{} } +func (m *DropSubscriptionCommand) String() string { return proto.CompactTextString(m) } +func (*DropSubscriptionCommand) ProtoMessage() {} +func (*DropSubscriptionCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{33} } + +func (m *DropSubscriptionCommand) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DropSubscriptionCommand) GetDatabase() string { + if m != nil && m.Database != nil { + return *m.Database + } + return "" +} + +func (m *DropSubscriptionCommand) GetRetentionPolicy() string { + if m != nil && m.RetentionPolicy != nil { + return *m.RetentionPolicy + } + return "" +} + +var E_DropSubscriptionCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropSubscriptionCommand)(nil), + Field: 122, + Name: "meta.DropSubscriptionCommand.command", + Tag: "bytes,122,opt,name=command", + Filename: "internal/meta.proto", +} + +type RemovePeerCommand struct { + ID *uint64 `protobuf:"varint,1,opt,name=ID" json:"ID,omitempty"` + Addr *string `protobuf:"bytes,2,req,name=Addr" json:"Addr,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RemovePeerCommand) Reset() { *m = RemovePeerCommand{} } +func (m *RemovePeerCommand) String() string { return proto.CompactTextString(m) } +func (*RemovePeerCommand) ProtoMessage() {} +func (*RemovePeerCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{34} } + +func (m *RemovePeerCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *RemovePeerCommand) GetAddr() string { + if m != nil && m.Addr != nil { + return *m.Addr + } + return "" +} + +var E_RemovePeerCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*RemovePeerCommand)(nil), + Field: 123, + Name: "meta.RemovePeerCommand.command", + Tag: "bytes,123,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateMetaNodeCommand struct { + HTTPAddr *string `protobuf:"bytes,1,req,name=HTTPAddr" json:"HTTPAddr,omitempty"` + TCPAddr *string `protobuf:"bytes,2,req,name=TCPAddr" json:"TCPAddr,omitempty"` + Rand *uint64 `protobuf:"varint,3,req,name=Rand" json:"Rand,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateMetaNodeCommand) Reset() { *m = CreateMetaNodeCommand{} } +func (m *CreateMetaNodeCommand) String() string { return proto.CompactTextString(m) } +func (*CreateMetaNodeCommand) ProtoMessage() {} +func (*CreateMetaNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{35} } + +func (m *CreateMetaNodeCommand) GetHTTPAddr() string { + if m != nil && m.HTTPAddr != nil { + return *m.HTTPAddr + } + return "" +} + +func (m *CreateMetaNodeCommand) GetTCPAddr() string { + if m != nil && m.TCPAddr != nil { + return *m.TCPAddr + } + return "" +} + +func (m *CreateMetaNodeCommand) GetRand() uint64 { + if m != nil && m.Rand != nil { + return *m.Rand + } + return 0 +} + +var E_CreateMetaNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateMetaNodeCommand)(nil), + Field: 124, + Name: "meta.CreateMetaNodeCommand.command", + Tag: "bytes,124,opt,name=command", + Filename: "internal/meta.proto", +} + +type CreateDataNodeCommand struct { + HTTPAddr *string `protobuf:"bytes,1,req,name=HTTPAddr" json:"HTTPAddr,omitempty"` + TCPAddr *string `protobuf:"bytes,2,req,name=TCPAddr" json:"TCPAddr,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CreateDataNodeCommand) Reset() { *m = CreateDataNodeCommand{} } +func (m *CreateDataNodeCommand) String() string { return proto.CompactTextString(m) } +func (*CreateDataNodeCommand) ProtoMessage() {} +func (*CreateDataNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{36} } + +func (m *CreateDataNodeCommand) GetHTTPAddr() string { + if m != nil && m.HTTPAddr != nil { + return *m.HTTPAddr + } + return "" +} + +func (m *CreateDataNodeCommand) GetTCPAddr() string { + if m != nil && m.TCPAddr != nil { + return *m.TCPAddr + } + return "" +} + +var E_CreateDataNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*CreateDataNodeCommand)(nil), + Field: 125, + Name: "meta.CreateDataNodeCommand.command", + Tag: "bytes,125,opt,name=command", + Filename: "internal/meta.proto", +} + +type UpdateDataNodeCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + Host *string `protobuf:"bytes,2,req,name=Host" json:"Host,omitempty"` + TCPHost *string `protobuf:"bytes,3,req,name=TCPHost" json:"TCPHost,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UpdateDataNodeCommand) Reset() { *m = UpdateDataNodeCommand{} } +func (m *UpdateDataNodeCommand) String() string { return proto.CompactTextString(m) } +func (*UpdateDataNodeCommand) ProtoMessage() {} +func (*UpdateDataNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{37} } + +func (m *UpdateDataNodeCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +func (m *UpdateDataNodeCommand) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +func (m *UpdateDataNodeCommand) GetTCPHost() string { + if m != nil && m.TCPHost != nil { + return *m.TCPHost + } + return "" +} + +var E_UpdateDataNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*UpdateDataNodeCommand)(nil), + Field: 126, + Name: "meta.UpdateDataNodeCommand.command", + Tag: "bytes,126,opt,name=command", + Filename: "internal/meta.proto", +} + +type DeleteMetaNodeCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteMetaNodeCommand) Reset() { *m = DeleteMetaNodeCommand{} } +func (m *DeleteMetaNodeCommand) String() string { return proto.CompactTextString(m) } +func (*DeleteMetaNodeCommand) ProtoMessage() {} +func (*DeleteMetaNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{38} } + +func (m *DeleteMetaNodeCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +var E_DeleteMetaNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DeleteMetaNodeCommand)(nil), + Field: 127, + Name: "meta.DeleteMetaNodeCommand.command", + Tag: "bytes,127,opt,name=command", + Filename: "internal/meta.proto", +} + +type DeleteDataNodeCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteDataNodeCommand) Reset() { *m = DeleteDataNodeCommand{} } +func (m *DeleteDataNodeCommand) String() string { return proto.CompactTextString(m) } +func (*DeleteDataNodeCommand) ProtoMessage() {} +func (*DeleteDataNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{39} } + +func (m *DeleteDataNodeCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +var E_DeleteDataNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DeleteDataNodeCommand)(nil), + Field: 128, + Name: "meta.DeleteDataNodeCommand.command", + Tag: "bytes,128,opt,name=command", + Filename: "internal/meta.proto", +} + +type Response struct { + OK *bool `protobuf:"varint,1,req,name=OK" json:"OK,omitempty"` + Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"` + Index *uint64 `protobuf:"varint,3,opt,name=Index" json:"Index,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Response) Reset() { *m = Response{} } +func (m *Response) String() string { return proto.CompactTextString(m) } +func (*Response) ProtoMessage() {} +func (*Response) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{40} } + +func (m *Response) GetOK() bool { + if m != nil && m.OK != nil { + return *m.OK + } + return false +} + +func (m *Response) GetError() string { + if m != nil && m.Error != nil { + return *m.Error + } + return "" +} + +func (m *Response) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +// SetMetaNodeCommand is for the initial metanode in a cluster or +// if the single host restarts and its hostname changes, this will update it +type SetMetaNodeCommand struct { + HTTPAddr *string `protobuf:"bytes,1,req,name=HTTPAddr" json:"HTTPAddr,omitempty"` + TCPAddr *string `protobuf:"bytes,2,req,name=TCPAddr" json:"TCPAddr,omitempty"` + Rand *uint64 `protobuf:"varint,3,req,name=Rand" json:"Rand,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SetMetaNodeCommand) Reset() { *m = SetMetaNodeCommand{} } +func (m *SetMetaNodeCommand) String() string { return proto.CompactTextString(m) } +func (*SetMetaNodeCommand) ProtoMessage() {} +func (*SetMetaNodeCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{41} } + +func (m *SetMetaNodeCommand) GetHTTPAddr() string { + if m != nil && m.HTTPAddr != nil { + return *m.HTTPAddr + } + return "" +} + +func (m *SetMetaNodeCommand) GetTCPAddr() string { + if m != nil && m.TCPAddr != nil { + return *m.TCPAddr + } + return "" +} + +func (m *SetMetaNodeCommand) GetRand() uint64 { + if m != nil && m.Rand != nil { + return *m.Rand + } + return 0 +} + +var E_SetMetaNodeCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*SetMetaNodeCommand)(nil), + Field: 129, + Name: "meta.SetMetaNodeCommand.command", + Tag: "bytes,129,opt,name=command", + Filename: "internal/meta.proto", +} + +type DropShardCommand struct { + ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DropShardCommand) Reset() { *m = DropShardCommand{} } +func (m *DropShardCommand) String() string { return proto.CompactTextString(m) } +func (*DropShardCommand) ProtoMessage() {} +func (*DropShardCommand) Descriptor() ([]byte, []int) { return fileDescriptorMeta, []int{42} } + +func (m *DropShardCommand) GetID() uint64 { + if m != nil && m.ID != nil { + return *m.ID + } + return 0 +} + +var E_DropShardCommand_Command = &proto.ExtensionDesc{ + ExtendedType: (*Command)(nil), + ExtensionType: (*DropShardCommand)(nil), + Field: 130, + Name: "meta.DropShardCommand.command", + Tag: "bytes,130,opt,name=command", + Filename: "internal/meta.proto", +} + +func init() { + proto.RegisterType((*Data)(nil), "meta.Data") + proto.RegisterType((*NodeInfo)(nil), "meta.NodeInfo") + proto.RegisterType((*DatabaseInfo)(nil), "meta.DatabaseInfo") + proto.RegisterType((*RetentionPolicySpec)(nil), "meta.RetentionPolicySpec") + proto.RegisterType((*RetentionPolicyInfo)(nil), "meta.RetentionPolicyInfo") + proto.RegisterType((*ShardGroupInfo)(nil), "meta.ShardGroupInfo") + proto.RegisterType((*ShardInfo)(nil), "meta.ShardInfo") + proto.RegisterType((*SubscriptionInfo)(nil), "meta.SubscriptionInfo") + proto.RegisterType((*ShardOwner)(nil), "meta.ShardOwner") + proto.RegisterType((*ContinuousQueryInfo)(nil), "meta.ContinuousQueryInfo") + proto.RegisterType((*UserInfo)(nil), "meta.UserInfo") + proto.RegisterType((*UserPrivilege)(nil), "meta.UserPrivilege") + proto.RegisterType((*Command)(nil), "meta.Command") + proto.RegisterType((*CreateNodeCommand)(nil), "meta.CreateNodeCommand") + proto.RegisterType((*DeleteNodeCommand)(nil), "meta.DeleteNodeCommand") + proto.RegisterType((*CreateDatabaseCommand)(nil), "meta.CreateDatabaseCommand") + proto.RegisterType((*DropDatabaseCommand)(nil), "meta.DropDatabaseCommand") + proto.RegisterType((*CreateRetentionPolicyCommand)(nil), "meta.CreateRetentionPolicyCommand") + proto.RegisterType((*DropRetentionPolicyCommand)(nil), "meta.DropRetentionPolicyCommand") + proto.RegisterType((*SetDefaultRetentionPolicyCommand)(nil), "meta.SetDefaultRetentionPolicyCommand") + proto.RegisterType((*UpdateRetentionPolicyCommand)(nil), "meta.UpdateRetentionPolicyCommand") + proto.RegisterType((*CreateShardGroupCommand)(nil), "meta.CreateShardGroupCommand") + proto.RegisterType((*DeleteShardGroupCommand)(nil), "meta.DeleteShardGroupCommand") + proto.RegisterType((*CreateContinuousQueryCommand)(nil), "meta.CreateContinuousQueryCommand") + proto.RegisterType((*DropContinuousQueryCommand)(nil), "meta.DropContinuousQueryCommand") + proto.RegisterType((*CreateUserCommand)(nil), "meta.CreateUserCommand") + proto.RegisterType((*DropUserCommand)(nil), "meta.DropUserCommand") + proto.RegisterType((*UpdateUserCommand)(nil), "meta.UpdateUserCommand") + proto.RegisterType((*SetPrivilegeCommand)(nil), "meta.SetPrivilegeCommand") + proto.RegisterType((*SetDataCommand)(nil), "meta.SetDataCommand") + proto.RegisterType((*SetAdminPrivilegeCommand)(nil), "meta.SetAdminPrivilegeCommand") + proto.RegisterType((*UpdateNodeCommand)(nil), "meta.UpdateNodeCommand") + proto.RegisterType((*CreateSubscriptionCommand)(nil), "meta.CreateSubscriptionCommand") + proto.RegisterType((*DropSubscriptionCommand)(nil), "meta.DropSubscriptionCommand") + proto.RegisterType((*RemovePeerCommand)(nil), "meta.RemovePeerCommand") + proto.RegisterType((*CreateMetaNodeCommand)(nil), "meta.CreateMetaNodeCommand") + proto.RegisterType((*CreateDataNodeCommand)(nil), "meta.CreateDataNodeCommand") + proto.RegisterType((*UpdateDataNodeCommand)(nil), "meta.UpdateDataNodeCommand") + proto.RegisterType((*DeleteMetaNodeCommand)(nil), "meta.DeleteMetaNodeCommand") + proto.RegisterType((*DeleteDataNodeCommand)(nil), "meta.DeleteDataNodeCommand") + proto.RegisterType((*Response)(nil), "meta.Response") + proto.RegisterType((*SetMetaNodeCommand)(nil), "meta.SetMetaNodeCommand") + proto.RegisterType((*DropShardCommand)(nil), "meta.DropShardCommand") + proto.RegisterEnum("meta.Command_Type", Command_Type_name, Command_Type_value) + proto.RegisterExtension(E_CreateNodeCommand_Command) + proto.RegisterExtension(E_DeleteNodeCommand_Command) + proto.RegisterExtension(E_CreateDatabaseCommand_Command) + proto.RegisterExtension(E_DropDatabaseCommand_Command) + proto.RegisterExtension(E_CreateRetentionPolicyCommand_Command) + proto.RegisterExtension(E_DropRetentionPolicyCommand_Command) + proto.RegisterExtension(E_SetDefaultRetentionPolicyCommand_Command) + proto.RegisterExtension(E_UpdateRetentionPolicyCommand_Command) + proto.RegisterExtension(E_CreateShardGroupCommand_Command) + proto.RegisterExtension(E_DeleteShardGroupCommand_Command) + proto.RegisterExtension(E_CreateContinuousQueryCommand_Command) + proto.RegisterExtension(E_DropContinuousQueryCommand_Command) + proto.RegisterExtension(E_CreateUserCommand_Command) + proto.RegisterExtension(E_DropUserCommand_Command) + proto.RegisterExtension(E_UpdateUserCommand_Command) + proto.RegisterExtension(E_SetPrivilegeCommand_Command) + proto.RegisterExtension(E_SetDataCommand_Command) + proto.RegisterExtension(E_SetAdminPrivilegeCommand_Command) + proto.RegisterExtension(E_UpdateNodeCommand_Command) + proto.RegisterExtension(E_CreateSubscriptionCommand_Command) + proto.RegisterExtension(E_DropSubscriptionCommand_Command) + proto.RegisterExtension(E_RemovePeerCommand_Command) + proto.RegisterExtension(E_CreateMetaNodeCommand_Command) + proto.RegisterExtension(E_CreateDataNodeCommand_Command) + proto.RegisterExtension(E_UpdateDataNodeCommand_Command) + proto.RegisterExtension(E_DeleteMetaNodeCommand_Command) + proto.RegisterExtension(E_DeleteDataNodeCommand_Command) + proto.RegisterExtension(E_SetMetaNodeCommand_Command) + proto.RegisterExtension(E_DropShardCommand_Command) +} + +func init() { proto.RegisterFile("internal/meta.proto", fileDescriptorMeta) } + +var fileDescriptorMeta = []byte{ + // 1808 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4b, 0x6f, 0x1c, 0xc7, + 0x11, 0x46, 0xcf, 0x3e, 0xb8, 0x5b, 0x7c, 0xaa, 0xf9, 0x1a, 0x4a, 0x14, 0xb3, 0x18, 0x08, 0xca, + 0x22, 0x08, 0x98, 0x60, 0x03, 0xe8, 0x94, 0x97, 0xc4, 0x95, 0xc4, 0x85, 0xc0, 0x47, 0x66, 0xa9, + 0x6b, 0x80, 0x11, 0xb7, 0x25, 0x6e, 0xb2, 0x3b, 0xb3, 0x99, 0x99, 0x95, 0xc4, 0x28, 0x4c, 0x18, + 0x5f, 0x7c, 0xb5, 0x61, 0x18, 0x3e, 0xe8, 0x66, 0x1f, 0x7c, 0x34, 0x0c, 0x03, 0x06, 0x0c, 0x9f, + 0x7c, 0xf7, 0x1f, 0xf0, 0x7f, 0xb0, 0xcf, 0xbe, 0x1a, 0xdd, 0x3d, 0x3d, 0xdd, 0x33, 0xd3, 0x3d, + 0x24, 0x65, 0xf9, 0x36, 0x5d, 0x55, 0xdd, 0xf5, 0x55, 0x75, 0x75, 0x75, 0x55, 0x0f, 0x2c, 0x0f, + 0xfd, 0x98, 0x84, 0xbe, 0x37, 0xfa, 0xdd, 0x98, 0xc4, 0xde, 0xf6, 0x24, 0x0c, 0xe2, 0x00, 0x57, + 0xe9, 0xb7, 0xf3, 0x5e, 0x05, 0xaa, 0x5d, 0x2f, 0xf6, 0x30, 0x86, 0xea, 0x11, 0x09, 0xc7, 0x36, + 0x6a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, 0xea, 0x65, 0x55, + 0x10, 0xff, 0x11, 0xe6, 0xfb, 0xd3, 0x27, 0xd1, 0x71, 0x38, 0x9c, 0x50, 0x1d, 0xe2, 0x28, 0xae, + 0x25, 0x33, 0x15, 0x16, 0x9b, 0x9b, 0x15, 0x76, 0xbe, 0x41, 0xb0, 0x90, 0x5d, 0xbd, 0x10, 0xdd, + 0x9b, 0xd0, 0xec, 0xc7, 0x5e, 0x18, 0x1f, 0x0d, 0xc7, 0x24, 0xf1, 0x80, 0x24, 0xd0, 0x38, 0xbf, + 0xef, 0x0f, 0x18, 0x8f, 0xdb, 0x2d, 0x86, 0x74, 0x5e, 0x97, 0x8c, 0x48, 0x4c, 0x06, 0x77, 0x63, + 0x66, 0x6d, 0xc5, 0x95, 0x04, 0xfc, 0x6b, 0xa8, 0x33, 0xbd, 0xc2, 0xd2, 0x45, 0xc5, 0x52, 0x06, + 0x34, 0x61, 0xe3, 0x16, 0xcc, 0x1e, 0x85, 0x53, 0xff, 0xd8, 0xe3, 0x0b, 0xd5, 0xd9, 0x86, 0xab, + 0x24, 0x87, 0x40, 0x33, 0x9d, 0x56, 0x40, 0xbf, 0x05, 0x8d, 0x83, 0x17, 0x3e, 0x4d, 0x82, 0x91, + 0x6d, 0xb5, 0x2a, 0xed, 0xea, 0x3d, 0xcb, 0x46, 0x6e, 0x4a, 0xc3, 0x6d, 0xa8, 0xb3, 0x6f, 0x71, + 0x4a, 0x96, 0x14, 0x1c, 0x8c, 0xe1, 0x26, 0x7c, 0xe7, 0xef, 0xb0, 0x94, 0xf7, 0xa6, 0x36, 0x60, + 0x30, 0x54, 0xf7, 0x82, 0x01, 0x11, 0xd9, 0x80, 0x7e, 0x63, 0x07, 0xe6, 0xba, 0x24, 0x8a, 0x87, + 0xbe, 0xc7, 0xf7, 0x88, 0xea, 0x6a, 0xba, 0x19, 0x9a, 0x73, 0x0b, 0x40, 0x6a, 0xc5, 0x6b, 0x50, + 0x4f, 0x12, 0x26, 0xb7, 0x25, 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0x22, 0xba, 0x2a, 0x42, 0x5a, 0x5a, 0xee, + 0x93, 0x17, 0x8c, 0x9c, 0xb4, 0x50, 0xc9, 0x30, 0x53, 0x93, 0x57, 0x73, 0x7d, 0x82, 0x5a, 0x63, + 0xd7, 0xb2, 0x75, 0x7f, 0x49, 0xbc, 0x8c, 0xd4, 0x78, 0x29, 0xb3, 0x42, 0xda, 0xfb, 0x05, 0x32, + 0x5e, 0xab, 0xa5, 0xa6, 0xae, 0x41, 0x3d, 0xd3, 0xca, 0x25, 0x23, 0x5a, 0xec, 0xd0, 0xba, 0x39, + 0x8a, 0xbd, 0xf1, 0x24, 0xa9, 0xa5, 0x25, 0xa1, 0xf3, 0xc0, 0x08, 0x7d, 0xcc, 0xa0, 0xdf, 0x54, + 0x43, 0xbd, 0x00, 0x48, 0xa2, 0xfe, 0x0a, 0x19, 0xef, 0xfb, 0x37, 0x42, 0xed, 0xc0, 0x5c, 0xa6, + 0x75, 0xe7, 0x4f, 0x0f, 0x19, 0x5a, 0x09, 0x76, 0x5f, 0xc5, 0x6e, 0x80, 0x25, 0xb1, 0x7f, 0x8e, + 0xca, 0xcb, 0x91, 0x2b, 0x47, 0x58, 0x5a, 0x21, 0x57, 0x94, 0x0a, 0xb9, 0x24, 0x4a, 0x82, 0x62, + 0x56, 0xd1, 0x23, 0x29, 0x66, 0x95, 0xb7, 0x83, 0xb8, 0x24, 0xab, 0x4c, 0xf2, 0x59, 0xe5, 0x22, + 0x64, 0x1f, 0x20, 0x4d, 0x69, 0xf6, 0xf3, 0x5a, 0x82, 0x92, 0xcb, 0xf7, 0x5f, 0xc5, 0x9b, 0x5f, + 0x51, 0x2b, 0x51, 0x91, 0x42, 0x61, 0xa8, 0xbd, 0xbf, 0xfe, 0x6c, 0x54, 0x14, 0x32, 0x45, 0xab, + 0xd2, 0x0f, 0x5a, 0x35, 0x67, 0x9a, 0x52, 0xf3, 0xb2, 0xb6, 0x97, 0x58, 0x19, 0xa9, 0x56, 0x16, + 0x14, 0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 0x94, 0x85, + 0x52, 0x2d, 0x3f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x04, 0x86, 0xd9, 0x75, 0x1c, 0x00, 0x00, +} diff --git a/tsdb/migrate/migrate.go b/tsdb/migrate/migrate.go index 8d3799401d..bdf038501d 100644 --- a/tsdb/migrate/migrate.go +++ b/tsdb/migrate/migrate.go @@ -45,6 +45,8 @@ const ( 4 // Size in bytes of block tsmKeyFieldSeparator1x = "#!~#" // tsm1 key field separator. + + metaFile = "meta.db" // Default name of meta database ) type Config struct { @@ -267,10 +269,24 @@ func (m *Migrator) createBucket(db, rp string) (influxdb.ID, error) { return bucket.ID, nil } + retName := "" + retDuration := time.Duration(0) + + if rp != "" { + retentionPolicyInfo, err := m.getRetentionPolicy(db, rp) + if err != nil { + return 0, err + } + retName = retentionPolicyInfo.Name + retDuration = retentionPolicyInfo.Duration + } + if !m.DryRun { bucket = &influxdb.Bucket{ - Name: name, - OrgID: m.DestOrg, + OrgID: m.DestOrg, + Name: name, + RetentionPolicyName: retName, + RetentionPeriod: retDuration, } if err := m.metaSvc.CreateBucket(context.Background(), bucket); err != nil { return 0, err @@ -283,6 +299,31 @@ func (m *Migrator) createBucket(db, rp string) (influxdb.ID, error) { return bucket.ID, nil } +// Load and extract retention policy from meta.db +func (m *Migrator) getRetentionPolicy(dbFilter, rpFilter string) (*RetentionPolicyInfo, error) { + file := filepath.Join(m.SourcePath, "meta/"+metaFile) + + data, err := ioutil.ReadFile(file) + if err != nil { + return nil, err + } + + var cacheData = new(Data) + cacheData.UnmarshalBinary(data) + + for _, database := range cacheData.Databases { + if database.Name == dbFilter { + for _, retPolicy := range database.RetentionPolicies { + if retPolicy.Name == rpFilter { + return &retPolicy, nil + } + } + } + } + + return nil, errors.New("unable to find retention policy") +} + // Process1xShard migrates the TSM data in a single 1.x shard to the 2.x data directory. // // First, the shard is checked to determine it's fully compacted. Hot shards are diff --git a/tsdb/tsm1/engine_measurement_schema.go b/tsdb/tsm1/engine_measurement_schema.go index 4ae7699332..fe9b32559e 100644 --- a/tsdb/tsm1/engine_measurement_schema.go +++ b/tsdb/tsm1/engine_measurement_schema.go @@ -301,7 +301,7 @@ func (e *Engine) fieldsPredicate(ctx context.Context, orgID influxdb.ID, bucketI vals := make([]cursors.MeasurementField, 0, len(tsmValues)) for key, val := range tsmValues { - vals = append(vals, cursors.MeasurementField{Key: key, Type: val.typ}) + vals = append(vals, cursors.MeasurementField{Key: key, Type: val.typ, Timestamp: val.max}) } return cursors.NewMeasurementFieldsSliceIteratorWithStats([]cursors.MeasurementFields{{Fields: vals}}, stats), nil @@ -403,7 +403,7 @@ func (e *Engine) fieldsNoPredicate(ctx context.Context, orgID influxdb.ID, bucke vals := make([]cursors.MeasurementField, 0, len(tsmValues)) for key, val := range tsmValues { - vals = append(vals, cursors.MeasurementField{Key: key, Type: val.typ}) + vals = append(vals, cursors.MeasurementField{Key: key, Type: val.typ, Timestamp: val.max}) } return cursors.NewMeasurementFieldsSliceIteratorWithStats([]cursors.MeasurementFields{{Fields: vals}}, stats), nil diff --git a/tsdb/tsm1/engine_measurement_schema_test.go b/tsdb/tsm1/engine_measurement_schema_test.go index 726971e9cb..aeb49ff912 100644 --- a/tsdb/tsm1/engine_measurement_schema_test.go +++ b/tsdb/tsm1/engine_measurement_schema_test.go @@ -877,7 +877,7 @@ m10,foo=v barS="60" 501 min: 0, max: 300, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String, Timestamp: 209}, {Key: "f", Type: cursors.Float, Timestamp: 201}}, expStats: makeStats(12), }, { @@ -888,7 +888,7 @@ m10,foo=v barS="60" 501 min: 0, max: 199, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer, Timestamp: 109}, {Key: "f", Type: cursors.Float, Timestamp: 109}}, expStats: makeStats(12), }, { @@ -899,7 +899,7 @@ m10,foo=v barS="60" 501 min: 0, max: 1000, }, - exp: []cursors.MeasurementField{{Key: "b", Type: cursors.Boolean}}, + exp: []cursors.MeasurementField{{Key: "b", Type: cursors.Boolean, Timestamp: 201}}, expStats: makeStats(1), }, { @@ -910,7 +910,7 @@ m10,foo=v barS="60" 501 min: 0, max: 199, }, - exp: []cursors.MeasurementField{{Key: "barF", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "barF", Type: cursors.Float, Timestamp: 101}}, expStats: makeStats(1), }, { @@ -921,7 +921,7 @@ m10,foo=v barS="60" 501 min: 200, max: 299, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String, Timestamp: 209}, {Key: "f", Type: cursors.Float, Timestamp: 201}}, expStats: makeStats(6), }, { @@ -932,7 +932,7 @@ m10,foo=v barS="60" 501 min: 109, max: 109, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer, Timestamp: 109}, {Key: "f", Type: cursors.Float, Timestamp: 109}}, expStats: makeStats(6), }, { @@ -943,7 +943,7 @@ m10,foo=v barS="60" 501 min: 201, max: 201, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer, Timestamp: 202}, {Key: "f", Type: cursors.Float, Timestamp: 201}}, expStats: makeStats(6), }, { @@ -954,7 +954,7 @@ m10,foo=v barS="60" 501 min: 202, max: 202, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String, Timestamp: 209}}, expStats: makeStats(6), }, { @@ -990,7 +990,7 @@ m10,foo=v barS="60" 501 max: 300, expr: `tag10 = 'v10'`, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer}, {Key: "f", Type: cursors.Float}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.Integer, Timestamp: 202}, {Key: "f", Type: cursors.Float, Timestamp: 201}}, expStats: makeStats(3), }, { @@ -1002,7 +1002,7 @@ m10,foo=v barS="60" 501 max: 300, expr: `tag10 = 'v11'`, }, - exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String}}, + exp: []cursors.MeasurementField{{Key: "i", Type: cursors.String, Timestamp: 209}}, expStats: makeStats(3), }, @@ -1017,7 +1017,7 @@ m10,foo=v barS="60" 501 min: 0, max: 1000, }, - exp: []cursors.MeasurementField{{Key: "barF", Type: cursors.Float}, {Key: "barS", Type: cursors.String}}, + exp: []cursors.MeasurementField{{Key: "barF", Type: cursors.Float, Timestamp: 101}, {Key: "barS", Type: cursors.String, Timestamp: 501}}, expStats: makeStats(1), }, diff --git a/ui/cypress/e2e/buckets.test.ts b/ui/cypress/e2e/buckets.test.ts index 661c4533ff..c92dd245a6 100644 --- a/ui/cypress/e2e/buckets.test.ts +++ b/ui/cypress/e2e/buckets.test.ts @@ -65,10 +65,7 @@ describe('Buckets', () => { }) cy.get('@bucket').then(() => { - cy.getByTestID(`cf-resource-card--meta-item`).should( - 'contain', - '7 days' - ) + cy.getByTestID(`bucket-retention`).should('contain', '7 days') }) }) diff --git a/ui/cypress/e2e/checks.test.ts b/ui/cypress/e2e/checks.test.ts index 2fdd42f38c..b369be66ed 100644 --- a/ui/cypress/e2e/checks.test.ts +++ b/ui/cypress/e2e/checks.test.ts @@ -120,6 +120,8 @@ describe('Checks', () => { cy.getByTestID('popover--dialog') .should('exist') .contains('Last Run Status:') + // Need to trigger mouseout else the popover obscures the other buttons + .trigger('mouseout') // create a label cy.getByTestID('check-card').within(() => { diff --git a/ui/cypress/e2e/dashboardsView.test.ts b/ui/cypress/e2e/dashboardsView.test.ts index f1ad9be901..07a0483015 100644 --- a/ui/cypress/e2e/dashboardsView.test.ts +++ b/ui/cypress/e2e/dashboardsView.test.ts @@ -301,13 +301,7 @@ describe('Dashboard', () => { cy.createDashWithViewAndVar(orgID).then(() => { cy.fixture('routes').then(({orgs}) => { cy.visit(`${orgs}/${orgID}/dashboards`) - cy.getByTestID('dashboard-card--name').within(() => { - // Ideally we don't need to select the clickable element within the card name. - // The testID here should be on the clickable element - // Issue created in Clockface: https://github.com/influxdata/clockface/issues/478 - cy.get('.cf-resource-name--text').click() - }) - + cy.getByTestID('dashboard-card--name').click() cy.get('.cell--view').should('have.length', 1) }) }) diff --git a/ui/cypress/e2e/labels.test.ts b/ui/cypress/e2e/labels.test.ts index ef3ac5b69b..8466aa1f7c 100644 --- a/ui/cypress/e2e/labels.test.ts +++ b/ui/cypress/e2e/labels.test.ts @@ -153,8 +153,7 @@ describe('labels', () => { .contains(newLabelDescription) .should('be.visible') cy.getByTestID('label-card') - .children('div.cf-resource-card--contents') - .children('div.cf-resource-card--row') + .children('div.cf-flex-box') .children('div.cf-label') .invoke('attr', 'style') .should('contain', hex2BgColor(newLabelColor)) @@ -197,8 +196,7 @@ describe('labels', () => { .should('be.visible') cy.getByTestID('label-card') - .children('div.cf-resource-card--contents') - .children('div.cf-resource-card--row') + .children('div.cf-flex-box') .children('div.cf-label') .invoke('attr', 'style') .should('contain', hex2BgColor(oldLabelColor)) @@ -242,8 +240,7 @@ describe('labels', () => { .contains(newLabelDescription) .should('be.visible') cy.getByTestID('label-card') - .children('div.cf-resource-card--contents') - .children('div.cf-resource-card--row') + .children('div.cf-flex-box') .children('div.cf-label') .invoke('attr', 'style') .should('contain', hex2BgColor(newLabelColor)) diff --git a/ui/package.json b/ui/package.json index cc13120850..be8e4a03a3 100644 --- a/ui/package.json +++ b/ui/package.json @@ -129,9 +129,9 @@ "webpack-merge": "^4.2.1" }, "dependencies": { - "@influxdata/clockface": "2.0.3", + "@influxdata/clockface": "2.1.0", "@influxdata/flux": "^0.4.0", - "@influxdata/flux-lsp-browser": "^0.4.2", + "@influxdata/flux-lsp-browser": "^0.5.1", "@influxdata/flux-parser": "^0.3.0", "@influxdata/giraffe": "0.18.0", "@influxdata/influx": "0.5.5", diff --git a/ui/src/Signin.tsx b/ui/src/Signin.tsx index 869af0fd16..70717f8222 100644 --- a/ui/src/Signin.tsx +++ b/ui/src/Signin.tsx @@ -2,7 +2,6 @@ import React, {ReactElement, PureComponent} from 'react' import {withRouter, WithRouterProps} from 'react-router' import {connect} from 'react-redux' -import auth0js from 'auth0-js' import {client} from 'src/utils/api' @@ -20,9 +19,6 @@ import {CLOUD, CLOUD_SIGNIN_PATHNAME} from 'src/shared/constants' // Types import {RemoteDataState} from 'src/types' -// Utils -import {getAuth0Config} from 'src/authorizations/apis' - interface State { loading: RemoteDataState } @@ -85,45 +81,9 @@ export class Signin extends PureComponent { clearInterval(this.intervalID) - const config = await getAuth0Config() - if (CLOUD && config.socialSignUpOn) { - // The redirectUri must be the same as the url for the origin of the request - // otherwise there's a mismatch and Auth0 cannot validate the response - const redirectUri = window.location.href - // The responseType is arbitrary as it needs to be a non-empty, non "code" value: - // https://auth0.github.io/auth0.js/web-auth_index.js.html#line564 - const responseType = 'token' - - const auth0 = new auth0js.WebAuth({ - domain: config.domain, - clientID: config.clientID, - redirectUri, - responseType, - }) - // This is the result of JS & Auth0 weirdness - return new Promise((resolve, reject) => { - // The TLDR is that checkSession is not awaiting the callback to complete - // So checkSession can return a successful response and continue with the operation - // without the callback being completely finished - return auth0.checkSession({}, (error, webResponse) => { - if (error) { - reject(error) - } - resolve(webResponse) - }) - }) - .then(() => { - window.location.pathname = CLOUD_SIGNIN_PATHNAME - }) - .catch(() => { - this.props.router.replace('/login') - }) - } - - // TODO: add returnTo to CLOUD signin if (CLOUD) { + // TODO: add returnTo to CLOUD signin window.location.pathname = CLOUD_SIGNIN_PATHNAME - throw error } diff --git a/ui/src/alerting/components/builder/MatchingRuleCard.tsx b/ui/src/alerting/components/builder/MatchingRuleCard.tsx index 634d89836e..e3f81c731f 100644 --- a/ui/src/alerting/components/builder/MatchingRuleCard.tsx +++ b/ui/src/alerting/components/builder/MatchingRuleCard.tsx @@ -30,16 +30,14 @@ const MatchingRuleCard: FC = ({rule, endpoints}) => { const endpoint = endpoints.find(e => e.id === rule.endpointID) return ( - } - description={} - metaData={[ - <>{`Checks every: ${rule.every}`}, - <>{`Sends notifications to: ${endpoint.name}`}, - ]} - /> + + + + + <>{`Checks every: ${rule.every}`} + <>{`Sends notifications to: ${endpoint.name}`} + + ) } diff --git a/ui/src/buckets/components/BucketCard.tsx b/ui/src/buckets/components/BucketCard.tsx index 9a268fdff9..a7daadb622 100644 --- a/ui/src/buckets/components/BucketCard.tsx +++ b/ui/src/buckets/components/BucketCard.tsx @@ -136,20 +136,30 @@ const BucketCard: FC = ({ ) - const retention = <>Retention: {bucket.readableRetention} - const cardMetaItems = - bucket.type === 'user' - ? [retention] - : [ - - System Bucket - , - retention, - ] + let cardMeta = ( + + + Retention: {_.capitalize(bucket.readableRetention)} + + + ) + + if (bucket.type !== 'user') { + cardMeta = ( + + + System Bucket + + + Retention: {_.capitalize(bucket.readableRetention)} + + + ) + } return ( = ({ ) } - name={ - - } - metaData={cardMetaItems} > + + {cardMeta} {bucket.type === 'user' && actionButtons} ) diff --git a/ui/src/buckets/components/DemoDataBucketCard.tsx b/ui/src/buckets/components/DemoDataBucketCard.tsx index 25cca03af3..d2d8431694 100644 --- a/ui/src/buckets/components/DemoDataBucketCard.tsx +++ b/ui/src/buckets/components/DemoDataBucketCard.tsx @@ -69,23 +69,21 @@ const DemoDataBucketCard: FC = ({ } - name={ - - } - metaData={[ + > + + Demo Data Bucket - , - <>Retention: {bucket.readableRetention}, - ]} - > + + <>Retention: {bucket.readableRetention} +