@Override public ByteBuffer getValue(Cell element) { return org.apache.cassandra.utils.ByteBufferUtil.clone(element.value()); }
for (Map.Entry<ByteBuffer, Cell> ent : valueSortedMap.entrySet()) { ByteBuffer col = ent.getKey(); ByteBuffer val = ent.getValue().value(); entries.add(StaticArrayEntry.of(StaticArrayBuffer.of(col), StaticArrayBuffer.of(val)));
public boolean validate(Cell cell) { return cell.value().remaining() < FBUtilities.MAX_UNSIGNED_SHORT; } }
public List<ByteBuffer> serializedValues(List<Cell> cells) { assert isMultiCell; List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(cells.size()); for (Cell c : cells) bbs.add(c.value()); return bbs; } }
static ByteBuffer getListItem(Iterator<Cell> iter, int index) throws InvalidRequestException { int adv = Iterators.advance(iter, index); if (adv == index && iter.hasNext()) return iter.next().value(); else return null; }
public List<ByteBuffer> serializedValues(List<Cell> cells) { assert isMultiCell; List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(cells.size() * 2); for (Cell c : cells) { bbs.add(c.name().collectionElement()); bbs.add(c.value()); } return bbs; } }
protected boolean isSatisfiedByValue(ByteBuffer value, Cell c, AbstractType<?> type, Operator operator, long now) throws InvalidRequestException { ByteBuffer columnValue = (c == null || !c.isLive(now)) ? null : c.value(); return compareWithOperator(operator, type, value, columnValue); }
protected int sizeOf(Cell cell) { int size = CELL_NAME_OFFSETS_OFFSET + Math.max(0, cell.name().size() - 1) * 2 + cell.value().remaining(); CellName name = cell.name(); for (int i = 0; i < name.size(); i++) size += name.get(i).remaining(); return size; }
public Reclaimer reclaimImmediately(Cell cell) { onHeap().released(cell.name().dataSize() + cell.value().remaining()); return this; }
public boolean equals(Cell cell) { return timestamp() == cell.timestamp() && name().equals(cell.name()) && value().equals(cell.value()) && serializationFlags() == cell.serializationFlags(); }
public Map<CellName, ByteBuffer> asMap() { ImmutableMap.Builder<CellName, ByteBuffer> builder = ImmutableMap.builder(); for (Cell cell : this) builder.put(cell.name(), cell.value()); return builder.build(); }
public boolean isIndexEntryStale(ByteBuffer indexedValue, ColumnFamily data, long now) { Cell cell = data.getColumn(data.getComparator().makeCellName(columnDef.name.bytes)); return cell == null || !cell.isLive(now) || columnDef.type.compare(indexedValue, cell.value()) != 0; }
private CounterColumn thriftifySubCounter(Cell cell) { assert cell instanceof CounterCell; return new CounterColumn(cell.name().toByteBuffer(), CounterContext.instance().total(cell.value())); }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || columnDef.type.compare(entry.indexValue.getKey(), cell.value()) != 0; } }
public Cell reconcile(Cell cell) { long ts1 = timestamp(), ts2 = cell.timestamp(); if (ts1 != ts2) return ts1 < ts2 ? cell : this; if (isLive() != cell.isLive()) return isLive() ? cell : this; return value().compareTo(cell.value()) < 0 ? cell : this; }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef, entry.indexedEntryCollectionKey); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || ((CollectionType) columnDef.type).valueComparator().compare(entry.indexValue.getKey(), cell.value()) != 0; } }
private Column thriftifySubColumn(Cell cell) { assert !(cell instanceof CounterCell); Column thrift_column = new Column(cell.name().toByteBuffer()).setValue(cell.value()).setTimestamp(cell.timestamp()); if (cell instanceof ExpiringCell) { thrift_column.setTtl(((ExpiringCell) cell).getTimeToLive()); } return thrift_column; }
private void updateCounterCache(Mutation applied, Keyspace keyspace) { if (CacheService.instance.counterCache.getCapacity() == 0) return; for (ColumnFamily cf : applied.getColumnFamilies()) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cf.id()); for (Cell cell : cf) if (cell instanceof CounterCell) cfs.putCachedCounter(key(), cell.name(), CounterContext.instance().getLocalClockAndCount(cell.value())); } }