本文整理汇总了Java中org.apache.cassandra.db.RowMutation类的典型用法代码示例。如果您正苦于以下问题:Java RowMutation类的具体用法?Java RowMutation怎么用?Java RowMutation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowMutation类属于org.apache.cassandra.db包,在下文中一共展示了RowMutation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mutationForKey
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
RowMutation rm = new RowMutation(keyspace, key);
QueryProcessor.validateKeyAlias(metadata, keyName);
if (columns.size() < 1)
{
// No columns, delete the row
rm.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
else
{
// Delete specific columns
for (Term column : columns)
{
ByteBuffer columnName = column.getByteBuffer(metadata.comparator, variables);
validateColumnName(columnName);
rm.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
}
return rm;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:DeleteStatement.java
示例2: markDirty
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
/**
* mark all of the column families we're modifying as dirty at this position
*/
private void markDirty(RowMutation rowMutation, ReplayPosition repPos)
{
for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
{
// check for null cfm in case a cl write goes through after the cf is
// defined but before a new segment is created.
CFMetaData cfm = Schema.instance.getCFMetaData(columnFamily.id());
if (cfm == null)
{
logger.error("Attempted to write commit log entry for unrecognized column family: {}", columnFamily.id());
}
else
{
markCFDirty(cfm.cfId, repPos.position);
}
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:CommitLogSegment.java
示例3: run
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
public void run()
{
long totalSize = RowMutation.serializer.serializedSize(rowMutation, MessagingService.current_version) + CommitLogSegment.ENTRY_OVERHEAD_SIZE;
if (totalSize > DatabaseDescriptor.getCommitLogSegmentSize())
{
logger.warn("Skipping commitlog append of extremely large mutation ({} bytes)", totalSize);
return;
}
if (!activeSegment.hasCapacityFor(totalSize))
{
CommitLogSegment oldSegment = activeSegment;
activateNextSegment();
// Now we can run the user defined command just before switching to the new commit log.
// (Do this here instead of in the recycle call so we can get a head start on the archive.)
archiver.maybeArchive(oldSegment.getPath(), oldSegment.getName());
}
try
{
activeSegment.write(rowMutation);
}
catch (IOException e)
{
throw new FSWriteError(e, activeSegment.getPath());
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:27,代码来源:CommitLog.java
示例4: execute
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
public Collection<RowMutation> execute(Collection<? extends IMutation> updates) throws InvalidRequestException
{
boolean hasCounters = false;
Collection<RowMutation> tmutations = null;
for (IMutation mutation : updates)
{
for (ColumnFamily cf : mutation.getColumnFamilies())
{
List<RowMutation> intermediate = execute(mutation.key(), cf);
if (intermediate == null)
continue;
validate(intermediate);
if (tmutations == null)
tmutations = intermediate;
else
tmutations.addAll(intermediate);
}
if (mutation instanceof CounterMutation)
hasCounters = true;
}
if (tmutations != null && hasCounters)
throw new InvalidRequestException("Counter mutations and trigger mutations cannot be applied together atomically.");
return tmutations;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:TriggerExecutor.java
示例5: testCompaction
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private void testCompaction(String columnFamilyName, int insertsPerTable) throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore(columnFamilyName);
Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
for (int j = 0; j < insertsPerTable; j++) {
DecoratedKey key = Util.dk(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key.key);
rm.add(columnFamilyName, ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
inserted.add(key);
store.forceBlockingFlush();
assertEquals(inserted.size(), Util.getRangeSlice(store).size());
}
CompactionManager.instance.performMaximal(store);
assertEquals(1, store.getSSTables().size());
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:OneCompactionTest.java
示例6: mutate
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private void mutate(List<RowMutation> cmds, org.apache.cassandra.db.ConsistencyLevel clvl) throws BackendException {
try {
schedule(DatabaseDescriptor.getRpcTimeout());
try {
if (atomicBatch) {
StorageProxy.mutateAtomically(cmds, clvl);
} else {
StorageProxy.mutate(cmds, clvl);
}
} catch (RequestExecutionException e) {
throw new TemporaryBackendException(e);
} finally {
release();
}
} catch (TimeoutException ex) {
log.debug("Cassandra TimeoutException", ex);
throw new TemporaryBackendException(ex);
}
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:20,代码来源:CassandraEmbeddedStoreManager.java
示例7: markDirty
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
/**
* mark all of the column families we're modifying as dirty at this position
*/
private void markDirty(RowMutation rowMutation, ReplayPosition repPos)
{
for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
{
// check for null cfm in case a cl write goes through after the cf is
// defined but before a new segment is created.
CFMetaData cfm = Schema.instance.getCFMetaData(columnFamily.id());
if (cfm == null)
{
logger.error("Attempted to write commit log entry for unrecognized column family: " + columnFamily.id());
}
else
{
markCFDirty(cfm.cfId, repPos.position);
}
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:21,代码来源:CommitLogSegment.java
示例8: trace
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
public static void trace(final ByteBuffer sessionIdBytes, final String message, final int elapsed)
{
final ByteBuffer eventId = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
final String threadName = Thread.currentThread().getName();
StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
{
public void runMayThrow() throws Exception
{
CFMetaData cfMeta = CFMetaData.TraceEventsCf;
ColumnFamily cf = ColumnFamily.create(cfMeta);
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source")), FBUtilities.getBroadcastAddress());
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("thread")), threadName);
if (elapsed >= 0)
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source_elapsed")), elapsed);
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("activity")), message);
RowMutation mutation = new RowMutation(Tracing.TRACE_KS, sessionIdBytes);
mutation.add(cf);
StorageProxy.mutate(Arrays.asList(mutation), ConsistencyLevel.ANY);
}
});
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:23,代码来源:TraceState.java
示例9: testCompaction
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private void testCompaction(String columnFamilyName, int insertsPerTable) throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore store = table.getColumnFamilyStore(columnFamilyName);
Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
for (int j = 0; j < insertsPerTable; j++) {
DecoratedKey key = Util.dk(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key.key);
rm.add(new QueryPath(columnFamilyName, null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
inserted.add(key);
store.forceBlockingFlush();
assertEquals(inserted.size(), Util.getRangeSlice(store).size());
}
CompactionManager.instance.performMaximal(store);
assertEquals(1, store.getSSTables().size());
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:21,代码来源:OneCompactionTest.java
示例10: makeSSTable
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private static SSTableReader makeSSTable()
{
Table t = Table.open("Keyspace1");
for (int i = 0; i < 100; i++)
{
RowMutation rm = new RowMutation(t.name, ByteBufferUtil.bytes(Long.toString(System.nanoTime())));
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("cola")), ByteBufferUtil.bytes("value"), 0);
rm.apply();
}
try
{
t.getColumnFamilyStore("Standard1").forceBlockingFlush();
return t.getColumnFamilyStore("Standard1").getSSTables().iterator().next();
}
catch (Exception any)
{
throw new RuntimeException(any);
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:SerializationsTest.java
示例11: trace
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
public static void trace(final ByteBuffer sessionIdBytes, final String message, final int elapsed)
{
final ByteBuffer eventId = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
final String threadName = Thread.currentThread().getName();
StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
{
public void runMayThrow()
{
CFMetaData cfMeta = CFMetaData.TraceEventsCf;
ColumnFamily cf = ColumnFamily.create(cfMeta);
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source")), FBUtilities.getBroadcastAddress());
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("thread")), threadName);
if (elapsed >= 0)
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source_elapsed")), elapsed);
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("activity")), message);
Tracing.mutateWithCatch(new RowMutation(Tracing.TRACE_KS, sessionIdBytes, cf));
}
});
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:21,代码来源:TraceState.java
示例12: mutationForKey
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
/** {@inheritDoc} */
public void mutationForKey(RowMutation mutation, String keyspace, Long timestamp) throws InvalidRequestException
{
CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);
QueryProcessor.validateKeyAlias(metadata, keyName);
AbstractType comparator = metadata.getComparatorFor(null);
if (columns.size() < 1) // No columns, delete the row
mutation.delete(new QueryPath(columnFamily), (timestamp == null) ? getTimestamp() : timestamp);
else // Delete specific columns
{
for (Term column : columns)
{
ByteBuffer columnName = column.getByteBuffer(comparator);
validateColumnName(columnName);
mutation.delete(new QueryPath(columnFamily, null, columnName), (timestamp == null) ? getTimestamp() : timestamp);
}
}
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:DeleteStatement.java
示例13: testCompaction
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private void testCompaction(String columnFamilyName, int insertsPerTable) throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore store = table.getColumnFamilyStore(columnFamilyName);
Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
for (int j = 0; j < insertsPerTable; j++) {
DecoratedKey key = Util.dk(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key.key);
rm.add(new QueryPath(columnFamilyName, null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
inserted.add(key);
store.forceBlockingFlush();
assertEquals(inserted.size(), Util.getRangeSlice(store).size());
}
CompactionManager.instance.performMajor(store);
assertEquals(1, store.getSSTables().size());
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:OneCompactionTest.java
示例14: makeSSTable
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
private static SSTable makeSSTable()
{
Table t = Table.open("Keyspace1");
for (int i = 0; i < 100; i++)
{
RowMutation rm = new RowMutation(t.name, ByteBufferUtil.bytes(Long.toString(System.nanoTime())));
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("cola")), ByteBufferUtil.bytes("value"), 0);
try
{
rm.apply();
}
catch (IOException ex)
{
throw new RuntimeException(ex);
}
}
try
{
t.getColumnFamilyStore("Standard1").forceBlockingFlush();
return t.getColumnFamilyStore("Standard1").getSSTables().iterator().next();
}
catch (Exception any)
{
throw new RuntimeException(any);
}
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:27,代码来源:SerializationsTest.java
示例15: testOneRow
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testOneRow() throws IOException, ExecutionException, InterruptedException, NoSuchAlgorithmException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
assertBytes(cfs, Integer.MAX_VALUE);
assertDigest(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:18,代码来源:LazilyCompactedRowTest.java
示例16: testOneRowTwoColumns
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testOneRowTwoColumns() throws IOException, ExecutionException, InterruptedException, NoSuchAlgorithmException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
assertBytes(cfs, Integer.MAX_VALUE);
assertDigest(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:19,代码来源:LazilyCompactedRowTest.java
示例17: testTwoRows
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testTwoRows() throws IOException, ExecutionException, InterruptedException, NoSuchAlgorithmException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
rm.apply();
cfs.forceBlockingFlush();
assertBytes(cfs, Integer.MAX_VALUE);
assertDigest(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:LazilyCompactedRowTest.java
示例18: testTwoRowsTwoColumns
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testTwoRowsTwoColumns() throws IOException, ExecutionException, InterruptedException, NoSuchAlgorithmException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
rm.apply();
cfs.forceBlockingFlush();
assertBytes(cfs, Integer.MAX_VALUE);
assertDigest(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:22,代码来源:LazilyCompactedRowTest.java
示例19: testManyRows
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testManyRows() throws IOException, ExecutionException, InterruptedException, NoSuchAlgorithmException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace1");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
final int ROWS_PER_SSTABLE = 10;
for (int j = 0; j < (DatabaseDescriptor.getIndexInterval() * 3) / ROWS_PER_SSTABLE; j++) {
for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(i % 2));
RowMutation rm = new RowMutation("Keyspace1", key);
rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(String.valueOf(i / 2))), ByteBufferUtil.EMPTY_BYTE_BUFFER, j * ROWS_PER_SSTABLE + i);
rm.apply();
}
cfs.forceBlockingFlush();
}
assertBytes(cfs, Integer.MAX_VALUE);
assertDigest(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:23,代码来源:LazilyCompactedRowTest.java
示例20: testTwoRowSuperColumn
import org.apache.cassandra.db.RowMutation; //导入依赖的package包/类
@Test
public void testTwoRowSuperColumn() throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
Table table = Table.open("Keyspace4");
ColumnFamilyStore cfs = table.getColumnFamilyStore("Super5");
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace4", key);
ByteBuffer scKey = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress())));
rm.add(new QueryPath("Super5", scKey , ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
rm.apply();
cfs.forceBlockingFlush();
assertBytes(cfs, Integer.MAX_VALUE);
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:LazilyCompactedRowTest.java
注:本文中的org.apache.cassandra.db.RowMutation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论