Generates a TSUID given the metric and tag UIDs. @param metric A metric UID. @param tags A set of UIDs @return A TSUID byte array
(final byte[] metric, final byte[]... tags)
| 484 | * @return A TSUID byte array |
| 485 | */ |
| 486 | public static byte[] getTSUID(final byte[] metric, final byte[]... tags) { |
| 487 | int tags_length = 0; |
| 488 | for (final byte[] tag : tags) { |
| 489 | tags_length += tag.length; |
| 490 | } |
| 491 | final byte[] tsuid = new byte[metric.length + tags_length]; |
| 492 | System.arraycopy(metric, 0, tsuid, 0, metric.length); |
| 493 | int offset = metric.length; |
| 494 | for (final byte[] tag : tags) { |
| 495 | System.arraycopy(tag, 0, tsuid, offset, tag.length); |
| 496 | offset += tag.length; |
| 497 | } |
| 498 | RowKey.prefixKeyWithSalt(tsuid); |
| 499 | return tsuid; |
| 500 | } |
| 501 | |
| 502 | /** |
| 503 | * Generates a UID of the proper length given a type and ID. |
no test coverage detected