Search in sources :

Example 1 with ValueVersion

use of oracle.kv.ValueVersion in project YCSB by brianfrankcooper.

the class NoSqlDbClient method read.

@Override
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) {
    Key kvKey = createKey(table, key);
    SortedMap<Key, ValueVersion> kvResult;
    try {
        kvResult = store.multiGet(kvKey, null, null);
    } catch (FaultException e) {
        System.err.println(e);
        return Status.ERROR;
    }
    for (Map.Entry<Key, ValueVersion> entry : kvResult.entrySet()) {
        /* If fields is null, read all fields */
        String field = getFieldFromKey(entry.getKey());
        if (fields != null && !fields.contains(field)) {
            continue;
        }
        result.put(field, new ByteArrayByteIterator(entry.getValue().getValue().getValue()));
    }
    return Status.OK;
}
Also used : FaultException(oracle.kv.FaultException) ByteArrayByteIterator(com.yahoo.ycsb.ByteArrayByteIterator) ValueVersion(oracle.kv.ValueVersion) HashMap(java.util.HashMap) Map(java.util.Map) SortedMap(java.util.SortedMap) Key(oracle.kv.Key)

Aggregations

ByteArrayByteIterator (com.yahoo.ycsb.ByteArrayByteIterator)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 FaultException (oracle.kv.FaultException)1 Key (oracle.kv.Key)1 ValueVersion (oracle.kv.ValueVersion)1