Skip to content

Commit

Permalink
Removing sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
dromagnoli committed Jul 16, 2024
1 parent 093d2b0 commit 27bb858
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 247 deletions.
26 changes: 1 addition & 25 deletions doc/en/user/source/extensions/mapml/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,31 +209,7 @@ in order to enable WMTS requests.

.. figure:: images/mapml_tile_caching_panel_ui.png

Sharding Config
^^^^^^^^^^^^^^^^

The Sharding Config options are intended to allow for parallel access to tiles via different server names. The actual server names must be configured in the DNS to refer to either the same server or different servers with the same GeSserver layer configuration. In the example above, the mapML client would alternate between the servers a.geoserver.org, b.geoserver.org, and c.geoserver.org to access the map images. The values in the example above would result in the following MapML:

.. code-block:: html

<input name="s" type="hidden" shard="true" list="servers" min="0.0" max="0.0"/>
<datalist id="servers">
<option value="a"/>
<option value="b"/>
<option value="c"/>
</datalist>
<link tref="http://{s}.geoserver.org:8080/geoserver/test/wms?version=1.3.0&amp;service=WMS&amp;request=GetMap&amp;crs=EPSG:3857&amp;layers=cntry00&amp;styles=&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;format=image/png&amp;transparent=false&amp;width={w}&amp;height={h}" rel="image"/>


**Enable Sharding**
If Enable Sharding is checked, and values are provided for the Shard List and Shard Server Pattern fields, then a hidden shard list input will be included in the MapML.

**Shard List**
If Enable Sharding is checked, the Shard List should be populated with a comma-separated list of shard names which will be used to populate the shard data list element.

**Shard Server Pattern**
The Shard Server Pattern should be a valid DNS name including the special placeholder string {s} which will be replace with the Shard Names from the Shard List in requests to the server. This pattern should not include any slashes, the protocol string (http://) or the port number (:80), as these are all determined automatically from the URL used to access the MapML resource.

Starting with version 2.26.x of GeoServer, Sharding support and related configuration has been removed.

Dimension Config
^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ public final class MapMLConstants {
/** MAPML_DIMENSION */
public static final String MAPML_MIME = MAPML_PREFIX + MIME;

/** SHARD_LIST */
public static final String SHARD_LIST = "shardList";

/** ENABLE_SHARDING */
public static final String ENABLE_SHARDING = "enableSharding";

/** USE_TILES */
public static final String USE_TILES = "useTiles";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.geoserver.mapml.xml.AxisType;
import org.geoserver.mapml.xml.Base;
import org.geoserver.mapml.xml.BodyContent;
import org.geoserver.mapml.xml.Datalist;
import org.geoserver.mapml.xml.Extent;
import org.geoserver.mapml.xml.HeadContent;
import org.geoserver.mapml.xml.Input;
Expand Down Expand Up @@ -134,8 +133,6 @@ public class MapMLDocumentBuilder {
private String imageFormat = DEFAULT_MIME_TYPE;
private String baseUrl;
private String baseUrlPattern;
private Boolean enableSharding;
private String[] shardArray;
private ProjType projType;
private MetadataMap layerMeta;
private int height;
Expand Down Expand Up @@ -331,23 +328,6 @@ public void initialize() throws ServiceException {
imageFormat = (String) format.orElse(mapMLLayerMetadata.getDefaultMimeType());
baseUrl = ResponseUtils.baseURL(request);
baseUrlPattern = baseUrl;
// handle shard config
enableSharding = layerMeta.get("mapml.enableSharding", Boolean.class);
String shardListString = layerMeta.get("mapml.shardList", String.class);
shardArray = new String[0];
if (shardListString != null) {
shardArray = shardListString.split("[,\\s]+");
}
String shardServerPattern = layerMeta.get("mapml.shardServerPattern", String.class);
if (shardArray.length < 1
|| shardServerPattern == null
|| shardServerPattern.isEmpty()) {
enableSharding = Boolean.FALSE;
}
// if we have a valid shard config
if (Boolean.TRUE.equals(enableSharding)) {
baseUrlPattern = shardBaseURL(request, shardServerPattern);
}
}
}

Expand Down Expand Up @@ -685,22 +665,6 @@ public String getTitle(PublishedInfo p, String defaultTitle) {
}
}

/**
* @param req the request
* @param shardServerPattern the shard server pattern
* @return the shard base URL
*/
private String shardBaseURL(HttpServletRequest req, String shardServerPattern) {
StringBuffer sb = new StringBuffer(req.getScheme());
sb.append("://")
.append(shardServerPattern)
.append(":")
.append(req.getServerPort())
.append(req.getContextPath())
.append("/");
return sb.toString();
}

/** Create and return MapML document */
private void prepareDocument() {
// build the mapML doc
Expand Down Expand Up @@ -998,26 +962,6 @@ private List<Extent> prepareExtents() throws IOException {
extentZoomInput.setMax(maxZoom);
extentList.add(extentZoomInput);

Input input;
// shard list
if (Boolean.TRUE.equals(enableSharding)) {
input = new Input();
input.setName("s");
input.setType(InputType.HIDDEN);
input.setShard("true");
input.setList("servers");
extentList.add(input);
Datalist datalist = new Datalist();
datalist.setId("servers");
List<Option> options = datalist.getOptions();
for (String sa : shardArray) {
Option o = new Option();
o.setValue(sa);
options.add(o);
}
extentList.add(datalist);
}

String dimension = layerMeta.get("mapml.dimension", String.class);
prepareExtentForLayer(mapMLLayerMetadata, dimension);
generateTemplatedLinks(mapMLLayerMetadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,38 +58,6 @@ <h3>
</ul>
</fieldset>
</li>
<li>
<fieldset>
<legend>
<span><wicket:message key="mapmlShardSection">Sharding Config</wicket:message></span>
</legend>
<ul class="choiceList">
<li>
<input id="enableSharding" wicket:id="enableSharding" type="checkbox"></input>
<label for="enableSharding">
<wicket:message key="mapmlEnableSharding">Enable Sharding</wicket:message>
</label>
</li>
</ul>
<ul>
<li>
<label for="shardList">
<wicket:message key="mapmlShardList">Shard List (comma separated)</wicket:message>
</label>
<input id="shardList" wicket:id="shardList" class="text" type="text"></input>
</li>
<li>
<label for="shardServerPattern">
<wicket:message key="mapmlShardServerPattern">Shard Server Pattern (include {s} as shard
placeholder)
</wicket:message>
</label>
<input id="shardServerPattern" wicket:id="shardServerPattern" class="text"
type="text"></input>
</li>
</ul>
</fieldset>
</li>
<li>
<fieldset>
<legend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,29 +132,6 @@ protected void onUpdate(AjaxRequestTarget target) {
});
add(useFeatures);

// add the checkbox to enable sharding or not
MapModel<Boolean> enableShardingModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, MapMLConstants.RESOURCE_METADATA),
MapMLConstants.MAPML_PREFIX + MapMLConstants.ENABLE_SHARDING);
CheckBox enableSharding = new CheckBox(MapMLConstants.ENABLE_SHARDING, enableShardingModel);
add(enableSharding);

MapModel<String> shardListModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, MapMLConstants.RESOURCE_METADATA),
MapMLConstants.MAPML_PREFIX + MapMLConstants.SHARD_LIST);
TextField<String> shardList = new TextField<>(MapMLConstants.SHARD_LIST, shardListModel);
add(shardList);

