58 lines
2.0 KiB
Java
58 lines
2.0 KiB
Java
package eu.dnetlib.data.mdstore;
|
|
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import eu.dnetlib.data.mdstore.model.MDStoreVersion;
|
|
import eu.dnetlib.errors.MDStoreManagerException;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/mdstores")
|
|
@Tag(name = "Metadata Stores")
|
|
public class MDStoreApiController extends AbstractMDStoreController {
|
|
|
|
@Operation(summary = "Return all the mdstore identifiers")
|
|
@GetMapping("/ids")
|
|
public List<String> findIdentifiers() {
|
|
return service.listMdStoreIDs();
|
|
}
|
|
|
|
@Operation(summary = "Increase the read count of the current mdstore")
|
|
@GetMapping("/mdstore/{mdId}/startReading")
|
|
public MDStoreVersion startReading(@PathVariable final String mdId) throws MDStoreManagerException {
|
|
return service.startReading(mdId);
|
|
}
|
|
|
|
@Operation(summary = "Fix the inconsistencies on HDFS")
|
|
@GetMapping("/hdfs/inconsistencies")
|
|
public Set<String> fixHdfsInconsistencies(
|
|
@RequestParam(required = false, defaultValue = "false") final boolean forceDelete)
|
|
throws MDStoreManagerException {
|
|
|
|
return service.fixHdfsInconsistencies(forceDelete);
|
|
}
|
|
|
|
@Operation(summary = "Delete expired versions")
|
|
@DeleteMapping("/versions/expired")
|
|
public StatusResponse deleteExpiredVersions() {
|
|
new Thread(service::deleteExpiredVersions).start();
|
|
return StatusResponse.DELETING;
|
|
}
|
|
|
|
@Operation(summary = "list the file inside the path of a mdstore version")
|
|
@GetMapping("/version/{versionId}/parquet/files")
|
|
public Set<String> listVersionFiles(@PathVariable final String versionId) throws MDStoreManagerException {
|
|
return service.listVersionFiles(versionId);
|
|
}
|
|
|
|
}
|