Skip to content

Commit

Permalink
Add replication url to task
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 13, 2023
1 parent a4f74b0 commit ac86308
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public record UpdateOsmDatabase(Object database, Integer databaseSrid) implements Task {
public record UpdateOsmDatabase(Object database, Integer databaseSrid, String replicationUrl) implements Task {

private static final Logger logger = LoggerFactory.getLogger(UpdateOsmDatabase.class);

Expand All @@ -69,21 +69,22 @@ public void execute(WorkflowContext context) throws Exception {
nodeRepository,
wayRepository,
relationRepository,
databaseSrid);
databaseSrid,
replicationUrl);
}

public static void execute(DataMap<Long, Coordinate> coordinateMap,
DataMap<Long, List<Long>> referenceMap,
HeaderRepository headerRepository, Repository<Long, Node> nodeRepository,
Repository<Long, Way> wayRepository, Repository<Long, Relation> relationRepository,
int srid) throws Exception {
Integer databaseSrid,
String replicationUrl) throws Exception {

var header = headerRepository.selectLatest();
var replicationUrl = header.getReplicationUrl();
var sequenceNumber = header.getReplicationSequenceNumber() + 1;

var createGeometry = new EntityGeometryBuilder(coordinateMap, referenceMap);
var reprojectGeometry = new EntityProjectionTransformer(4326, srid);
var reprojectGeometry = new EntityProjectionTransformer(4326, databaseSrid);
var prepareGeometries = new ChangeEntitiesHandler(createGeometry.andThen(reprojectGeometry));
var prepareChange = consumeThenReturn(prepareGeometries);
var importChange = new ChangeImporter(nodeRepository, wayRepository, relationRepository);
Expand Down
1 change: 1 addition & 0 deletions basemap/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default {
"tasks": [
{
"type": "UpdateOsmDatabase",
"replicationUrl": "https://planet.osm.org/replication/hour/",
"database": config.database,
"databaseSrid": 3857,
},
Expand Down

0 comments on commit ac86308

Please sign in to comment.