MapModel<String> shardServerPatternModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, MapMLConstants.RESOURCE_METADATA),
MapMLConstants.MAPML_PREFIX + MapMLConstants.SHARD_SERVER_PATTERN);
TextField<String> shardServerPattern =
new TextField<>(MapMLConstants.SHARD_SERVER_PATTERN, shardServerPatternModel);
add(shardServerPattern);

MapModel<String> dimensionModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, MapMLConstants.RESOURCE_METADATA),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,6 @@ <h3><wicket:message key="mapmlSectionHeading">MapML Settings</wicket:message></h
</ul>
</fieldset>
</li>
<li>
<fieldset>
<legend>
<span><wicket:message key="mapmlShardSection">Sharding Config</wicket:message></span>
</legend>
<ul class="choiceList">
<li>
<input id="enableSharding" wicket:id="enableSharding" type="checkbox"></input>
<label for="enableSharding"><wicket:message key="mapmlEnableSharding">Enable Sharding</wicket:message></label>
</li>
</ul>
<ul>
<li>
<label for="shardList"><wicket:message key="mapmlShardList">Shard List (comma separated)</wicket:message></label>
<input id="shardList" wicket:id="shardList" class="text" type="text"></input>
</li>
<li>
<label for="shardServerPattern"><wicket:message key="mapmlShardServerPattern">Shard Server Pattern (include {s} as shard placeholder)</wicket:message></label>
<input id="shardServerPattern" wicket:id="shardServerPattern" class="text" type="text"></input>
</li>
</ul>
</fieldset>
</li>
<li>
<fieldset>
<legend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
});
add(useTiles);

// add the checkbox to enable sharding or not
MapModel<Boolean> enableShardingModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, METADATA), "mapml.enableSharding");
CheckBox enableSharding = new CheckBox("enableSharding", enableShardingModel);
add(enableSharding);

MapModel<String> shardListModel =
new MapModel<>(new PropertyModel<MetadataMap>(model, METADATA), "mapml.shardList");
TextField<String> shardList = new TextField<>("shardList", shardListModel);
add(shardList);

