use of oracle.kv.Key in project YCSB by brianfrankcooper.
the class NoSqlDbClient method update.
@Override
public Status update(String table, String key, HashMap<String, ByteIterator> values) {
for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
Key kvKey = createKey(table, key, entry.getKey());
Value kvValue = Value.createValue(entry.getValue().toArray());
try {
store.put(kvKey, kvValue);
} catch (FaultException e) {
System.err.println(e);
return Status.ERROR;
}
}
return Status.OK;
}
use of oracle.kv.Key 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;
}
Aggregations