public CheckpointInfo restoreCheckpoint(ProcessKey processKey, UUID checkpointId) {
        try (TemporaryPath checkpointArchive = IOUtils.tempFile("checkpoint", ".zip")) {
            String checkpointName = export(processKey, checkpointId, checkpointArchive.path());
            if (checkpointName == null) {
                return null;
            }
            try (TemporaryPath extractedDir = IOUtils.tempDir("unzipped-checkpoint")) {
                IOUtils.unzip(checkpointArchive.path(), extractedDir.path());
                // TODO: only for v1 runtime
                String eventName = readCheckpointEventName(extractedDir.path());
                stateManager.tx(tx -> {
                    stateManager.deleteDirectory(tx, processKey, Constants.Files.CONCORD_SYSTEM_DIR_NAME);
                    stateManager.deleteDirectory(tx, processKey, Constants.Files.JOB_ATTACHMENTS_DIR_NAME);
                    stateManager.importPath(tx, processKey, null, extractedDir.path(), (p, attrs) -> true);
                });
                Map<String, Object> out = OutVariablesUtils.read(extractedDir.path().resolve(Constants.Files.JOB_ATTACHMENTS_DIR_NAME));
                if (out.isEmpty()) {
                    queueDao.removeMeta(processKey, "out");
                } else {
                    queueDao.updateMeta(processKey, Collections.singletonMap("out", out));
                }
                return CheckpointInfo.of(checkpointName, eventName);
            }
        } catch (Exception e) {
            throw new RuntimeException("Restore checkpoint '" + checkpointId + "' error", e);
        }
    }
public CheckpointInfo restoreCheckpoint(ProcessKey processKey, UUID checkpointId) {
        try (TemporaryPath checkpointArchive = IOUtils.tempFile("checkpoint", ".zip")) {
            String checkpointName = export(processKey, checkpointId, checkpointArchive.path());
            if (checkpointName == null) {
                return null;
            }
            try (TemporaryPath extractedDir = IOUtils.tempDir("unzipped-checkpoint")) {
                IOUtils.unzip(checkpointArchive.path(), extractedDir.path());
               
                String eventName = readCheckpointEventName(extractedDir.path());
                stateManager.tx(tx -> {
                    stateManager.deleteDirectory(tx, processKey, Constants.Files.CONCORD_SYSTEM_DIR_NAME);
                    stateManager.deleteDirectory(tx, processKey, Constants.Files.JOB_ATTACHMENTS_DIR_NAME);
                    stateManager.importPath(tx, processKey, null, extractedDir.path(), (p, attrs) -> true);
                });
                Map<String, Object> out = OutVariablesUtils.read(extractedDir.path().resolve(Constants.Files.JOB_ATTACHMENTS_DIR_NAME));
                if (out.isEmpty()) {
                    queueDao.removeMeta(processKey, "out");
                } else {
                    queueDao.updateMeta(processKey, Collections.singletonMap("out", out));
                }
                return CheckpointInfo.of(checkpointName, eventName);
            }
        } catch (Exception e) {
            throw new RuntimeException("Restore checkpoint '" + checkpointId + "' error", e);
        }
    }
public checkpointinfo restorecheckpoint(processkey processkey, uuid checkpointid) { try (temporarypath checkpointarchive = ioutils.tempfile("checkpoint", ".zip")) { string checkpointname = export(processkey, checkpointid, checkpointarchive.path()); if (checkpointname == null) { return null; } try (temporarypath extracteddir = ioutils.tempdir("unzipped-checkpoint")) { ioutils.unzip(checkpointarchive.path(), extracteddir.path()); string eventname = readcheckpointeventname(extracteddir.path()); statemanager.tx(tx -> { statemanager.deletedirectory(tx, processkey, constants.files.concord_system_dir_name); statemanager.deletedirectory(tx, processkey, constants.files.job_attachments_dir_name); statemanager.importpath(tx, processkey, null, extracteddir.path(), (p, attrs) -> true); }); map<string, object> out = outvariablesutils.read(extracteddir.path().resolve(constants.files.job_attachments_dir_name)); if (out.isempty()) { queuedao.removemeta(processkey, "out"); } else { queuedao.updatemeta(processkey, collections.singletonmap("out", out)); } return checkpointinfo.of(checkpointname, eventname); } } catch (exception e) { throw new runtimeexception("restore checkpoint '" + checkpointid + "' error", e); } }