/** {@inheritDoc} */ @Override public byte[] getValue(String table, String key) throws IOException { final List<byte[]> values = getValues(table, key, 1); return values.get(0); }
/** {@inheritDoc} */ @Override public void removeAllValues(String table) throws IOException { Set<String> keysToRemove = keySet(table); for (String key : keysToRemove) { removeValues(table, key); } }
/** {@inheritDoc} */ @Override public KeyValueBackup keyValuesToBackup(String table) throws IOException { List<KeyValueBackupEntry> kvBackupEntries = Lists.newArrayList(); final Set<String> keys = keySet(table); for (String key : keys) { NavigableMap<Long, byte[]> versionedValues = getTimedValues(table, key, Integer.MAX_VALUE); for (Long timestamp : versionedValues.descendingKeySet()) { kvBackupEntries.add(KeyValueBackupEntry.newBuilder() .setKey(key) .setValue(ByteBuffer.wrap(versionedValues.get(timestamp))) .setTimestamp(timestamp) .build()); } } KeyValueBackup kvBackup = KeyValueBackup.newBuilder().setKeyValues(kvBackupEntries).build(); return kvBackup; }
/** * Create a connection to a Fiji meta table backed by an HTable within HBase. * * <p>This class takes ownership of the HTable. It will be closed when this instance is * closed.</p> * * @param fijiURI URI of the Fiji instance this meta-table belongs to. * @param htable The HTable to use for storing Fiji meta data. * @param schemaTable The Fiji schema table. * @throws IOException If there is an error. */ private HBaseMetaTable( FijiURI fijiURI, HTableInterface htable, FijiSchemaTable schemaTable) throws IOException { this( fijiURI, htable, new HBaseTableLayoutDatabase(fijiURI, htable, LAYOUT_COLUMN_FAMILY, schemaTable), new HBaseTableKeyValueDatabase(htable, META_COLUMN_FAMILY)); }