MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / fromCell

Method fromCell

src/KeyValue.java:310–325  ·  view source on GitHub ↗

Transforms a protobuf Cell message into a KeyValue (HBase 0.95+). @param buf The buffer to de-serialize from. @param prev Another KeyValue previously de-serialized from the same buffer. Can be null. The idea here is that KeyValues often come in a sorted batch, and often share a num

(final CellPB.Cell cell, final KeyValue prev)

Source from the content-addressed store, hash-verified

308 * @return a new instance (guaranteed non-{@code null}).
309 */
310 static KeyValue fromCell(final CellPB.Cell cell, final KeyValue prev) {
311 final byte[] key = Bytes.get(cell.getRow());
312 final byte[] family = Bytes.get(cell.getFamily());
313 final byte[] qualifier = Bytes.get(cell.getQualifier());
314 final long timestamp = cell.getTimestamp();
315 final byte[] value = Bytes.get(cell.getValue());
316 if (prev == null) {
317 return new KeyValue(key, family, qualifier, timestamp, /*key_type,*/
318 value);
319 } else {
320 return new KeyValue(Bytes.deDup(prev.key, key),
321 Bytes.deDup(prev.family, family),
322 Bytes.deDup(prev.qualifier, qualifier),
323 timestamp, /*key_type,*/ value);
324 }
325 }
326
327 // ------------------------------------------------------------ //
328 // Misc helper functions to validate some aspects of KeyValues. //

Callers 3

convertResultMethod · 0.95
convertResultMethod · 0.95

Calls 2

getMethod · 0.95
deDupMethod · 0.95

Tested by

no test coverage detected