static byte[] rowKeyTemplate(final TSDB tsdb, final String metric,
      final Map<String, String> tags) {
    final short metric_width = tsdb.metrics.width();
    final short tag_name_width = tsdb.tag_names.width();
    final short tag_value_width = tsdb.tag_values.width();
    final short num_tags = (short) tags.size();

    int row_size = (Const.SALT_WIDTH() + metric_width + Const.TIMESTAMP_BYTES 
        + tag_name_width * num_tags + tag_value_width * num_tags);
    final byte[] row = new byte[row_size];

    short pos = (short) Const.SALT_WIDTH();

    copyInRowKey(row, pos,
        (tsdb.config.auto_metric() ? tsdb.metrics.getOrCreateId(metric)
            : tsdb.metrics.getId(metric)));
    pos += metric_width;

    pos += Const.TIMESTAMP_BYTES;

    for (final byte[] tag : Tags.resolveOrCreateAll(tsdb, tags)) {
      copyInRowKey(row, pos, tag);
      pos += tag.length;
    }
    return row;
  }
static byte [ ] rowKeyTemplate ( final TSDB tsdb , final String metric , final Map < String , String > tags ) { final short metric_width = tsdb . metrics . width ( ) ; final short tag_name_width = tsdb . tag_names . width ( ) ; final short tag_value_width = tsdb . tag_values . width ( ) ; final short num_tags = ( short ) tags . size ( ) ; int row_size = ( Const . SALT_WIDTH ( ) + metric_width + Const . TIMESTAMP_BYTES + tag_name_width * num_tags + tag_value_width * num_tags ) ; final byte [ ] row = new byte [ row_size ] ; short pos = ( short ) Const . SALT_WIDTH ( ) ; copyInRowKey ( row , pos , ( tsdb . config . auto_metric ( ) ? tsdb . metrics . getOrCreateId ( metric ) : tsdb . metrics . getId ( metric ) ) ) ; pos += metric_width ; pos += Const . TIMESTAMP_BYTES ; for ( final byte [ ] tag : Tags . resolveOrCreateAll ( tsdb , tags ) ) { copyInRowKey ( row , pos , tag ) ; pos += tag . length ; } return row ; }
Returns a partially initialized row key for this metric and these tags. The
only thing left to fill in is the base timestamp.