/** * Delete all values in the given row key * * @param id row key to delete */ public void delete(MDSKey id) { try { table.delete(id.getKey(), COLUMN); } catch (Exception e) { throw Throwables.propagate(e); } }
public Set<SECOND> getSecond(Set<MDSKey> mdsKeys) { Set<SECOND> secondSet = Sets.newHashSetWithExpectedSize(mdsKeys.size()); for (MDSKey mdsKey : mdsKeys) { MDSKey.Splitter splitter = mdsKey.split(); splitter.skipString(); // prefix keyMaker1.skipKey(splitter); secondSet.add(this.keyMaker2.getElement(splitter)); } return secondSet; } }
public MDSKey build() { return new MDSKey(key); } }
/** * Delete all values in the given row key * * @param id row key to delete */ public void delete(MDSKey id) { try { table.delete(id.getKey(), COLUMN); } catch (Exception e) { throw Throwables.propagate(e); } }
public Set<SECOND> getSecond(Set<MDSKey> mdsKeys) { Set<SECOND> secondSet = Sets.newHashSetWithExpectedSize(mdsKeys.size()); for (MDSKey mdsKey : mdsKeys) { MDSKey.Splitter splitter = mdsKey.split(); splitter.skipString(); // prefix keyMaker1.skipKey(splitter); secondSet.add(this.keyMaker2.getElement(splitter)); } return secondSet; } }
public MDSKey build() { return new MDSKey(key); } }
private ImmutablePair<byte[], byte[]> getFuzzyKeyFor(MDSKey key) { byte[] keyBytes = key.getKey(); // byte array is automatically initialized to 0, which implies fixed match in fuzzy info // the row key after targetId doesn't need to be a match. // Workaround for HBASE-15676, need to have at least one 1 in the fuzzy filter byte[] infoBytes = new byte[keyBytes.length + 1]; infoBytes[infoBytes.length - 1] = 1; // the key array size and mask array size has to be equal so increase the size by 1 return new ImmutablePair<>(Bytes.concat(keyBytes, new byte[1]), infoBytes); }
public Collection<DatasetTypeMeta> getTypes(NamespaceId namespaceId) { List<DatasetTypeMeta> types = Lists.newArrayList(); for (Map.Entry<MDSKey, DatasetModuleId> entry : getTypesMapping(namespaceId).entrySet()) { MDSKey.Splitter splitter = entry.getKey().split(); // first part is TYPE_TO_MODULE_PREFIX splitter.skipString(); // second part is namespace splitter.skipString(); // third part is the type name, which is what we expect String typeName = splitter.getString(); types.add(getTypeMeta(namespaceId, typeName, entry.getValue())); } return types; }
void deleteStartUpTimeRow() { delete(new MDSKey(RUN_COUNT_FIRST_UPGRADE_TIME)); }
@Override public void remove(ApplicationId applicationId) { byte[] startRowKey = new MDSKey.Builder().add(applicationId.getNamespace()) .add(applicationId.getApplication()).build().getKey(); byte[] stopRowKey = new MDSKey(Bytes.stopKeyForPrefix(startRowKey)).getKey(); try { table.deleteRange(startRowKey, stopRowKey, null, null); } catch (IOException e) { String message = String.format("Error while removing preview data for application '%s'.", applicationId); throw new RuntimeException(message, e); } }
static MetadataEntity extractMetadataEntityFromKey(byte[] rowKey) { MDSKey.Splitter keySplitter = new MDSKey(rowKey).split(); // The rowkey is // [rowPrefix][targetType][targetId][key] for value rows and // [rowPrefix][targetType][targetId][key][index] for value index rows // so skip the first keySplitter.skipBytes(); return getTargetIdIdFromKey(keySplitter); }
private ImmutablePair<byte[], byte[]> getFuzzyKeyFor(MDSKey key) { byte[] keyBytes = key.getKey(); // byte array is automatically initialized to 0, which implies fixed match in fuzzy info // the row key after targetId doesn't need to be a match. // Workaround for HBASE-15676, need to have at least one 1 in the fuzzy filter byte[] infoBytes = new byte[keyBytes.length + 1]; infoBytes[infoBytes.length - 1] = 1; // the key array size and mask array size has to be equal so increase the size by 1 return new ImmutablePair<>(Bytes.concat(keyBytes, new byte[1]), infoBytes); }
public Collection<DatasetTypeMeta> getTypes(NamespaceId namespaceId) { List<DatasetTypeMeta> types = Lists.newArrayList(); for (Map.Entry<MDSKey, DatasetModuleId> entry : getTypesMapping(namespaceId).entrySet()) { MDSKey.Splitter splitter = entry.getKey().split(); // first part is TYPE_TO_MODULE_PREFIX splitter.skipString(); // second part is namespace splitter.skipString(); // third part is the type name, which is what we expect String typeName = splitter.getString(); types.add(getTypeMeta(namespaceId, typeName, entry.getValue())); } return types; }
void deleteStartUpTimeRow() { delete(new MDSKey(RUN_COUNT_FIRST_UPGRADE_TIME)); }
@Override public void remove(ApplicationId applicationId) { byte[] startRowKey = new MDSKey.Builder().add(applicationId.getNamespace()) .add(applicationId.getApplication()).build().getKey(); byte[] stopRowKey = new MDSKey(Bytes.stopKeyForPrefix(startRowKey)).getKey(); try { table.deleteRange(startRowKey, stopRowKey, null, null); } catch (IOException e) { String message = String.format("Error while removing preview data for application '%s'.", applicationId); throw new RuntimeException(message, e); } }
static MetadataEntity extractMetadataEntityFromKey(byte[] rowKey) { MDSKey.Splitter keySplitter = new MDSKey(rowKey).split(); // The rowkey is // [rowPrefix][targetType][targetId][key] for value rows and // [rowPrefix][targetType][targetId][key][index] for value index rows // so skip the first keySplitter.skipBytes(); return getTargetIdIdFromKey(keySplitter); }