2023-09-16 16:14:47 +00:00
|
|
|
package nu.marginalia.crawlspec;
|
|
|
|
|
2023-10-14 10:07:40 +00:00
|
|
|
import nu.marginalia.storage.model.FileStorage;
|
|
|
|
import nu.marginalia.storage.model.FileStorageType;
|
2023-09-16 16:14:47 +00:00
|
|
|
|
|
|
|
import java.nio.file.Path;
|
2023-10-14 10:07:40 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2023-09-16 16:14:47 +00:00
|
|
|
|
|
|
|
public class CrawlSpecFileNames {
|
|
|
|
public static Path resolve(Path base) {
|
|
|
|
return base.resolve("crawl-spec.parquet");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Path resolve(FileStorage storage) {
|
|
|
|
if (storage.type() != FileStorageType.CRAWL_SPEC)
|
|
|
|
throw new IllegalArgumentException("Provided file storage is of unexpected type " +
|
|
|
|
storage.type() + ", expected CRAWL_SPEC");
|
|
|
|
|
|
|
|
return resolve(storage.asPath());
|
|
|
|
}
|
2023-10-14 10:07:40 +00:00
|
|
|
|
|
|
|
public static List<Path> resolve(List<FileStorage> storageList) {
|
|
|
|
List<Path> ret = new ArrayList<>();
|
|
|
|
for (var storage : storageList) {
|
|
|
|
if (storage.type() != FileStorageType.CRAWL_SPEC)
|
|
|
|
throw new IllegalArgumentException("Provided file storage is of unexpected type " +
|
|
|
|
storage.type() + ", expected CRAWL_SPEC");
|
|
|
|
ret.add(resolve(storage));
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2023-09-16 16:14:47 +00:00
|
|
|
}
|