public Map<LatestSnapshotRow, Long> getStreamIds(Collection<LatestSnapshotRow> rows) { Map<Cell, LatestSnapshotRow> cells = Maps.newHashMapWithExpectedSize(rows.size()); for (LatestSnapshotRow row : rows) { cells.put(Cell.create(row.persistToBytes(), PtBytes.toCachedBytes("i")), row); } Map<Cell, byte[]> results = t.get(tableRef, cells.keySet()); Map<LatestSnapshotRow, Long> ret = Maps.newHashMapWithExpectedSize(results.size()); for (Entry<Cell, byte[]> e : results.entrySet()) { Long val = StreamId.BYTES_HYDRATOR.hydrateFromBytes(e.getValue()).getValue(); ret.put(cells.get(e.getKey()), val); } return ret; }
public void putStreamId(LatestSnapshotRow row, Long value) { put(ImmutableMultimap.of(row, StreamId.of(value))); }
public void putStreamId(LatestSnapshotRow row, Long value) { put(ImmutableMultimap.of(row, StreamId.of(value))); }
public static StreamId of(Long value) { return new StreamId(value); }
public Map<LatestSnapshotRow, Long> getStreamIds(Collection<LatestSnapshotRow> rows) { Map<Cell, LatestSnapshotRow> cells = Maps.newHashMapWithExpectedSize(rows.size()); for (LatestSnapshotRow row : rows) { cells.put(Cell.create(row.persistToBytes(), PtBytes.toCachedBytes("i")), row); } Map<Cell, byte[]> results = t.get(tableRef, cells.keySet()); Map<LatestSnapshotRow, Long> ret = Maps.newHashMapWithExpectedSize(results.size()); for (Entry<Cell, byte[]> e : results.entrySet()) { Long val = StreamId.BYTES_HYDRATOR.hydrateFromBytes(e.getValue()).getValue(); ret.put(cells.get(e.getKey()), val); } return ret; }
@Override public StreamId hydrateFromBytes(byte[] bytes) { bytes = CompressionUtils.decompress(bytes, Compression.NONE); return of(Long.MIN_VALUE ^ PtBytes.toLong(bytes, 0)); } };
public void putStreamId(Map<LatestSnapshotRow, Long> map) { Map<LatestSnapshotRow, LatestSnapshotNamedColumnValue<?>> toPut = Maps.newHashMapWithExpectedSize(map.size()); for (Entry<LatestSnapshotRow, Long> e : map.entrySet()) { toPut.put(e.getKey(), StreamId.of(e.getValue())); } put(Multimaps.forMap(toPut)); }
public Long getStreamId() { byte[] bytes = row.getColumns().get(PtBytes.toCachedBytes("i")); if (bytes == null) { return null; } StreamId value = StreamId.BYTES_HYDRATOR.hydrateFromBytes(bytes); return value.getValue(); }
public static StreamId of(Long value) { return new StreamId(value); }
@Override public StreamId hydrateFromBytes(byte[] bytes) { bytes = CompressionUtils.decompress(bytes, Compression.NONE); return of(Long.MIN_VALUE ^ PtBytes.toLong(bytes, 0)); } };
public Long getStreamId() { byte[] bytes = row.getColumns().get(PtBytes.toCachedBytes("i")); if (bytes == null) { return null; } StreamId value = StreamId.BYTES_HYDRATOR.hydrateFromBytes(bytes); return value.getValue(); }
public void putStreamId(Map<LatestSnapshotRow, Long> map) { Map<LatestSnapshotRow, LatestSnapshotNamedColumnValue<?>> toPut = Maps.newHashMapWithExpectedSize(map.size()); for (Entry<LatestSnapshotRow, Long> e : map.entrySet()) { toPut.put(e.getKey(), StreamId.of(e.getValue())); } put(Multimaps.forMap(toPut)); }