本文整理汇总了Java中me.prettyprint.hector.api.mutation.Mutator.delete方法的典型用法代码示例。如果您正苦于以下问题:Java Mutator.delete方法的具体用法?Java Mutator.delete怎么用?Java Mutator.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.prettyprint.hector.api.mutation.Mutator
的用法示例。
在下文中一共展示了Mutator.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteColumns
import me.prettyprint.hector.api.mutation.Mutator; //导入方法依赖的package包/类
@Override
public void deleteColumns(K rowKey, N... columnNames) {
if (columnNames.length == 0) {
return;
}
Mutator<K> mutator = createMutator();
if (columnNames.length == 1) {
mutator.delete(rowKey, getColumnFamily(), columnNames[0], getColumnNameSerializer());
} else {
for (N columnName : columnNames) {
mutator.addDeletion(rowKey, getColumnFamily(), columnName, getColumnNameSerializer());
}
mutator.execute();
}
// we used to translate hector exceptions into spring exceptions here, but spring dependency was removed
}
示例2: insert
import me.prettyprint.hector.api.mutation.Mutator; //导入方法依赖的package包/类
@Override
public <R, T> void insert(Keyspace keyspace, String columnFamily, DataOperationsProfile dataOperationsProfile, RowSerializer<R, T> rowSerializer, R rowKey, T topKey, Object value, int ttl) {
Serializer<R> rowKeySerializer = rowSerializer.getRowKeySerializer();
ByteBuffer serializedRowKey = rowKeySerializer.toByteBuffer(rowKey);
if (serializedRowKey == null) {
return;
}
Mutator<ByteBuffer> mutator = HFactory.createMutator(keyspace, ByteBufferSerializer.get());
StopWatch monitor = monitoring.start(HerculesMonitoringGroup.HERCULES_DD, "Insert " + columnFamily);
int serializedDataSize = 0;
try {
if (value == null) {
mutator.delete(serializedRowKey, columnFamily, topKey, rowSerializer.getTopKeySerializer());
} else {
Serializer serializer = rowSerializer.hasValueSerializer(topKey) ? rowSerializer.getValueSerializer(topKey) : getSerializerForObject(value);
ByteBuffer serializedValue = serializer.toByteBuffer(value);
serializedDataSize += serializedValue.remaining();
HColumn<T, ByteBuffer> column;
if (ttl > 0) {
column = HFactory.createColumn(topKey, serializedValue, ttl, rowSerializer.getTopKeySerializer(), ByteBufferSerializer.get());
} else {
column = HFactory.createColumn(topKey, serializedValue, rowSerializer.getTopKeySerializer(), ByteBufferSerializer.get());
}
mutator.insert(serializedRowKey, columnFamily, column);
}
} finally {
long time = monitor.stop();
if (dataOperationsProfile != null) {
dataOperationsProfile.ms += time;
dataOperationsProfile.bytes += serializedDataSize;
dataOperationsProfile.dbQueries++;
}
}
}
示例3: deleteColumn
import me.prettyprint.hector.api.mutation.Mutator; //导入方法依赖的package包/类
public static<K> void deleteColumn(Mutator<K> mutator, K key, String columnFamily, ByteBuffer columnName){
mutator.delete(key, columnFamily, columnName, ByteBufferSerializer.get());
}
示例4: removeHeader
import me.prettyprint.hector.api.mutation.Mutator; //导入方法依赖的package包/类
public String removeHeader(String key) {
Mutator<byte[]> mutator = createMutator(keyspace, bytesSerializer);
mutator.delete(key.getBytes(), HEADER, INFO, stringSerializer);
// perform the insert
mutator.execute();
return "{\"result_code\":200}\n";
}
示例5: deleteSingleColumnData
import me.prettyprint.hector.api.mutation.Mutator; //导入方法依赖的package包/类
private void deleteSingleColumnData() {
Mutator<String> mutator = HFactory.createMutator(keyspace, stringSerializer);
mutator.delete("jsmith", COLUMN_FAMILY_NAME_1, "first", stringSerializer);
mutator.addDeletion("jsmith", COLUMN_FAMILY_NAME_1, "middle", stringSerializer)
.addDeletion("jsmith", COLUMN_FAMILY_NAME_1, "last", stringSerializer).execute();
}