public MDSKey build() { return new MDSKey(key); } }
public MDSKey build() { return new MDSKey(key); } }
void deleteStartUpTimeRow() { delete(new MDSKey(RUN_COUNT_FIRST_UPGRADE_TIME)); }
/** * Write the start time for the upgrade if it does not exist. */ void writeUpgradeStartTimeIfNotExist() { MDSKey mdsKey = new MDSKey(RUN_COUNT_FIRST_UPGRADE_TIME); if (get(mdsKey, Long.TYPE) == null) { LOG.info("Start to upgrade the run count"); write(mdsKey, TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())); } }
/** * Write the start time for the upgrade if it does not exist. */ void writeUpgradeStartTimeIfNotExist() { MDSKey mdsKey = new MDSKey(RUN_COUNT_FIRST_UPGRADE_TIME); if (get(mdsKey, Long.TYPE) == null) { LOG.info("Start to upgrade the run count"); write(mdsKey, TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())); } }
private boolean matchesEndpoint(byte[] column, EndPoint endPoint) { // RAW_OPERATION_MARKER key is not written as MDSKey with byte length encoding so don't try to create an object // out of it if (Arrays.equals(column, RAW_OPERATION_MARKER)) { return false; } MDSKey.Splitter keySplitter = new MDSKey(column).split(); return Arrays.equals(OUTGOING_DIRECTION_MARKER, keySplitter.getBytes()) && keySplitter.getString().equals(endPoint.getNamespace()) && keySplitter.getString().equals(endPoint.getName()); }
private boolean matchesEndpoint(byte[] column, EndPoint endPoint) { // RAW_OPERATION_MARKER key is not written as MDSKey with byte length encoding so don't try to create an object // out of it if (Arrays.equals(column, RAW_OPERATION_MARKER)) { return false; } MDSKey.Splitter keySplitter = new MDSKey(column).split(); return Arrays.equals(OUTGOING_DIRECTION_MARKER, keySplitter.getBytes()) && keySplitter.getString().equals(endPoint.getNamespace()) && keySplitter.getString().equals(endPoint.getName()); }
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); }
static String extractTargetType(byte[] rowKey) { MDSKey.Splitter keySplitter = new MDSKey(rowKey).split(); // skip rowPrefix keySplitter.skipBytes(); // return targetType return keySplitter.getString(); }
static String getTargetType(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 keySplitter.getBytes(); return keySplitter.getString(); }
static String extractTargetType(byte[] rowKey) { MDSKey.Splitter keySplitter = new MDSKey(rowKey).split(); // skip rowPrefix keySplitter.skipBytes(); // return targetType return keySplitter.getString(); }
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); }
static NamespacedEntityId getNamespacedIdFromKey(String type, 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 two. keySplitter.skipBytes(); keySplitter.skipString(); return EntityIdKeyHelper.getTargetIdIdFromKey(keySplitter, type); }
static MDSKey getMDSScanStopKey(MetadataEntity metadataEntity) { MDSKey.Builder builder = getKeyPart(metadataEntity); return new MDSKey(Bytes.stopKeyForPrefix(builder.build().getKey())); }
static MDSKey getMDSScanStopKey(MetadataEntity metadataEntity) { MDSKey.Builder builder = getKeyPart(metadataEntity); return new MDSKey(Bytes.stopKeyForPrefix(builder.build().getKey())); }
private String extractFieldName(byte[] columnKey) { MDSKey.Splitter keySplitter = new MDSKey(columnKey).split(); // The key is // [outgoing prefix (o)][EndPoint:Namespace][EndPoint:Name][fieldName] // skip prefix keySplitter.skipBytes(); // Skip namespace keySplitter.skipString(); // skip dataset name keySplitter.skipString(); return keySplitter.getString(); } }
private String extractFieldName(byte[] columnKey) { MDSKey.Splitter keySplitter = new MDSKey(columnKey).split(); // The key is // [outgoing prefix (o)][EndPoint:Namespace][EndPoint:Name][fieldName] // skip prefix keySplitter.skipBytes(); // Skip namespace keySplitter.skipString(); // skip dataset name keySplitter.skipString(); return keySplitter.getString(); } }
@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); } }
@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); } }
/** * Deserialize and return {@link ProgramRunId} from rowKey */ private ProgramRunId getProgramRunIdFromRowKey(byte[] rowKey) { MDSKey.Splitter splitter = new MDSKey(rowKey).split(); // get namespace String namespace = splitter.getString(); // skip timestamp splitter.skipLong(); // now read the programRunId fields, create and return ProgramRunId return new ProgramRunId(namespace, splitter.getString(), ProgramType.valueOf(splitter.getString()), splitter.getString(), splitter.getString()); } }