@Override public Object getMetaData(Cell element, EntryMetaData meta) { switch (meta) { case TIMESTAMP: return element.timestamp(); case TTL: return ((element instanceof ExpiringCell) ? ((ExpiringCell) element).getTimeToLive() : 0); default: throw new UnsupportedOperationException("Unsupported meta data: " + meta); } } }
@Override public Object getMetaData(Cell element, EntryMetaData meta) { switch (meta) { case TIMESTAMP: return element.timestamp(); case TTL: return ((element instanceof ExpiringCell) ? ((ExpiringCell) element).getTimeToLive() : 0); default: throw new UnsupportedOperationException("Unsupported meta data: " + meta); } } }
@Override public boolean equals(Cell cell) { if (!super.equals(cell)) return false; ExpiringCell that = (ExpiringCell) cell; return getLocalDeletionTime() == that.getLocalDeletionTime() && getTimeToLive() == that.getTimeToLive(); }
public boolean equals(Cell cell) { if (!super.equals(cell)) return false; ExpiringCell that = (ExpiringCell) cell; return getLocalDeletionTime() == that.getLocalDeletionTime() && getTimeToLive() == that.getTimeToLive(); }
serializedColumn.add(((ExpiringCell) cell).getTimeToLive()); serializedColumn.add(cell.getLocalDeletionTime());
@Override protected void construct(Cell from) { ExpiringCell expiring = (ExpiringCell) from; setInt(internalSize() - 4, expiring.getTimeToLive()); setInt(internalSize() - 8, expiring.getLocalDeletionTime()); super.construct(from); }
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; }
public void insert(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup) { DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, cell)); ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata, false, 1); CellName name = makeIndexColumnName(rowKey, cell); if (cell instanceof ExpiringCell) { ExpiringCell ec = (ExpiringCell) cell; cfi.addColumn(new BufferExpiringCell(name, ByteBufferUtil.EMPTY_BYTE_BUFFER, ec.timestamp(), ec.getTimeToLive(), ec.getLocalDeletionTime())); } else { cfi.addColumn(new BufferCell(name, ByteBufferUtil.EMPTY_BYTE_BUFFER, cell.timestamp())); } if (logger.isDebugEnabled()) logger.debug("applying index row {} in {}", indexCfs.metadata.getKeyValidator().getString(valueKey.getKey()), cfi); indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater, opGroup, null); }
public void serialize(Cell cell, DataOutputPlus out) throws IOException { assert !cell.name().isEmpty(); type.cellSerializer().serialize(cell.name(), out); try { out.writeByte(cell.serializationFlags()); if (cell instanceof CounterCell) { out.writeLong(((CounterCell) cell).timestampOfLastDelete()); } else if (cell instanceof ExpiringCell) { out.writeInt(((ExpiringCell) cell).getTimeToLive()); out.writeInt(cell.getLocalDeletionTime()); } out.writeLong(cell.timestamp()); ByteBufferUtil.writeWithLength(cell.value(), out); } catch (IOException e) { throw new RuntimeException(e); } }