本文整理汇总了Java中org.apache.cassandra.db.composites.Composite.size方法的典型用法代码示例。如果您正苦于以下问题:Java Composite.size方法的具体用法?Java Composite.size怎么用?Java Composite.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.composites.Composite
的用法示例。
在下文中一共展示了Composite.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeIndexColumnPrefix
import org.apache.cassandra.db.composites.Composite; //导入方法依赖的package包/类
protected Composite makeIndexColumnPrefix(ByteBuffer rowKey, Composite cellName)
{
CBuilder builder = getIndexComparator().prefixBuilder();
builder.add(rowKey);
for (int i = 0; i < Math.min(columnDef.position(), cellName.size()); i++)
builder.add(cellName.get(i));
// When indexing, cellName is a full name including the collection
// key. When searching, restricted clustering columns are included
// but the collection key is not. In this case, don't try to add an
// element to the builder for it, as it will just end up null and
// error out when retrieving cells from the index cf (CASSANDRA-7525)
if (cellName.size() >= columnDef.position() + 1)
builder.add(cellName.get(columnDef.position() + 1));
return builder.build();
}
示例2: addUpdateForKey
import org.apache.cassandra.db.composites.Composite; //导入方法依赖的package包/类
public void addUpdateForKey(ColumnFamily cf, ByteBuffer key, Composite prefix, UpdateParameters params)
throws InvalidRequestException
{
List<Operation> deletions = getOperations();
if (prefix.size() < cfm.clusteringColumns().size() && !deletions.isEmpty())
{
// In general, we can't delete specific columns if not all clustering columns have been specified.
// However, if we delete only static colums, it's fine since we won't really use the prefix anyway.
for (Operation deletion : deletions)
if (!deletion.column.isStatic())
throw new InvalidRequestException(String.format("Primary key column '%s' must be specified in order to delete column '%s'", getFirstEmptyKey().name, deletion.column.name));
}
if (deletions.isEmpty())
{
// We delete the slice selected by the prefix.
// However, for performance reasons, we distinguish 2 cases:
// - It's a full internal row delete
// - It's a full cell name (i.e it's a dense layout and the prefix is full)
if (prefix.isEmpty())
{
// No columns specified, delete the row
cf.delete(new DeletionInfo(params.timestamp, params.localDeletionTime));
}
else if (cfm.comparator.isDense() && prefix.size() == cfm.clusteringColumns().size())
{
cf.addAtom(params.makeTombstone(cfm.comparator.create(prefix, null)));
}
else
{
cf.addAtom(params.makeRangeTombstone(prefix.slice()));
}
}
else
{
for (Operation op : deletions)
op.execute(key, cf, prefix, params);
}
}