-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: remove blog and add Advanced Features
- Loading branch information
1 parent
4e908a2
commit 364246b
Showing
30 changed files
with
91 additions
and
153 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-93.9 KB
docs/gestalt-static/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Reload Strategies | ||
Gestalt is idempotent, as in on calling `loadConfigs()` a config tree is built and will not be updated, even if the underlying sources have changed. | ||
By using Reload strategies you can tell Gestalt when the specific config source has changed to dynamically update configuration on the fly. Once the config tree has been rebuilt, Gestalt will trigger its own Gestalt Core Reload Listener. So you can get an update that the reload has happened. | ||
|
||
When adding a ConfigSource to the builder, you can choose to a reload strategy. The reload strategy triggers from either a file change, a timer event or a manual call from your code. Each reload strategy is for a specific source, and will not cause all sources to be reloaded, only that source. | ||
Once Gestalt has reloaded the config it will send out its own Gestalt Core Reload event. you can add a listener to the builder to get a notification when a Gestalt Core Reload has completed. The Gestalt Cache uses this to clear the cache when a Config Source has changed. | ||
|
||
```java | ||
Gestalt gestalt = builder | ||
.addSource(FileConfigSourceBuilder.builder() | ||
.setFile(devFile) | ||
.addConfigReloadStrategy(new FileChangeReloadStrategy()) | ||
.build()) | ||
.addCoreReloadListener(reloadListener) | ||
.build(); | ||
``` | ||
|
||
| Reload Strategy | Details | | ||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| FileChangeReload | Specify a FileConfigSource, and the FileChangeReload will listen for changes on that file. When the file changes it will tell Gestalt to reload the file. Also works with symlink and will reload if the symlink change. | | ||
| TimedConfigReloadStrategy | Provide a ConfigSource and a Duration then the Reload Strategy will reload every period defined by the Duration | | ||
| ManualConfigReloadStrategy| You can manually call reload to force a source to reload. | |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
docs/gestalt-static/docs/tutorial/tags-configuration/tag-examples.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Tags Example | ||
When adding a config source you are able to apply zero or more Tags to the source. Those tags are then applied to all configuration within that source. Tags are optional and can be omitted. | ||
When retrieving the config it will first search for an exact match to the tags, if provided, then search for the configs with no tags. It will then merge the results. | ||
If you provide 2 tags in the source, when retrieving the configuration you must provide those two exact tags. | ||
|
||
```java | ||
// head.shot.multiplier = 1.3 | ||
// max.online.players = 32 | ||
ConfigSourcePackage pveConfig = ClassPathConfigSourceBuilder.builder() | ||
.setResource("/test-pve.properties") | ||
.setTags(Tags.of("mode", "pve")) | ||
.build(); | ||
|
||
// head.shot.multiplier = 1.5 | ||
ConfigSourcePackage pvpConfig = ClassPathConfigSourceBuilder.builder() | ||
.setResource("/test-pvp.properties") | ||
.setTags(Tags.of("mode", "pvp")) | ||
.build(); | ||
|
||
// head.shot.multiplier = 1.0 | ||
// gut.shot.multiplier = 1.0 | ||
ConfigSourcePackage defaultConfig = ClassPathConfigSourceBuilder.builder() | ||
.setResource("/test.properties") | ||
.setTags(Tags.of()) | ||
.build(); // Tags.of() can be omitted | ||
|
||
Gestalt gestalt = builder | ||
.addSource(pveConfig) | ||
.addSource(pvpConfig) | ||
.addSource(defaultConfig) | ||
.build(); | ||
|
||
// retrieving "head.shot.multiplier" values change depending on the tag. | ||
float pvpHeadShot = gestalt.getConfig("head.shot.multiplier", Float.class, Tags.of("mode", "pve")); // 1.3 | ||
float pveHeadShot = gestalt.getConfig("head.shot.multiplier", Float.class, Tags.of("mode", "pvp")); // 1.5 | ||
float coopHeadShot = gestalt.getConfig("head.shot.multiplier", Float.class, Tags.of("mode", "coop")); // 1.0 fall back to default | ||
float defaultHeadShot = gestalt.getConfig("head.shot.multiplier", Float.class); // 1.0 | ||
|
||
// Gut shot is only defined in the default, so it will always return the default. | ||
float pvpGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "pve")); // 1.0 | ||
float pveGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "pvp")); // 1.0 | ||
float coopGutSoot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "coop")); // 1.0 | ||
float defaultGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class); // 1.0 | ||
|
||
// Max online players is only defined in the pvp, so it will only return with the pvp tags. | ||
float pvpGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "pve")); // 32 | ||
float pveGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "pvp")); // not found | ||
float coopGutSoot = gestalt.getConfig("gut.shot.multiplier", Float.class, Tags.of("mode", "coop")); // not found | ||
float defaultGutShot = gestalt.getConfig("gut.shot.multiplier", Float.class); // not found | ||
``` | ||
|
||
* **Note**: The config node processor string replacement doesn't accept tags, so it will always replace the configs with the tag-less ones. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters