@Override public HConsistencyLevel getConsistencyLevel(OperationType operationType) { return consistency.get(operationType); }
private ConsistencyLevel getThriftCl(OperationType operationType) { return ThriftConverter.consistencyLevel(consistency.get(operationType)); }
@Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } }));
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public Map<ByteBuffer, List<ColumnOrSuperColumn>> execute(Client cassandra) throws HectorException { try { List<KeySlice> keySlices = cassandra.get_indexed_slices( columnParent, predicate.toThrift(), workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily))); if (keySlices == null || keySlices.isEmpty()) { return new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(0); } LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>> ret = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(keySlices.size()); for (KeySlice keySlice : keySlices) { ret.put(ByteBuffer.wrap(keySlice.getKey()), keySlice.getColumns()); } return ret; } catch (Exception e) { throw exceptionsTranslator.translate(e); } } });
@Override public Column execute(Cassandra.Client cassandra) throws HectorException { try { if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("---------\nColumnFamily multiget: {} slicePredicate: {}", columnFamilyName, activeSlicePredicate.toString()); } rows = cassandra.multiget_slice(keySerializer.toBytesList(_keys), columnParent, activeSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); applyResultStatus(execTime, getCassandraHost()); if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("Execution took {} microseconds on host {}\n----------", lastExecutionTime, lastHostUsed); } } catch (Exception e) { throw exceptionsTranslator.translate(e); } hasValues = true; return null; } });
@Override public Column execute(Cassandra.Client cassandra) throws HectorException { try { if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("---------\nColumnFamily: {} slicePredicate: {}", columnFamilyName, activeSlicePredicate.toString()); } K key = _keys.get(0); List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(keySerializer.toByteBuffer(key), columnParent, activeSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); applyResultStatus(execTime, getCassandraHost()); applyToRow(key, cosclist); if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("Execution took {} microseconds on host {}\n----------", lastExecutionTime, lastHostUsed); } } catch (Exception e) { throw exceptionsTranslator.translate(e); } hasValues = true; return null; } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { try { List<K> keyList = new ArrayList<K>(); Iterators.addAll(keyList, keys.iterator()); return cassandra.multiget_slice(keySerializer.toBytesList(keyList), columnParent, (workingSlicePredicate == null ? activeSlicePredicate.setColumnNames(columnValueSerializers.keySet()).toThrift() : workingSlicePredicate.toThrift()), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc; try { List<ByteBuffer> sKeys = keySerializer.toBytesList(keys); cosc = cassandra.multiget_slice(sKeys, workingColumnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public HConsistencyLevel getConsistencyLevel(OperationType operationType) { return consistency.get(operationType); }
@Override public HConsistencyLevel getConsistencyLevel(OperationType operationType) { return consistency.get(operationType); }
private ConsistencyLevel getThriftCl(OperationType operationType) { return ThriftConverter.consistencyLevel(consistency.get(operationType)); }
@Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } }));
@Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } }));
@Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } }));
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { try { List<K> keyList = new ArrayList<K>(); Iterators.addAll(keyList, keys.iterator()); return cassandra.multiget_slice(keySerializer.toBytesList(keyList), columnParent, (workingSlicePredicate == null ? activeSlicePredicate.setColumnNames(columnValueSerializers.keySet()).toThrift() : workingSlicePredicate.toThrift()), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { try { List<K> keyList = new ArrayList<K>(); Iterators.addAll(keyList, keys.iterator()); return cassandra.multiget_slice(keySerializer.toBytesList(keyList), columnParent, (workingSlicePredicate == null ? activeSlicePredicate.setColumnNames(columnValueSerializers.keySet()).toThrift() : workingSlicePredicate.toThrift()), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc; try { List<ByteBuffer> sKeys = keySerializer.toBytesList(keys); cosc = cassandra.multiget_slice(sKeys, workingColumnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc; try { List<ByteBuffer> sKeys = keySerializer.toBytesList(keys); cosc = cassandra.multiget_slice(sKeys, workingColumnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });