本文整理汇总了Java中org.apache.cassandra.db.filter.QueryFilter类的典型用法代码示例。如果您正苦于以下问题:Java QueryFilter类的具体用法?Java QueryFilter怎么用?Java QueryFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryFilter类属于org.apache.cassandra.db.filter包,在下文中一共展示了QueryFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public Future<Pair<CounterCacheKey, ClockAndCount>> deserialize(DataInputStream in, final ColumnFamilyStore cfs) throws IOException
{
final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
final CellName cellName = cfs.metadata.comparator.cellFromByteBuffer(ByteBufferUtil.readWithLength(in));
return StageManager.getStage(Stage.READ).submit(new Callable<Pair<CounterCacheKey, ClockAndCount>>()
{
public Pair<CounterCacheKey, ClockAndCount> call() throws Exception
{
DecoratedKey key = cfs.partitioner.decorateKey(partitionKey);
QueryFilter filter = QueryFilter.getNamesFilter(key,
cfs.metadata.cfName,
FBUtilities.singleton(cellName, cfs.metadata.comparator),
Long.MIN_VALUE);
ColumnFamily cf = cfs.getTopLevelColumns(filter, Integer.MIN_VALUE);
if (cf == null)
return null;
Cell cell = cf.getColumn(cellName);
if (cell == null || !cell.isLive(Long.MIN_VALUE))
return null;
ClockAndCount clockAndCount = CounterContext.instance().getLocalClockAndCount(cell.value());
return Pair.create(CounterCacheKey.create(cfs.metadata.cfId, partitionKey, cellName), clockAndCount);
}
});
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:CacheService.java
示例2: testRemoveSubColumn
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
@Test
public void testRemoveSubColumn()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new Mutation("Keyspace1", dk.getKey());
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.apply();
store.forceBlockingFlush();
CellName cname = CellNames.compositeDense(ByteBufferUtil.bytes("SC1"), getBytes(1L));
// remove
rm = new Mutation("Keyspace1", dk.getKey());
rm.delete("Super1", cname, 1);
rm.apply();
ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, "Super1", System.currentTimeMillis()));
assertFalse(retrieved.getColumn(cname).isLive());
assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:RemoveSubCellTest.java
示例3: testGetColumnWithWrongBF
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
@Test
public void testGetColumnWithWrongBF()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
cfs.truncateBlocking();
List<Mutation> rms = new LinkedList<>();
Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.add("Standard1", cellname("Column2"), ByteBufferUtil.bytes("asdf"), 0);
rms.add(rm);
Util.writeColumnFamily(rms);
List<SSTableReader> ssTables = keyspace.getAllSSTables();
assertEquals(1, ssTables.size());
ssTables.get(0).forceFilterFailures();
ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key2"), "Standard1", System.currentTimeMillis()));
assertNull(cf);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:21,代码来源:ColumnFamilyStoreTest.java
示例4: testDuplicateCells
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
@Test
public void testDuplicateCells() throws WriteTimeoutException
{
ColumnFamilyStore cfs = Keyspace.open(KS).getColumnFamilyStore(CF1);
cfs.truncateBlocking();
ColumnFamily cells = ArrayBackedSortedColumns.factory.create(cfs.metadata);
cells.addCounter(cellname(1), 1L);
cells.addCounter(cellname(1), 2L);
cells.addCounter(cellname(1), 3L);
cells.addCounter(cellname(1), 4L);
new CounterMutation(new Mutation(KS, bytes(1), cells), ConsistencyLevel.ONE).apply();
ColumnFamily current = cfs.getColumnFamily(QueryFilter.getIdentityFilter(dk(bytes(1)), CF1, System.currentTimeMillis()));
ByteBuffer context = current.getColumn(cellname(1)).value();
assertEquals(10L, CounterContext.instance().total(context));
assertEquals(ClockAndCount.create(1L, 10L), CounterContext.instance().getLocalClockAndCount(context));
assertEquals(ClockAndCount.create(1L, 10L), cfs.getCachedCounter(bytes(1), cellname(1)));
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:CounterMutationTest.java
示例5: 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;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:23,代码来源:SystemKeyspace.java
示例6: getOldLocalCounterIds
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public static List<CounterId.CounterIdRecord> getOldLocalCounterIds()
{
List<CounterId.CounterIdRecord> l = new ArrayList<CounterId.CounterIdRecord>();
Keyspace keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
QueryFilter filter = QueryFilter.getIdentityFilter(decorate(ALL_LOCAL_NODE_ID_KEY), COUNTER_ID_CF, System.currentTimeMillis());
ColumnFamily cf = keyspace.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
CounterId previous = null;
for (Column c : cf)
{
if (previous != null)
l.add(new CounterId.CounterIdRecord(previous, c.timestamp()));
// this will ignore the last column on purpose since it is the
// current local node id
previous = CounterId.wrap(c.name());
}
return l;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:SystemKeyspace.java
示例7: getFromTable
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
private Column getFromTable(Keyspace keyspace, String cfName, String keyName, String columnName)
{
ColumnFamily cf;
ColumnFamilyStore cfStore = keyspace.getColumnFamilyStore(cfName);
if (cfStore == null)
{
return null;
}
cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(Util.dk(keyName),
cfName,
ByteBufferUtil.bytes(columnName),
System.currentTimeMillis()));
if (cf == null)
{
return null;
}
return cf.getColumn(ByteBufferUtil.bytes(columnName));
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:RecoveryManagerTruncateTest.java
示例8: getTopLevelColumns
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public ColumnFamily getTopLevelColumns(QueryFilter filter, int gcBefore)
{
Tracing.trace("Executing single-partition query on {}", name);
CollationController controller = new CollationController(this, filter, gcBefore);
ColumnFamily columns;
/* @daidong The read order, used to track accesses to off-heap memtable storage */
try (OpOrder.Group op = readOrdering.start())
{
//@daidong There are three different MemtablePool instances. HeapPool.needToCopyOnHeap = false;
//@daidong NativePool.needToCopyOnHeap = true; SlabPool is not so sure, based on the construction paramter.
/*
if (filter.filter instanceof NamesQueryFilter && this.metadata.getDefaultValidator() != CounterColumnType.instance)
logger.info("@daidong debug: " + "collectTimeOrderedData");
else
//@daidong To me, most time, we hit this path.
logger.info("@daidong debug: " + "collectAllData");
*/
columns = controller.getTopLevelColumns(Memtable.MEMORY_POOL.needToCopyOnHeap());
}
metric.updateSSTableIterated(controller.getSstablesIterated());
return columns;
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:24,代码来源:ColumnFamilyStore.java
示例9: deserialize
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public Future<Pair<CounterCacheKey, ClockAndCount>> deserialize(DataInputStream in, final ColumnFamilyStore cfs) throws IOException
{
final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
final CellName cellName = cfs.metadata.comparator.cellFromByteBuffer(ByteBufferUtil.readWithLength(in));
return StageManager.getStage(Stage.READ).submit(new Callable<Pair<CounterCacheKey, ClockAndCount>>()
{
public Pair<CounterCacheKey, ClockAndCount> call() throws Exception
{
DecoratedKey key = cfs.partitioner.decorateKey(partitionKey);
QueryFilter filter = QueryFilter.getNamesFilter(key,
cfs.metadata.cfName,
FBUtilities.singleton(cellName, cfs.metadata.comparator),
Long.MIN_VALUE);
ColumnFamily cf = cfs.getTopLevelColumns(filter, Integer.MIN_VALUE);
if (cf == null)
return null;
Cell cell = cf.getColumn(cellName);
if (cell == null || cell.isMarkedForDelete(Long.MIN_VALUE))
return null;
ClockAndCount clockAndCount = CounterContext.instance().getLocalClockAndCount(cell.value());
return Pair.create(CounterCacheKey.create(cfs.metadata.cfId, partitionKey, cellName), clockAndCount);
}
});
}
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:25,代码来源:CacheService.java
示例10: getOldLocalCounterIds
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public static List<CounterId.CounterIdRecord> getOldLocalCounterIds()
{
List<CounterId.CounterIdRecord> l = new ArrayList<CounterId.CounterIdRecord>();
Keyspace keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
QueryFilter filter = QueryFilter.getIdentityFilter(decorate(ALL_LOCAL_NODE_ID_KEY), COUNTER_ID_CF, System.currentTimeMillis());
ColumnFamily cf = keyspace.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
CounterId previous = null;
for (Cell c : cf)
{
if (previous != null)
l.add(new CounterId.CounterIdRecord(previous, c.timestamp()));
// this will ignore the last column on purpose since it is the
// current local node id
previous = CounterId.wrap(c.name().toByteBuffer());
}
return l;
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:21,代码来源:SystemKeyspace.java
示例11: testRemoveSubColumn
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
@Test
public void testRemoveSubColumn()
{
Keyspace keyspace = Keyspace.open(KEYSPACE1);
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new Mutation(KEYSPACE1, dk.getKey());
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.applyUnsafe();
store.forceBlockingFlush();
CellName cname = CellNames.compositeDense(ByteBufferUtil.bytes("SC1"), getBytes(1L));
// remove
rm = new Mutation(KEYSPACE1, dk.getKey());
rm.delete("Super1", cname, 1);
rm.applyUnsafe();
ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, "Super1", System.currentTimeMillis()));
assertFalse(retrieved.getColumn(cname).isLive());
assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:25,代码来源:RemoveSubCellTest.java
示例12: getOldLocalCounterIds
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public static List<CounterId.CounterIdRecord> getOldLocalCounterIds()
{
List<CounterId.CounterIdRecord> l = new ArrayList<CounterId.CounterIdRecord>();
Table table = Table.open(Table.SYSTEM_KS);
QueryFilter filter = QueryFilter.getIdentityFilter(decorate(ALL_LOCAL_NODE_ID_KEY), new QueryPath(COUNTER_ID_CF));
ColumnFamily cf = table.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
CounterId previous = null;
for (IColumn c : cf)
{
if (previous != null)
l.add(new CounterId.CounterIdRecord(previous, c.timestamp()));
// this will ignore the last column on purpose since it is the
// current local node id
previous = CounterId.wrap(c.name());
}
return l;
}
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:21,代码来源:SystemTable.java
示例13: testDuplicateCells
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
@Test
public void testDuplicateCells() throws WriteTimeoutException
{
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF1);
cfs.truncateBlocking();
ColumnFamily cells = ArrayBackedSortedColumns.factory.create(cfs.metadata);
cells.addCounter(cellname(1), 1L);
cells.addCounter(cellname(1), 2L);
cells.addCounter(cellname(1), 3L);
cells.addCounter(cellname(1), 4L);
new CounterMutation(new Mutation(KEYSPACE1, bytes(1), cells), ConsistencyLevel.ONE).apply();
ColumnFamily current = cfs.getColumnFamily(QueryFilter.getIdentityFilter(dk(bytes(1)), CF1, System.currentTimeMillis()));
ByteBuffer context = current.getColumn(cellname(1)).value();
assertEquals(10L, CounterContext.instance().total(context));
assertEquals(ClockAndCount.create(1L, 10L), CounterContext.instance().getLocalClockAndCount(context));
assertEquals(ClockAndCount.create(1L, 10L), cfs.getCachedCounter(bytes(1), cellname(1)));
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:20,代码来源:CounterMutationTest.java
示例14: getFromTable
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
private IColumn getFromTable(Table table, String cfName, String keyName, String columnName)
{
ColumnFamily cf;
ColumnFamilyStore cfStore = table.getColumnFamilyStore(cfName);
if (cfStore == null)
{
return null;
}
cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(
Util.dk(keyName), new QueryPath(cfName), ByteBufferUtil.bytes(columnName)));
if (cf == null)
{
return null;
}
return cf.getColumn(ByteBufferUtil.bytes(columnName));
}
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:17,代码来源:RecoveryManagerTruncateTest.java
示例15: reduceNameFilter
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
/**
* remove columns from @param filter where we already have data in @param returnCF newer than @param sstableTimestamp
*/
private void reduceNameFilter(QueryFilter filter, ColumnFamily returnCF, long sstableTimestamp)
{
AbstractColumnContainer container = filter.path.superColumnName == null
? returnCF
: (SuperColumn) returnCF.getColumn(filter.path.superColumnName);
if (container == null)
return;
for (Iterator<ByteBuffer> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); )
{
ByteBuffer filterColumn = iterator.next();
IColumn column = container.getColumn(filterColumn);
if (column != null && column.timestamp() > sstableTimestamp)
iterator.remove();
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:CollationController.java
示例16: 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;
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:23,代码来源:SystemKeyspace.java
示例17: 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;
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:22,代码来源:SystemTable.java
示例18: getColumnFamily
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public ColumnFamily getColumnFamily(DecoratedKey key,
Composite start,
Composite finish,
boolean reversed,
int limit,
long timestamp)
{
return getColumnFamily(QueryFilter.getSliceFilter(key, name, start, finish, reversed, limit, timestamp));
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:ColumnFamilyStore.java
示例19: filterColumnFamily
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
/**
* Filter a cached row, which will not be modified by the filter, but may be modified by throwing out
* tombstones that are no longer relevant.
* The returned column family won't be thread safe.
*/
ColumnFamily filterColumnFamily(ColumnFamily cached, QueryFilter filter)
{
if (cached == null)
return null;
ColumnFamily cf = cached.cloneMeShallow(ArrayBackedSortedColumns.factory, filter.filter.isReversed());
int gcBefore = gcBefore(filter.timestamp);
filter.collateOnDiskAtom(cf, filter.getIterator(cached), gcBefore);
return removeDeletedCF(cf, gcBefore);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:ColumnFamilyStore.java
示例20: getTopLevelColumns
import org.apache.cassandra.db.filter.QueryFilter; //导入依赖的package包/类
public ColumnFamily getTopLevelColumns(QueryFilter filter, int gcBefore)
{
Tracing.trace("Executing single-partition query on {}", name);
CollationController controller = new CollationController(this, filter, gcBefore);
ColumnFamily columns;
try (OpOrder.Group op = readOrdering.start())
{
columns = controller.getTopLevelColumns(Memtable.MEMORY_POOL.needToCopyOnHeap());
}
if (columns != null)
metric.samplers.get(Sampler.READS).addSample(filter.key.getKey(), filter.key.hashCode(), 1);
metric.updateSSTableIterated(controller.getSstablesIterated());
return columns;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:ColumnFamilyStore.java
注:本文中的org.apache.cassandra.db.filter.QueryFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论