本文整理汇总了Java中org.apache.cassandra.db.filter.QueryFilter.getSliceFilter方法的典型用法代码示例。如果您正苦于以下问题:Java QueryFilter.getSliceFilter方法的具体用法?Java QueryFilter.getSliceFilter怎么用?Java QueryFilter.getSliceFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.filter.QueryFilter
的用法示例。
在下文中一共展示了QueryFilter.getSliceFilter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentLocalCounterId
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
/**
* Read the current local node id from the system keyspace or null if no
* such node id is recorded.
*/
public static CounterId getCurrentLocalCounterId()
{
Keyspace keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
// Get the last CounterId (since CounterId are timeuuid is thus ordered from the older to the newer one)
QueryFilter filter = QueryFilter.getSliceFilter(decorate(ALL_LOCAL_NODE_ID_KEY),
COUNTER_ID_CF,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
true,
1,
System.currentTimeMillis());
ColumnFamily cf = keyspace.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
if (cf != null && cf.getColumnCount() != 0)
return CounterId.wrap(cf.iterator().next().name());
else
return null;
}
示例2: getCurrentLocalCounterId
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
/**
* Read the current local node id from the system table or null if no
* such node id is recorded.
*/
public static CounterId getCurrentLocalCounterId()
{
Table table = Table.open(Table.SYSTEM_KS);
// Get the last CounterId (since CounterId are timeuuid is thus ordered from the older to the newer one)
QueryFilter filter = QueryFilter.getSliceFilter(decorate(ALL_LOCAL_NODE_ID_KEY),
new QueryPath(COUNTER_ID_CF),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
true,
1);
ColumnFamily cf = table.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
if (cf != null && cf.getColumnCount() != 0)
return CounterId.wrap(cf.iterator().next().name());
else
return null;
}
示例3: getCurrentLocalCounterId
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
/**
* Read the current local node id from the system keyspace or null if no
* such node id is recorded.
*/
public static CounterId getCurrentLocalCounterId()
{
Keyspace keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
// Get the last CounterId (since CounterId are timeuuid is thus ordered from the older to the newer one)
QueryFilter filter = QueryFilter.getSliceFilter(decorate(ALL_LOCAL_NODE_ID_KEY),
COUNTER_ID_CF,
Composites.EMPTY,
Composites.EMPTY,
true,
1,
System.currentTimeMillis());
ColumnFamily cf = keyspace.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
if (cf != null && cf.getColumnCount() != 0)
return CounterId.wrap(cf.iterator().next().name().toByteBuffer());
else
return null;
}
示例4: getCurrentLocalCounterId
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
/**
* Read the current local node id from the system keyspace or null if no
* such node id is recorded.
*/
public static CounterId getCurrentLocalCounterId()
{
Keyspace keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
// Get the last CounterId (since CounterId are timeuuid is thus ordered from the older to the newer one)
QueryFilter filter = QueryFilter.getSliceFilter(decorate(ALL_LOCAL_NODE_ID_KEY),
COUNTER_ID_CF,
Composites.EMPTY,
Composites.EMPTY,
true,
1,
System.currentTimeMillis());
ColumnFamily cf = keyspace.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
if (cf != null && cf.hasColumns())
return CounterId.wrap(cf.iterator().next().name().toByteBuffer());
else
return null;
}
示例5: testEmptyRow
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
@Test
public void testEmptyRow() throws Exception
{
Keyspace keyspace = Keyspace.open("Keyspace1");
final ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard2");
Mutation rm;
rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.delete("Standard2", System.currentTimeMillis());
rm.apply();
Runnable r = new WrappedRunnable()
{
public void runMayThrow() throws IOException
{
QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), "Standard2", Composites.EMPTY, Composites.EMPTY, false, 1, System.currentTimeMillis());
ColumnFamily cf = store.getColumnFamily(sliceFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
QueryFilter namesFilter = Util.namesQueryFilter(store, Util.dk("key1"), "a");
cf = store.getColumnFamily(namesFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
}
};
KeyspaceTest.reTest(store, r);
}
示例6: testEmptyRow
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
@Test
public void testEmptyRow() throws Exception
{
Keyspace keyspace = Keyspace.open(KEYSPACE1);
final ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARD2);
Mutation rm;
rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("key1"));
rm.delete(CF_STANDARD2, System.currentTimeMillis());
rm.applyUnsafe();
Runnable r = new WrappedRunnable()
{
public void runMayThrow() throws IOException
{
QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), CF_STANDARD2, Composites.EMPTY, Composites.EMPTY, false, 1, System.currentTimeMillis());
ColumnFamily cf = store.getColumnFamily(sliceFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
QueryFilter namesFilter = Util.namesQueryFilter(store, Util.dk("key1"), "a");
cf = store.getColumnFamily(namesFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
}
};
KeyspaceTest.reTest(store, r);
}
示例7: localStorageQuery
import org.apache.cassandra.db.filter.QueryFilter; //导入方法依赖的package包/类
private ColumnFamily localStorageQuery(String target, String dataTag){
Table table = Table.open(Metadata.MetaData_KS);
QueryFilter filter = QueryFilter.getSliceFilter(
StorageService.getPartitioner().decorateKey(ByteBufferUtil.bytes(target)),
new QueryPath(Metadata.MetadataRegistry_CF),
Column.decomposeName(dataTag, "admin_tag"),
Column.decomposeName(dataTag, "admin_tag"),
false,
Integer.MAX_VALUE);
return table.getColumnFamilyStore(Metadata.MetadataRegistry_CF).getColumnFamily(filter);
}