当前位置: 首页>>代码示例>>Java>>正文


Java FBUtilities.singleton方法代码示例

本文整理汇总了Java中org.apache.cassandra.utils.FBUtilities.singleton方法的典型用法代码示例。如果您正苦于以下问题:Java FBUtilities.singleton方法的具体用法?Java FBUtilities.singleton怎么用?Java FBUtilities.singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.utils.FBUtilities的用法示例。


在下文中一共展示了FBUtilities.singleton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetColumn

import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@Test
public void testGetColumn()
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("Keyspace1", dk.getKey());
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(keyspace);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:ReadMessageTest.java

示例2: testTruncateWithoutSnapshotNonDurable

import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@Test
public void testTruncateWithoutSnapshotNonDurable()  throws ExecutionException, InterruptedException
{
    CommitLog.instance.resetUnsafe();
    boolean prevAutoSnapshot = DatabaseDescriptor.isAutoSnapshot();
    DatabaseDescriptor.setAutoSnapshot(false);
    Keyspace notDurableKs = Keyspace.open("NoCommitlogSpace");
    Assert.assertFalse(notDurableKs.metadata.durableWrites);
    ColumnFamilyStore cfs = notDurableKs.getColumnFamilyStore("Standard1");
    CellNameType type = notDurableKs.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("NoCommitlogSpace", dk.getKey());
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("NoCommitlogSpace", dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(notDurableKs);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    Assert.assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
    cfs.truncateBlocking();
    DatabaseDescriptor.setAutoSnapshot(prevAutoSnapshot);
    row = command.getRow(notDurableKs);
    Assert.assertEquals(null, row.cf);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:28,代码来源:CommitLogTest.java

示例3: createClustering

import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public NavigableSet<Clustering> createClustering(QueryOptions options)
throws InvalidRequestException
{
    if (appliesOnlyToStaticColumns() && !restrictions.hasClusteringColumnsRestriction())
        return FBUtilities.singleton(CBuilder.STATIC_BUILDER.build(), cfm.comparator);

    return restrictions.getClusteringColumns(options);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:9,代码来源:ModificationStatement.java

示例4: testCassandra6778

import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@Test
public void testCassandra6778() throws CharacterCodingException
{
    String cfname = "StandardInteger1";
    Keyspace keyspace = Keyspace.open("Keyspace1");
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);

    // insert two columns that represent the same integer but have different binary forms (the
    // second one is padded with extra zeros)
    Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
    CellName column1 = cellname(ByteBuffer.wrap(new byte[]{1}));
    rm.add(cfname, column1, ByteBufferUtil.bytes("data1"), 1);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
    CellName column2 = cellname(ByteBuffer.wrap(new byte[]{0, 0, 1}));
    rm.add(cfname, column2, ByteBufferUtil.bytes("data2"), 2);
    rm.apply();
    cfs.forceBlockingFlush();

    // fetch by the first column name; we should get the second version of the column value
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(
        "Keyspace1", ByteBufferUtil.bytes("k1"), cfname, System.currentTimeMillis(),
        new NamesQueryFilter(FBUtilities.singleton(column1, cfs.getComparator())));

    ColumnFamily cf = cmd.getRow(keyspace).cf;
    assertEquals(1, cf.getColumnCount());
    Cell cell = cf.getColumn(column1);
    assertEquals("data2", ByteBufferUtil.string(cell.value()));
    assertEquals(column2, cell.name());

    // fetch by the second column name; we should get the second version of the column value
    cmd = new SliceByNamesReadCommand(
        "Keyspace1", ByteBufferUtil.bytes("k1"), cfname, System.currentTimeMillis(),
        new NamesQueryFilter(FBUtilities.singleton(column2, cfs.getComparator())));

    cf = cmd.getRow(keyspace).cf;
    assertEquals(1, cf.getColumnCount());
    cell = cf.getColumn(column2);
    assertEquals("data2", ByteBufferUtil.string(cell.value()));
    assertEquals(column2, cell.name());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:44,代码来源:ColumnFamilyStoreTest.java

示例5: NamesQueryFilter

import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public NamesQueryFilter(ByteBuffer column)
{
    this(FBUtilities.singleton(column));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:5,代码来源:NamesQueryFilter.java


注:本文中的org.apache.cassandra.utils.FBUtilities.singleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。