public void addColumn(CellName name, ByteBuffer value, long timestamp) { addColumn(name, value, timestamp, 0); }
public void addAtom(OnDiskAtom atom) { if (atom instanceof Cell) { addColumn((Cell)atom); } else { assert atom instanceof RangeTombstone; delete((RangeTombstone)atom); } }
public void addTombstone(CellName name, ByteBuffer localDeletionTime, long timestamp) { addColumn(new BufferDeletedCell(name, localDeletionTime, timestamp)); }
public void add(String cfName, CellName name, ByteBuffer value, long timestamp, int timeToLive) { addOrGet(cfName).addColumn(name, value, timestamp, timeToLive); }
public void addTombstone(CellName name, int localDeletionTime, long timestamp) { addColumn(new BufferDeletedCell(name, localDeletionTime, timestamp)); }
public void addCounter(CellName name, long value) { addColumn(new BufferCounterUpdateCell(name, value, FBUtilities.timestampMicros())); }
private CFRowAdder add(CellName name, ColumnDefinition def, Object value) { if (value == null) { cf.addColumn(new BufferDeletedCell(name, ldt, timestamp)); } else { AbstractType valueType = def.type.isCollection() ? ((CollectionType) def.type).valueComparator() : def.type; cf.addColumn(new BufferCell(name, value instanceof ByteBuffer ? (ByteBuffer)value : valueType.decompose(value), timestamp)); } return this; } }
public void addColumn(CellName name, ByteBuffer value, long timestamp, int timeToLive) { assert !metadata().isCounter(); Cell cell = AbstractCell.create(name, value, timestamp, timeToLive, metadata()); addColumn(cell); }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete an item by index from a frozen list"; Term.Terminal index = t.bind(params.options); if (index == null) throw new InvalidRequestException("Invalid null value for list index"); List<Cell> existingList = params.getPrefetchedList(rowKey, column.name); int idx = ByteBufferUtil.toInt(index.get(params.options)); if (existingList == null || existingList.size() == 0) throw new InvalidRequestException("Attempted to delete an element from a list which is null"); if (idx < 0 || idx >= existingList.size()) throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingList.size())); CellName elementName = existingList.get(idx).name(); cf.addColumn(params.makeTombstone(elementName)); } }
public CFRowAdder(ColumnFamily cf, Composite prefix, long timestamp) { this.cf = cf; this.prefix = prefix; this.timestamp = timestamp; this.ldt = (int) (System.currentTimeMillis() / 1000); // If a CQL3 table, add the row marker if (cf.metadata().isCQL3Table() && !prefix.isStatic()) cf.addColumn(new BufferCell(cf.getComparator().rowMarker(prefix), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp)); }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to remove items from a frozen set"; Term.Terminal value = t.bind(params.options); if (value == null) return; // This can be either a set or a single element Set<ByteBuffer> toDiscard = value instanceof Sets.Value ? ((Sets.Value)value).elements : Collections.singleton(value.get(params.options)); for (ByteBuffer bb : toDiscard) { cf.addColumn(params.makeTombstone(cf.getComparator().create(prefix, column, bb))); } } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { CellName cname = cf.getComparator().create(prefix, column); ByteBuffer value = t.bindAndGet(params.options); cf.addColumn(value == null ? params.makeTombstone(cname) : params.makeColumn(cname, value)); } }
protected void addColumn(Cell cell) throws IOException { if (columnFamily.metadata().isSuper()) { if (currentSuperColumn == null) throw new IllegalStateException("Trying to add a cell to a super column family, but no super cell has been started."); cell = cell.withUpdatedName(columnFamily.getComparator().makeCellName(currentSuperColumn, cell.name().toByteBuffer())); } columnFamily.addColumn(cell); }
private static void addColumn(ColumnFamilyStore table, ColumnFamily cleanColumnFamily, ColumnDefinition columnDefinition, Composite prefix, ByteBuffer metaColumnValue) { if (!columnDefinition.type.asCQL3Type().isCollection()) { CellNameType cellNameType = table.getComparator(); CellName cellName = cellNameType.create(prefix, columnDefinition); Cell scoreColumn = new BufferCell(cellName, metaColumnValue); cleanColumnFamily.addColumn(scoreColumn); } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { ByteBuffer bytes = t.bindAndGet(params.options); if (bytes == null) throw new InvalidRequestException("Invalid null value for counter increment"); long increment = ByteBufferUtil.toLong(bytes); CellName cname = cf.getComparator().create(prefix, column); cf.addColumn(params.makeCounter(cname, increment)); } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete a single key in a frozen map"; Term.Terminal key = t.bind(params.options); if (key == null) throw new InvalidRequestException("Invalid null map key"); CellName cellName = cf.getComparator().create(prefix, column, key.get(params.options)); cf.addColumn(params.makeTombstone(cellName)); } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { CellName cname = cf.getComparator().create(prefix, column); if (column.type.isMultiCell()) cf.addAtom(params.makeRangeTombstone(cname.slice())); else cf.addColumn(params.makeTombstone(cname)); } };
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { ByteBuffer bytes = t.bindAndGet(params.options); if (bytes == null) throw new InvalidRequestException("Invalid null value for counter increment"); long increment = ByteBufferUtil.toLong(bytes); if (increment == Long.MIN_VALUE) throw new InvalidRequestException("The negation of " + increment + " overflows supported counter precision (signed 8 bytes integer)"); CellName cname = cf.getComparator().create(prefix, column); cf.addColumn(params.makeCounter(cname, -increment)); } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { assert column.type.isMultiCell() : "Attempted to delete a single element in a frozen set"; Term.Terminal elt = t.bind(params.options); if (elt == null) throw new InvalidRequestException("Invalid null set element"); CellName cellName = cf.getComparator().create(prefix, column, elt.get(params.options)); cf.addColumn(params.makeTombstone(cellName)); } }
public static void setIndexBuilt(String keyspaceName, String indexName) { ColumnFamily cf = ArrayBackedSortedColumns.factory.create(Keyspace.SYSTEM_KS, INDEX_CF); cf.addColumn(new BufferCell(cf.getComparator().makeCellName(indexName), ByteBufferUtil.EMPTY_BYTE_BUFFER, FBUtilities.timestampMicros())); new Mutation(Keyspace.SYSTEM_KS, ByteBufferUtil.bytes(keyspaceName), cf).apply(); forceBlockingFlush(INDEX_CF); }