use of com.bakdata.conquery.models.worker.Namespace in project conquery by bakdata.
the class AdminDatasetProcessor method addDataset.
/**
* Creates and initializes a new dataset if it does not already exist.
*/
public synchronized Dataset addDataset(Dataset dataset) {
final String name = dataset.getName();
if (datasetRegistry.get(new DatasetId(name)) != null) {
throw new WebApplicationException("Dataset already exists", Response.Status.CONFLICT);
}
NamespaceStorage datasetStorage = new NamespaceStorage(validator, "dataset_" + name);
datasetStorage.openStores(config.getStorage());
datasetStorage.loadData();
datasetStorage.setMetaStorage(storage);
datasetStorage.updateDataset(dataset);
datasetStorage.updateIdMapping(new EntityIdMap());
Namespace ns = new Namespace(datasetStorage, config.isFailOnError(), config.configureObjectMapper(Jackson.copyMapperAndInjectables(Jackson.BINARY_MAPPER)).writerWithView(InternalOnly.class));
datasetRegistry.add(ns);
// for now we just add one worker to every ShardNode
for (ShardNodeInformation node : datasetRegistry.getShardNodes().values()) {
node.send(new AddWorker(dataset));
}
return dataset;
}
use of com.bakdata.conquery.models.worker.Namespace in project conquery by bakdata.
the class AdminDatasetProcessor method deleteConcept.
/**
* Deletes a concept.
*/
public synchronized void deleteConcept(Concept<?> concept) {
final Namespace namespace = datasetRegistry.get(concept.getDataset().getId());
namespace.getStorage().removeConcept(concept.getId());
getJobManager().addSlowJob(new SimpleJob("sendToAll: remove " + concept.getId(), () -> namespace.sendToAll(new RemoveConcept(concept))));
}
use of com.bakdata.conquery.models.worker.Namespace in project conquery by bakdata.
the class AdminDatasetProcessor method updateMatchingStats.
/**
* Issues all Shards to do an UpdateMatchingStats.
*
* @implNote This intentionally submits a SlowJob so that it will be queued after all jobs that are already in the queue (usually import jobs).
*/
public void updateMatchingStats(Dataset dataset) {
final Namespace ns = getDatasetRegistry().get(dataset.getId());
ns.getJobManager().addSlowJob(new SimpleJob("Initiate Update Matching Stats and FilterSearch", () -> {
ns.sendToAll(new UpdateMatchingStatsMessage());
FilterSearch.updateSearch(getDatasetRegistry(), Collections.singleton(ns.getDataset()), getJobManager(), config.getCsv());
}));
}
use of com.bakdata.conquery.models.worker.Namespace in project conquery by bakdata.
the class DatasetsUIResource method getIdMapping.
@GET
@Path("{" + DATASET + "}/mapping")
public View getIdMapping(@PathParam(DATASET) Dataset dataset) {
final Namespace namespace = uiProcessor.getDatasetRegistry().get(dataset.getId());
EntityIdMap mapping = namespace.getStorage().getIdMapping();
if (mapping != null && mapping.getInternalToPrint() != null) {
return new UIView<>("idmapping.html.ftl", uiProcessor.getUIContext(), mapping.getInternalToPrint());
}
return new UIView<>("add_idmapping.html.ftl", uiProcessor.getUIContext(), namespace.getDataset().getId());
}
use of com.bakdata.conquery.models.worker.Namespace in project conquery by bakdata.
the class ManagerNode method loadMetaStorage.
private void loadMetaStorage() {
log.info("Opening MetaStorage");
storage.openStores(config.getStorage());
log.info("Loading MetaStorage");
storage.loadData();
log.info("MetaStorage loaded {}", storage);
datasetRegistry.setMetaStorage(storage);
for (Namespace sn : datasetRegistry.getDatasets()) {
sn.getStorage().setMetaStorage(storage);
}
}
Aggregations