MapModel<String> shardServerPatternModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, METADATA),
"mapml.shardServerPattern");
TextField<String> shardServerPattern =
new TextField<>("shardServerPattern", shardServerPatternModel);
add(shardServerPattern);

MapModel<String> mimeModel =
new MapModel<>(
new PropertyModel<MetadataMap>(model, METADATA), MapMLConstants.MAPML_MIME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ MapMLLayerConfigurationPanel.mapmlTileSection=Tile Settings
MapMLLayerConfigurationPanel.mapmlVectorSection=Vector Settings
MapMLLayerConfigurationPanel.mapmlUseTiles=Use Tiles
MapMLLayerConfigurationPanel.mapmlUseFeatures=Use Features
MapMLLayerConfigurationPanel.mapmlShardSection=Sharding Config
MapMLLayerConfigurationPanel.mapmlEnableSharding=Enable Sharding
MapMLLayerConfigurationPanel.mapmlShardList=Shard List (comma separated)
MapMLLayerConfigurationPanel.mapmlShardServerPattern=Shard Server Pattern (include {s} as shard placeholder)
MapMLLayerConfigurationPanel.mapmlDimensionSection=Dimension Config
MapMLLayerConfigurationPanel.mapmlDefaultMimeSection=Default Mime Type Config
MapMLLayerConfigurationPanel.mapmlDimension=Dimension
Expand All @@ -37,10 +33,6 @@ MapMLLayerGroupConfigurationPanel.mapmlTileSection=Tile Settings
MapMLLayerGroupConfigurationPanel.mapmlVectorSection=Vector Settings
MapMLLayerGroupConfigurationPanel.mapmlUseFeatures=Use Features
MapMLLayerGroupConfigurationPanel.mapmlUseTiles=Use Tiles
MapMLLayerGroupConfigurationPanel.mapmlShardSection=Sharding Config
MapMLLayerGroupConfigurationPanel.mapmlEnableSharding=Enable Sharding
MapMLLayerGroupConfigurationPanel.mapmlShardList=Shard List (comma separated)
MapMLLayerGroupConfigurationPanel.mapmlShardServerPattern=Shard Server Pattern (include {s} as shard placeholder)
MapMLLayerGroupConfigurationPanel.mapmlDefaultMimeSection=Default Mime Type Config
MapMLLayerGroupConfigurationPanel.mapmlDefaultMime=Default Mime Type
MapMLAdminPanel.title=MapML Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ MapMLLayerConfigurationPanel.mapmlLicenseLink=Lien de licence
MapMLLayerConfigurationPanel.mapmlTileSection=Paramètres des tuiles
MapMLLayerConfigurationPanel.mapmlVectorSection=Paramètres vectoriels
MapMLLayerConfigurationPanel.mapmlUseTiles=Utiliser des tuiles
MapMLLayerConfigurationPanel.mapmlShardSection=Configuration du sharding
MapMLLayerConfigurationPanel.mapmlEnableSharding=Activer le sharding
MapMLLayerConfigurationPanel.mapmlShardList=Liste des shards (séparés par des virgules)
MapMLLayerConfigurationPanel.mapmlShardServerPattern=Schéma des serveurs shard (inclure {s} comme remplaçant de shard)
MapMLLayerConfigurationPanel.mapmlDimensionSection=Configuration des dimensions
MapMLLayerConfigurationPanel.mapmlDimension=Dimension
MapMLLayerConfigurationPanel.dimension.nullValid=Aucun
Expand All @@ -34,10 +30,6 @@ MapMLLayerGroupConfigurationPanel.mapmlLicenseLink=Lien de licence
MapMLLayerGroupConfigurationPanel.mapmlTileSection=Paramètres des tuiles
MapMLLayerGroupConfigurationPanel.mapmlVectorSection=Paramètres vectoriels
MapMLLayerGroupConfigurationPanel.mapmlUseTiles=Utiliser des tuiles
MapMLLayerGroupConfigurationPanel.mapmlShardSection=Configuration du sharding
MapMLLayerGroupConfigurationPanel.mapmlEnableSharding=Activer le sharding
MapMLLayerGroupConfigurationPanel.mapmlShardList=Liste des shards (séparés par des virgules)
MapMLLayerGroupConfigurationPanel.mapmlShardServerPattern=Sch\u00E9ma des serveurs shard (inclure {s} comme rempla\u00E7ant du shard)
MapMLAdminPanel.title=MapML Paramètres
MapMLAdminPanel.mapml=MapML Paramètres
MapMLAdminPanel.multiextent=Représenter les requêtes multicouches sous forme de plusieurs éléments <map-extent>
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ MapMLLayerConfigurationPanel.mapmlLicenseTitle=\ub77c\uc774\uc120\uc2a4 \uc81c\u
MapMLLayerConfigurationPanel.mapmlLicenseLink=\ub77c\uc774\uc120\uc2a4 \ub9c1\ud06c
MapMLLayerConfigurationPanel.mapmlTileSection=\ud0c0\uc77c \uc124\uc815
MapMLLayerConfigurationPanel.mapmlUseTiles=\ud0c0\uc77c \uc0ac\uc6a9
MapMLLayerConfigurationPanel.mapmlShardSection=\uc0e4\ub529 \uad6c\uc131
MapMLLayerConfigurationPanel.mapmlEnableSharding=\uc0e4\ub529 \ud65c\uc131\ud654
MapMLLayerConfigurationPanel.mapmlShardList=\uc0e4\ub4dc \ubaa9\ub85d(\uc27c\ud45c\ub85c \uad6c\ubd84)
MapMLLayerConfigurationPanel.mapmlShardServerPattern=\uc0e4\ub4dc \uc11c\ubc84 \ud328\ud134({s}\uc744 \uc0e4\ub4dc \uc790\ub9ac \ud45c\uc2dc\uc790\ub85c \ud3ec\ud568)
MapMLLayerConfigurationPanel.mapmlDimensionSection=\ucc28\uc6d0 \uad6c\uc131
MapMLLayerConfigurationPanel.mapmlDimension=\ucc28\uc6d0
MapMLLayerConfigurationPanel.dimension.nullValid=\uc5c6\uc74c
Expand All @@ -39,7 +35,3 @@ MapMLLayerGroupConfigurationPanel.mapmlLicenseTitle=\ub77c\uc774\uc120\uc2a4 \uc
MapMLLayerGroupConfigurationPanel.mapmlLicenseLink=\ub77c\uc774\uc120\uc2a4 \ub9c1\ud06c
MapMLLayerGroupConfigurationPanel.mapmlTileSection=\ud0c0\uc77c \uc124\uc815
MapMLLayerGroupConfigurationPanel.mapmlUseTiles=\ud0c0\uc77c \uc0ac\uc6a9
MapMLLayerGroupConfigurationPanel.mapmlShardSection=\uc0e4\ub529 \uad6c\uc131
MapMLLayerGroupConfigurationPanel.mapmlEnableSharding=\uc0e4\ub529 \ud65c\uc131\ud654
MapMLLayerGroupConfigurationPanel.mapmlShardList=\uc0e4\ub4dc \ubaa9\ub85d(\uc27c\ud45c\ub85c \uad6c\ubd84)
MapMLLayerGroupConfigurationPanel.mapmlShardServerPattern=\uc0e4\ub4dc \uc11c\ubc84 \ud328\ud134({s}\uc744 \uc0e4\ub4dc \uc790\ub9ac \ud45c\uc2dc\uc790\ub85c \ud3ec\ud568)
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ MapMLPreviewLink.title=MapML
# MapMLLayerConfigurationPanel.mapmlLicenseLink=License Link
# MapMLLayerConfigurationPanel.mapmlTileSection=Tile Settings
# MapMLLayerConfigurationPanel.mapmlUseTiles=Use Tiles
# MapMLLayerConfigurationPanel.mapmlShardSection=Sharding Config
# MapMLLayerConfigurationPanel.mapmlEnableSharding=Enable Sharding
# MapMLLayerConfigurationPanel.mapmlShardList=Shard List (comma separated)
# MapMLLayerConfigurationPanel.mapmlShardServerPattern=Shard Server Pattern (include {s} as shard placeholder)
# MapMLLayerConfigurationPanel.mapmlDimensionSection=Dimension Config
MapMLLayerConfigurationPanel.mapmlDimension=Dimensiuni
MapMLLayerConfigurationPanel.dimension.nullValid=Nici unul
Expand All @@ -39,7 +35,3 @@ MapMLLayerConfigurationPanel.dimension.nullValid=Nici unul
# MapMLLayerGroupConfigurationPanel.mapmlLicenseLink=License Link
# MapMLLayerGroupConfigurationPanel.mapmlTileSection=Tile Settings
# MapMLLayerGroupConfigurationPanel.mapmlUseTiles=Use Tiles
# MapMLLayerGroupConfigurationPanel.mapmlShardSection=Sharding Config
# MapMLLayerGroupConfigurationPanel.mapmlEnableSharding=Enable Sharding
# MapMLLayerGroupConfigurationPanel.mapmlShardList=Shard List (comma separated)
# MapMLLayerGroupConfigurationPanel.mapmlShardServerPattern=Shard Server Pattern (include {s} as shard placeholder)
Loading

0 comments on commit 27bb858

Please sign in to comment.