本文整理汇总了Java中org.apache.cassandra.db.ColumnFamily.addColumn方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnFamily.addColumn方法的具体用法?Java ColumnFamily.addColumn怎么用?Java ColumnFamily.addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.ColumnFamily
的用法示例。
在下文中一共展示了ColumnFamily.addColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testResolveDeleted
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveDeleted()
{
// one CF with columns timestamped before a delete in another cf
ColumnFamily cf1 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.addColumn(column("one", "A", 0));
ColumnFamily cf2 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.delete(new DeletionInfo(1L, (int) (System.currentTimeMillis() / 1000)));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2), System.currentTimeMillis());
// no columns in the cf
assertColumns(resolved);
assertTrue(resolved.isMarkedForDelete());
assertEquals(1, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
示例2: execute
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, ColumnNameBuilder prefix, UpdateParameters params) throws InvalidRequestException
{
Term.Terminal value = t.bind(params.variables);
if (value == null)
return;
// This can be either a set or a single element
Set<ByteBuffer> toDiscard = value instanceof Constants.Value
? Collections.singleton(((Constants.Value)value).bytes)
: ((Sets.Value)value).elements;
ColumnNameBuilder column = prefix.add(columnName.key);
for (ByteBuffer bb : toDiscard)
{
ByteBuffer cellName = column.copy().add(bb).build();
cf.addColumn(params.makeTombstone(cellName));
}
}
示例3: testResolveDeleted
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveDeleted()
{
// one CF with columns timestamped before a delete in another cf
ColumnFamily cf1 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.addColumn(column("one", "A", 0));
ColumnFamily cf2 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.delete(new DeletionInfo(1L, (int) (System.currentTimeMillis() / 1000)));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2), System.currentTimeMillis());
// no columns in the cf
assertColumns(resolved);
assertTrue(resolved.isMarkedForDelete());
assertEquals(1, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
示例4: doAppend
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
static void doAppend(Term t, ColumnFamily cf, Composite prefix, ColumnDefinition column, UpdateParameters params) throws InvalidRequestException
{
Term.Terminal value = t.bind(params.options);
Lists.Value listValue = (Lists.Value)value;
if (column.type.isMultiCell())
{
// If we append null, do nothing. Note that for Setter, we've
// already removed the previous value so we're good here too
if (value == null)
return;
List<ByteBuffer> toAdd = listValue.elements;
for (int i = 0; i < toAdd.size(); i++)
{
ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
cf.addColumn(params.makeColumn(cf.getComparator().create(prefix, column, uuid), toAdd.get(i)));
}
}
else
{
// for frozen lists, we're overwriting the whole cell value
CellName name = cf.getComparator().create(prefix, column);
if (value == null)
cf.addAtom(params.makeTombstone(name));
else
cf.addColumn(params.makeColumn(name, listValue.getWithProtocolVersion(Server.CURRENT_VERSION)));
}
}
示例5: createCF
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
private ColumnFamily createCF()
{
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(keyspaceName, standardCFName);
cf.addColumn(column("vijay", "try", 1));
cf.addColumn(column("to", "be_nice", 1));
return cf;
}
示例6: testResolveMultipleDeleted
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveMultipleDeleted()
{
// deletes and columns with interleaved timestamp, with out of order return sequence
ColumnFamily cf1 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
// these columns created after the previous deletion
ColumnFamily cf2 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.addColumn(column("one", "A", 1));
cf2.addColumn(column("two", "A", 1));
//this column created after the next delete
ColumnFamily cf3 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf3.addColumn(column("two", "B", 3));
ColumnFamily cf4 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf4.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2, cf3, cf4), System.currentTimeMillis());
// will have deleted marker and one column
assertColumns(resolved, "two");
assertColumn(resolved, "two", "B", 3);
assertTrue(resolved.isMarkedForDelete());
assertEquals(2, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
示例7: testResolveSupersetDisjoint
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveSupersetDisjoint()
{
ColumnFamily cf1 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.addColumn(column("c1", "v1", 0));
ColumnFamily cf2 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.addColumn(column("c2", "v2", 1));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2), System.currentTimeMillis());
assertColumns(resolved, "c1", "c2");
assertColumns(ColumnFamily.diff(cf1, resolved), "c2");
assertColumns(ColumnFamily.diff(cf2, resolved), "c1");
}
示例8: testResolveSupersetNullOne
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveSupersetNullOne()
{
ColumnFamily cf2 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.addColumn(column("c2", "v2", 1));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(null, cf2), System.currentTimeMillis());
assertColumns(resolved, "c2");
assertColumns(ColumnFamily.diff(null, resolved), "c2");
assertNull(ColumnFamily.diff(cf2, resolved));
}
示例9: testResolveMultipleDeleted
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveMultipleDeleted()
{
// deletes and columns with interleaved timestamp, with out of order return sequence
ColumnFamily cf1 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
// these columns created after the previous deletion
ColumnFamily cf2 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.addColumn(column("one", "A", 1));
cf2.addColumn(column("two", "A", 1));
//this column created after the next delete
ColumnFamily cf3 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf3.addColumn(column("two", "B", 3));
ColumnFamily cf4 = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf4.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2, cf3, cf4), System.currentTimeMillis());
// will have deleted marker and one column
assertColumns(resolved, "two");
assertColumn(resolved, "two", "B", 3);
assertTrue(resolved.isMarkedForDelete());
assertEquals(2, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
示例10: createCF
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
private ColumnFamily createCF()
{
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(keyspaceName, cfName);
cf.addColumn(column("vijay", "great", 1));
cf.addColumn(column("awesome", "vijay", 1));
return cf;
}
示例11: augment
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update)
{
ColumnFamily extraUpdate = update.cloneMeShallow(ArrayBackedSortedColumns.factory, false);
extraUpdate.addColumn(new BufferCell(update.metadata().comparator.makeCellName(bytes("v2")), bytes(999)));
int newKey = toInt(key) + 1000;
return Collections.singletonList(new Mutation(ksName, bytes(newKey), extraUpdate));
}
示例12: execute
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
public void execute(ByteBuffer rowKey, ColumnFamily cf, ColumnNameBuilder prefix, UpdateParameters params) throws InvalidRequestException
{
ColumnNameBuilder column = prefix.add(columnName.key);
if (isCollection)
cf.addAtom(params.makeRangeTombstone(column.build(), column.buildAsEndOfRange()));
else
cf.addColumn(params.makeTombstone(column.build()));
}
示例13: testResolveSupersetNullTwo
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveSupersetNullTwo()
{
ColumnFamily cf1 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.addColumn(column("c1", "v1", 0));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, null), System.currentTimeMillis());
assertColumns(resolved, "c1");
assertNull(ColumnFamily.diff(cf1, resolved));
assertColumns(ColumnFamily.diff(null, resolved), "c1");
}
示例14: createCF
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
private ColumnFamily createCF()
{
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(keyspaceName, cfName);
cf.addColumn(column("vijay", "great", 1));
cf.addColumn(column("awesome", "vijay", 1));
return cf;
}
示例15: testResolveSupersetNewer
import org.apache.cassandra.db.ColumnFamily; //导入方法依赖的package包/类
@Test
public void testResolveSupersetNewer()
{
ColumnFamily cf1 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf1.addColumn(column("c1", "v1", 0));
ColumnFamily cf2 = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf2.addColumn(column("c1", "v2", 1));
ColumnFamily resolved = RowDataResolver.resolveSuperset(Arrays.asList(cf1, cf2), System.currentTimeMillis());
assertColumns(resolved, "c1");
assertColumns(ColumnFamily.diff(cf1, resolved), "c1");
assertNull(ColumnFamily.diff(cf2, resolved));
}