protected static Tuple2 tupleFrom(Object... keys) { if (BINARY_STRINGS) { try { for (int i = 0; i < keys.length; i++) { if (keys[i] instanceof String) { keys[i] = ((String) keys[i]).getBytes("UTF-8"); } } } catch (UnsupportedEncodingException ex) { throw new AkibanInternalException("Error encoding binary string", ex); } } return Tuple2.from(keys); }
@Override protected byte[] encodeValue(MetricLevel<Long> onto) { return Tuple2.from(changeTime - onto.lastTime, get() - onto.lastValue).pack(); }
@Override protected byte[] encodeValue(MetricLevel<Boolean> onto) { return Tuple2.from(combine(changeTime, get()) - combine(onto.lastTime, onto.lastValue)) .pack(); }
@Override protected byte[] encodeValue() { // A timestamp and long value are stored as successive integers. return Tuple2.from(changeTime, get()).pack(); }
@Override protected byte[] encodeValue() { return Tuple2.from(combine(changeTime, get())).pack(); }