/** * Set a unique, replicable guid for this work unit. Used for recovering partially successful work units. * @param state {@link State} where guid should be written. * @param guid A byte array guid. */ public static void setWorkUnitGuid(State state, Guid guid) { state.setProp(WORK_UNIT_GUID, guid.toString()); }
@Override public String getStateStoreNameFromDatasetUrn(String datasetUrn) throws IOException { if (!this.sanitizedNameToDatasetURNMap.inverse().containsKey(datasetUrn)) { String guid = Guid.fromStrings(datasetUrn).toString(); this.sanitizedNameToDatasetURNMap.put(guid, datasetUrn); } return this.sanitizedNameToDatasetURNMap.inverse().get(datasetUrn); } }
private static String computeGuid(State state, CopyEntity file) throws IOException { Optional<Guid> stateGuid = CopySource.getWorkUnitGuid(state); if (stateGuid.isPresent()) { return Guid.combine(file.guid(), stateGuid.get()).toString(); } throw new IOException("State does not contain a guid."); } }
throws IOException { for (String datasetUrn : datasetUrns) { String key = Guid.fromStrings(datasetUrn).toString(); if (!this.sanitizedNameToDatasetURNMap.containsKey(key)) { this.sanitizedNameToDatasetURNMap.put(key, datasetUrn);