IngesterPartitionID returns the partition ID owner of the given ingester.
(ingesterID string)
| 26 | |
| 27 | // IngesterPartitionID returns the partition ID owner of the given ingester. |
| 28 | func IngesterPartitionID(ingesterID string) (int32, error) { |
| 29 | match := ingesterIDRegexp.FindStringSubmatch(ingesterID) |
| 30 | if len(match) == 0 { |
| 31 | return 0, fmt.Errorf("ingester ID %s doesn't match regular expression %q", ingesterID, ingesterIDRegexp.String()) |
| 32 | } |
| 33 | |
| 34 | // Parse the ingester sequence number. |
| 35 | ingesterSeq, err := strconv.Atoi(match[1]) |
| 36 | if err != nil { |
| 37 | return 0, fmt.Errorf("no ingester sequence number in ingester ID %s", ingesterID) |
| 38 | } |
| 39 | |
| 40 | return int32(ingesterSeq), nil |
| 41 | } |
| 42 | |
| 43 | func LiveStoreConsumerGroupID(instanceID string) (string, error) { |
| 44 | match := ingesterIDRegexp.FindStringSubmatch(instanceID) |
no test coverage detected