public IOError deepCopy() { return new IOError(this); }
public IOError deepCopy() { return new IOError(this); }
public IOError deepCopy() { return new IOError(this); }
public IOError deepCopy() { return new IOError(this); }
public IOError deepCopy() { return new IOError(this); }
public IOError deepCopy() { return new IOError(this); }
@Override public void majorCompact(ByteBuffer tableNameOrRegionName) throws IOError { try{ admin.majorCompact(getBytes(tableNameOrRegionName)); } catch (InterruptedException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public boolean isTableEnabled(ByteBuffer tableName) throws IOError { try { return HTable.isTableEnabled(this.conf, getBytes(tableName)); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void enableTable(ByteBuffer tableName) throws IOError { try{ admin.enableTable(getBytes(tableName)); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public List<ByteBuffer> getTableNames() throws IOError { try { HTableDescriptor[] tables = this.admin.listTables(); ArrayList<ByteBuffer> list = new ArrayList<ByteBuffer>(tables.length); for (int i = 0; i < tables.length; i++) { list.add(ByteBuffer.wrap(tables[i].getName())); } return list; } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void disableTable(ByteBuffer tableName) throws IOError{ try{ admin.disableTable(getBytes(tableName)); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void deleteAllRowTs( ByteBuffer tableName, ByteBuffer row, long timestamp, Map<ByteBuffer, ByteBuffer> attributes) throws IOError { try { HTable table = getTable(tableName); Delete delete = new Delete(getBytes(row), timestamp, null); addAttributes(delete, attributes); table.delete(delete); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void deleteTable(ByteBuffer in_tableName) throws IOError { byte [] tableName = getBytes(in_tableName); if (LOG.isDebugEnabled()) { LOG.debug("deleteTable: table=" + Bytes.toString(tableName)); } try { if (!admin.tableExists(tableName)) { throw new IOException("table does not exist"); } admin.deleteTable(tableName); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
protected long atomicIncrement(ByteBuffer tableName, ByteBuffer row, byte [] family, byte [] qualifier, long amount) throws IOError, IllegalArgument, TException { HTable table; try { table = getTable(tableName); return table.incrementColumnValue( getBytes(row), family, qualifier, amount); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public Map<ByteBuffer, ColumnDescriptor> getColumnDescriptors( ByteBuffer tableName) throws IOError, TException { try { TreeMap<ByteBuffer, ColumnDescriptor> columns = new TreeMap<ByteBuffer, ColumnDescriptor>(); HTable table = getTable(tableName); HTableDescriptor desc = table.getTableDescriptor(); for (HColumnDescriptor e : desc.getFamilies()) { ColumnDescriptor col = ThriftUtilities.colDescFromHbase(e); columns.put(col.name, col); } return columns; } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public List<TCell> getRowOrBefore(ByteBuffer tableName, ByteBuffer row, ByteBuffer family) throws IOError { try { HTable table = getTable(getBytes(tableName)); Result result = table.getRowOrBefore(getBytes(row), getBytes(family)); return ThriftUtilities.cellFromHBase(result.raw()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row, byte[] family, byte[] qualifier, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError { try { HTable table = getTable(tableName); Get get = new Get(getBytes(row)); addAttributes(get, attributes); get.addColumn(family, qualifier); get.setMaxVersions(numVersions); Result result = table.get(get); return ThriftUtilities.cellFromHBase(result.raw()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void increment(TIncrement tincrement) throws IOError, TException { if (tincrement.getRow().length == 0 || tincrement.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't increment"); } if (conf.getBoolean(COALESCE_INC_KEY, false)) { this.coalescer.queueIncrement(tincrement); return; } try { HTable table = getTable(tincrement.getTable()); Increment inc = ThriftUtilities.incrementFromThrift(tincrement); table.increment(inc); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
protected List<TCell> getVerTs(ByteBuffer tableName, ByteBuffer row, byte [] family, byte [] qualifier, long timestamp, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError { try { HTable table = getTable(tableName); Get get = new Get(getBytes(row)); addAttributes(get, attributes); get.addColumn(family, qualifier); get.setTimeRange(Long.MIN_VALUE, timestamp); get.setMaxVersions(numVersions); Result result = table.get(get); return ThriftUtilities.cellFromHBase(result.raw()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }