org.apache.cassandra.db.rows.ComplexColumnData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-all Show documentation
Show all versions of cassandra-all Show documentation
The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together Dynamo's fully distributed design and Bigtable's ColumnFamily-based data model.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cassandra.db.rows;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.Objects;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import org.apache.cassandra.db.DeletionPurger;
import org.apache.cassandra.db.DeletionTime;
import org.apache.cassandra.db.Digest;
import org.apache.cassandra.db.LivenessInfo;
import org.apache.cassandra.db.filter.ColumnFilter;
import org.apache.cassandra.db.marshal.ByteType;
import org.apache.cassandra.db.marshal.SetType;
import org.apache.cassandra.schema.ColumnMetadata;
import org.apache.cassandra.schema.DroppedColumn;
import org.apache.cassandra.utils.BiLongAccumulator;
import org.apache.cassandra.utils.LongAccumulator;
import org.apache.cassandra.utils.ObjectSizes;
import org.apache.cassandra.utils.SearchIterator;
import org.apache.cassandra.utils.btree.BTree;
import org.apache.cassandra.utils.memory.Cloner;
/**
* The data for a complex column, that is it's cells and potential complex
* deletion time.
*/
public class ComplexColumnData extends ColumnData implements Iterable>
{
static final Cell[] NO_CELLS = new Cell[0];
private static final long EMPTY_SIZE = ObjectSizes.measure(new ComplexColumnData(ColumnMetadata.regularColumn("",
"",
"",
SetType.getInstance(ByteType.instance,
true)),
NO_CELLS,
DeletionTime.build(0, 0)));
// The cells for 'column' sorted by cell path.
private final Object[] cells;
private final DeletionTime complexDeletion;
ComplexColumnData(ColumnMetadata column, Object[] cells, DeletionTime complexDeletion)
{
super(column);
assert column.isComplex();
assert cells.length > 0 || !complexDeletion.isLive();
this.cells = cells;
this.complexDeletion = complexDeletion;
}
public int cellsCount()
{
return BTree.size(cells);
}
public Cell getCell(CellPath path)
{
return (Cell) BTree. |