use of com.thinkaurelius.titan.diskstorage.TemporaryStorageException in project titan by thinkaurelius.
the class HBaseKeyColumnValueStore method getHelper.
private List<List<Entry>> getHelper(List<StaticBuffer> keys, Filter getFilter) throws StorageException {
List<Get> requests = new ArrayList<Get>(keys.size());
{
for (StaticBuffer key : keys) {
requests.add(new Get(key.as(StaticBuffer.ARRAY_FACTORY)).addFamily(columnFamilyBytes).setFilter(getFilter));
}
}
List<List<Entry>> results = new ArrayList<List<Entry>>();
try {
HTableInterface table = null;
Result[] r = null;
try {
table = pool.getTable(tableName);
r = table.get(requests);
} finally {
IOUtils.closeQuietly(table);
}
if (r == null)
return Collections.emptyList();
for (Result result : r) {
List<Entry> entries = new ArrayList<Entry>(result.size());
Map<byte[], byte[]> fmap = result.getFamilyMap(columnFamilyBytes);
if (null != fmap) {
for (Map.Entry<byte[], byte[]> ent : fmap.entrySet()) {
entries.add(StaticBufferEntry.of(new StaticArrayBuffer(ent.getKey()), new StaticArrayBuffer(ent.getValue())));
}
}
results.add(entries);
}
return results;
} catch (IOException e) {
throw new TemporaryStorageException(e);
}
}
use of com.thinkaurelius.titan.diskstorage.TemporaryStorageException in project titan by thinkaurelius.
the class HBaseKeyColumnValueStore method containsKey.
@Override
public boolean containsKey(StaticBuffer key, StoreTransaction txh) throws StorageException {
byte[] keyBytes = key.as(StaticBuffer.ARRAY_FACTORY);
Get g = new Get(keyBytes).addFamily(columnFamilyBytes);
try {
HTableInterface table = null;
try {
table = pool.getTable(tableName);
return table.exists(g);
} finally {
IOUtils.closeQuietly(table);
}
} catch (IOException e) {
throw new TemporaryStorageException(e);
}
}
Aggregations