@Override public String toString() { StringBuilder sb = new StringBuilder("ColumnFamily("); sb.append(metadata.cfName); if (isMarkedForDelete()) sb.append(" -").append(deletionInfo()).append("-"); sb.append(" [").append(CellNames.getColumnsString(getComparator(), this)).append("])"); return sb.toString(); }
public boolean isFullyCoveredBy(ColumnFamily cf, long now) { // cf will cover all the requested columns if the range it covers include // all said columns CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); return cf.getComparator().compare(first, columns.first()) <= 0 && cf.getComparator().compare(columns.last(), last) <= 0; }
public int liveCQL3RowCount(long now) { ColumnCounter counter = getComparator().isDense() ? new ColumnCounter(now) : new ColumnCounter.GroupByPrefix(now, getComparator(), metadata.clusteringColumns().size()); return counter.countAll(this).live(); }
public CFRowAdder addListEntry(String cql3ColumnName, Object value) { ColumnDefinition def = getDefinition(cql3ColumnName); assert def.type instanceof ListType; CellName name = cf.getComparator().create(prefix, def, ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes())); return add(name, def, value); }
public CFRowAdder add(String cql3ColumnName, Object value) { ColumnDefinition def = getDefinition(cql3ColumnName); return add(cf.getComparator().create(prefix, def), def, value); }
public long contentSerializedSize(ColumnFamily cf, TypeSizes typeSizes, int version) { long size = cf.getComparator().deletionInfoSerializer().serializedSize(cf.deletionInfo(), typeSizes, version); size += typeSizes.sizeof(cf.getColumnCount()); ColumnSerializer columnSerializer = cf.getComparator().columnSerializer(); for (Cell cell : cf) size += columnSerializer.serializedSize(cell, typeSizes); return size; }
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 { CellName cname = cf.getComparator().create(prefix, column); ByteBuffer value = t.bindAndGet(params.options); cf.addColumn(value == null ? params.makeTombstone(cname) : params.makeColumn(cname, value)); } }
public CFRowAdder addMapEntry(String cql3ColumnName, Object key, Object value) { ColumnDefinition def = getDefinition(cql3ColumnName); assert def.type instanceof MapType; MapType mt = (MapType)def.type; CellName name = cf.getComparator().create(prefix, def, mt.getKeysType().decompose(key)); return add(name, def, value); }
public IDiskAtomFilter readFilter() { return expected == null || expected.isEmpty() ? new SliceQueryFilter(ColumnSlice.ALL_COLUMNS_ARRAY, false, 1) : new NamesQueryFilter(ImmutableSortedSet.copyOf(expected.getComparator(), expected.getColumnNames())); }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { if (column.type.isMultiCell()) { // delete + add CellName name = cf.getComparator().create(prefix, column); cf.addAtom(params.makeTombstoneForOverwrite(name.slice())); } Adder.doAdd(t, cf, prefix, column, params); } }
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 { if (column.type.isMultiCell()) { // delete + put CellName name = cf.getComparator().create(prefix, column); cf.addAtom(params.makeTombstoneForOverwrite(name.slice())); } Putter.doPut(t, cf, prefix, column, params); } }
public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException { if (column.type.isMultiCell()) { // delete + append CellName name = cf.getComparator().create(prefix, column); cf.addAtom(params.makeTombstoneForOverwrite(name.slice())); } Appender.doAppend(t, cf, prefix, column, params); } }
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 { CellName cname = cf.getComparator().create(prefix, column); if (column.type.isMultiCell()) cf.addAtom(params.makeRangeTombstone(cname.slice())); else cf.addColumn(params.makeTombstone(cname)); } };
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; } }
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 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 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); }