mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-26 12:15:15 +01:00
#1147 Rename limbo segment configurations / remove inaccurate comments
This commit is contained in:
parent
adb007108d
commit
2ecdc57277
@ -1,5 +1,5 @@
|
|||||||
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
|
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
|
||||||
<!-- File auto-generated on Tue Mar 28 21:38:52 CEST 2017. See docs/config/config.tpl.md -->
|
<!-- File auto-generated on Tue Mar 28 21:48:52 CEST 2017. See docs/config/config.tpl.md -->
|
||||||
|
|
||||||
## AuthMe Configuration
|
## AuthMe Configuration
|
||||||
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
|
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
|
||||||
@ -458,18 +458,16 @@ limbo:
|
|||||||
# INDIVIDUAL_FILES: each player data in its own file,
|
# INDIVIDUAL_FILES: each player data in its own file,
|
||||||
# DISTRIBUTED_FILES: distributes players into different files based on their UUID, see below
|
# DISTRIBUTED_FILES: distributes players into different files based on their UUID, see below
|
||||||
type: 'INDIVIDUAL_FILES'
|
type: 'INDIVIDUAL_FILES'
|
||||||
# This setting only affects DISTRIBUTED_FILES persistence. The segment file
|
# This setting only affects DISTRIBUTED_FILES persistence. The distributed file
|
||||||
# persistence attempts to reduce the number of files by distributing players into various
|
# persistence attempts to reduce the number of files by distributing players into various
|
||||||
# buckets based on their UUID. This setting defines into how many files the players should
|
# buckets based on their UUID. This setting defines into how many files the players should
|
||||||
# be distributed. Possible values: ONE, FOUR, EIGHT, SIXTEEN, THIRTY_TWO, SIXTY_FOUR,
|
# be distributed. Possible values: ONE, FOUR, EIGHT, SIXTEEN, THIRTY_TWO, SIXTY_FOUR,
|
||||||
# ONE_TWENTY for 128, TWO_FIFTY for 256.
|
# ONE_TWENTY for 128, TWO_FIFTY for 256.
|
||||||
# For example, if you expect 100 non-logged in players, setting to SIXTEEN will average
|
# For example, if you expect 100 non-logged in players, setting to SIXTEEN will average
|
||||||
# 6.25 players per file (100 / 16). If you set to ONE, only one file will be used and the
|
# 6.25 players per file (100 / 16).
|
||||||
# entries will be kept in memory, reducing the number of times we read from the file.
|
|
||||||
# This may deliver different results in terms of performance.
|
|
||||||
# Note: if you change this setting all data will be migrated. If you have a lot of data,
|
# Note: if you change this setting all data will be migrated. If you have a lot of data,
|
||||||
# change this setting only on server restart, not with /authme reload.
|
# change this setting only on server restart, not with /authme reload.
|
||||||
segmentDistribution: 'SIXTEEN'
|
distributionSize: 'SIXTEEN'
|
||||||
# Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE.
|
# Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE.
|
||||||
# RESTORE sets back the old property from the player.
|
# RESTORE sets back the old property from the player.
|
||||||
restoreAllowFlight: 'RESTORE'
|
restoreAllowFlight: 'RESTORE'
|
||||||
@ -509,4 +507,4 @@ To change settings on a running server, save your changes to config.yml and use
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Tue Mar 28 21:38:52 CEST 2017
|
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Tue Mar 28 21:48:52 CEST 2017
|
||||||
|
@ -52,7 +52,7 @@ class DistributedFilesPersistenceHandler implements LimboPersistenceHandler {
|
|||||||
.setPrettyPrinting()
|
.setPrettyPrinting()
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
segmentNameBuilder = new SegmentNameBuilder(settings.getProperty(LimboSettings.SEGMENT_DISTRIBUTION));
|
segmentNameBuilder = new SegmentNameBuilder(settings.getProperty(LimboSettings.DISTRIBUTION_SIZE));
|
||||||
|
|
||||||
convertOldDataToCurrentSegmentScheme();
|
convertOldDataToCurrentSegmentScheme();
|
||||||
deleteEmptyFiles();
|
deleteEmptyFiles();
|
||||||
|
@ -18,7 +18,7 @@ class SegmentNameBuilder {
|
|||||||
*
|
*
|
||||||
* @param partition the segment configuration
|
* @param partition the segment configuration
|
||||||
*/
|
*/
|
||||||
SegmentNameBuilder(SegmentConfiguration partition) {
|
SegmentNameBuilder(SegmentSize partition) {
|
||||||
this.length = partition.getLength();
|
this.length = partition.getLength();
|
||||||
this.distribution = partition.getDistribution();
|
this.distribution = partition.getDistribution();
|
||||||
this.prefix = "seg" + partition.getTotalSegments() + "-";
|
this.prefix = "seg" + partition.getTotalSegments() + "-";
|
||||||
|
@ -33,7 +33,7 @@ package fr.xephi.authme.data.limbo.persistence;
|
|||||||
* Where possible, prefer a length of 1 (no string concatenation required) or a distribution of
|
* Where possible, prefer a length of 1 (no string concatenation required) or a distribution of
|
||||||
* 16 (no remapping of the characters required).
|
* 16 (no remapping of the characters required).
|
||||||
*/
|
*/
|
||||||
public enum SegmentConfiguration {
|
public enum SegmentSize {
|
||||||
|
|
||||||
/** 1. */
|
/** 1. */
|
||||||
ONE(1, 1),
|
ONE(1, 1),
|
||||||
@ -65,7 +65,7 @@ public enum SegmentConfiguration {
|
|||||||
private final int distribution;
|
private final int distribution;
|
||||||
private final int length;
|
private final int length;
|
||||||
|
|
||||||
SegmentConfiguration(int distribution, int length) {
|
SegmentSize(int distribution, int length) {
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
import fr.xephi.authme.data.limbo.AllowFlightRestoreType;
|
import fr.xephi.authme.data.limbo.AllowFlightRestoreType;
|
||||||
import fr.xephi.authme.data.limbo.WalkFlySpeedRestoreType;
|
import fr.xephi.authme.data.limbo.WalkFlySpeedRestoreType;
|
||||||
import fr.xephi.authme.data.limbo.persistence.LimboPersistenceType;
|
import fr.xephi.authme.data.limbo.persistence.LimboPersistenceType;
|
||||||
import fr.xephi.authme.data.limbo.persistence.SegmentConfiguration;
|
import fr.xephi.authme.data.limbo.persistence.SegmentSize;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -31,21 +31,18 @@ public final class LimboSettings implements SettingsHolder {
|
|||||||
newProperty(LimboPersistenceType.class, "limbo.persistence.type", LimboPersistenceType.INDIVIDUAL_FILES);
|
newProperty(LimboPersistenceType.class, "limbo.persistence.type", LimboPersistenceType.INDIVIDUAL_FILES);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"This setting only affects DISTRIBUTED_FILES persistence. The segment file",
|
"This setting only affects DISTRIBUTED_FILES persistence. The distributed file",
|
||||||
"persistence attempts to reduce the number of files by distributing players into various",
|
"persistence attempts to reduce the number of files by distributing players into various",
|
||||||
"buckets based on their UUID. This setting defines into how many files the players should",
|
"buckets based on their UUID. This setting defines into how many files the players should",
|
||||||
"be distributed. Possible values: ONE, FOUR, EIGHT, SIXTEEN, THIRTY_TWO, SIXTY_FOUR,",
|
"be distributed. Possible values: ONE, FOUR, EIGHT, SIXTEEN, THIRTY_TWO, SIXTY_FOUR,",
|
||||||
"ONE_TWENTY for 128, TWO_FIFTY for 256.",
|
"ONE_TWENTY for 128, TWO_FIFTY for 256.",
|
||||||
"For example, if you expect 100 non-logged in players, setting to SIXTEEN will average",
|
"For example, if you expect 100 non-logged in players, setting to SIXTEEN will average",
|
||||||
"6.25 players per file (100 / 16). If you set to ONE, only one file will be used and the",
|
"6.25 players per file (100 / 16).",
|
||||||
"entries will be kept in memory, reducing the number of times we read from the file.",
|
|
||||||
"This may deliver different results in terms of performance.",
|
|
||||||
"Note: if you change this setting all data will be migrated. If you have a lot of data,",
|
"Note: if you change this setting all data will be migrated. If you have a lot of data,",
|
||||||
"change this setting only on server restart, not with /authme reload."
|
"change this setting only on server restart, not with /authme reload."
|
||||||
})
|
})
|
||||||
public static final Property<SegmentConfiguration> SEGMENT_DISTRIBUTION =
|
public static final Property<SegmentSize> DISTRIBUTION_SIZE =
|
||||||
newProperty(SegmentConfiguration.class, "limbo.persistence.segmentDistribution",
|
newProperty(SegmentSize.class, "limbo.persistence.distributionSize", SegmentSize.SIXTEEN);
|
||||||
SegmentConfiguration.SIXTEEN);
|
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE.",
|
"Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE.",
|
||||||
|
@ -90,7 +90,7 @@ public class DistributedFilesPersistenceHandlerTest {
|
|||||||
|
|
||||||
@BeforeInjecting
|
@BeforeInjecting
|
||||||
public void setUpClasses() throws IOException {
|
public void setUpClasses() throws IOException {
|
||||||
given(settings.getProperty(LimboSettings.SEGMENT_DISTRIBUTION)).willReturn(SegmentConfiguration.SIXTEEN);
|
given(settings.getProperty(LimboSettings.DISTRIBUTION_SIZE)).willReturn(SegmentSize.SIXTEEN);
|
||||||
dataFolder = temporaryFolder.newFolder();
|
dataFolder = temporaryFolder.newFolder();
|
||||||
playerDataFolder = new File(dataFolder, "playerdata");
|
playerDataFolder = new File(dataFolder, "playerdata");
|
||||||
playerDataFolder.mkdir();
|
playerDataFolder.mkdir();
|
||||||
|
@ -5,13 +5,13 @@ import org.junit.Test;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.EIGHT;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.EIGHT;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.FOUR;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.FOUR;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.ONE;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.ONE;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.SIXTEEN;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.SIXTEEN;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.SIXTY_FOUR;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.SIXTY_FOUR;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.THIRTY_TWO;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.THIRTY_TWO;
|
||||||
import static fr.xephi.authme.data.limbo.persistence.SegmentConfiguration.TWO_FIFTY;
|
import static fr.xephi.authme.data.limbo.persistence.SegmentSize.TWO_FIFTY;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
@ -23,11 +23,11 @@ public class SegmentNameBuilderTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that using a given segment size really produces as many segments as defined.
|
* Checks that using a given segment size really produces as many segments as defined.
|
||||||
* E.g. if we partition with {@link SegmentConfiguration#EIGHT} we expect eight different buckets.
|
* E.g. if we partition with {@link SegmentSize#EIGHT} we expect eight different buckets.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void shouldCreatePromisedSizeOfSegments() {
|
public void shouldCreatePromisedSizeOfSegments() {
|
||||||
for (SegmentConfiguration part : SegmentConfiguration.values()) {
|
for (SegmentSize part : SegmentSize.values()) {
|
||||||
// Perform this check only for `length` <= 5 because the test creates all hex numbers with `length` digits.
|
// Perform this check only for `length` <= 5 because the test creates all hex numbers with `length` digits.
|
||||||
if (part.getLength() <= 5) {
|
if (part.getLength() <= 5) {
|
||||||
checkTotalSegmentsProduced(part);
|
checkTotalSegmentsProduced(part);
|
||||||
@ -35,7 +35,7 @@ public class SegmentNameBuilderTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTotalSegmentsProduced(SegmentConfiguration part) {
|
private void checkTotalSegmentsProduced(SegmentSize part) {
|
||||||
// given
|
// given
|
||||||
SegmentNameBuilder nameBuilder = new SegmentNameBuilder(part);
|
SegmentNameBuilder nameBuilder = new SegmentNameBuilder(part);
|
||||||
Set<String> encounteredSegments = new HashSet<>();
|
Set<String> encounteredSegments = new HashSet<>();
|
||||||
|
@ -12,9 +12,9 @@ import static org.hamcrest.Matchers.greaterThan;
|
|||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@link SegmentConfiguration}.
|
* Test for {@link SegmentSize}.
|
||||||
*/
|
*/
|
||||||
public class SegmentConfigurationTest {
|
public class SegmentSizeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldHaveDistributionThatIsPowerOf2() {
|
public void shouldHaveDistributionThatIsPowerOf2() {
|
||||||
@ -22,7 +22,7 @@ public class SegmentConfigurationTest {
|
|||||||
Set<Integer> allowedDistributions = ImmutableSet.of(1, 2, 4, 8, 16);
|
Set<Integer> allowedDistributions = ImmutableSet.of(1, 2, 4, 8, 16);
|
||||||
|
|
||||||
// when / then
|
// when / then
|
||||||
for (SegmentConfiguration entry : SegmentConfiguration.values()) {
|
for (SegmentSize entry : SegmentSize.values()) {
|
||||||
if (!allowedDistributions.contains(entry.getDistribution())) {
|
if (!allowedDistributions.contains(entry.getDistribution())) {
|
||||||
fail("Distribution must be a power of 2 and within [1, 16]. Offending item: " + entry);
|
fail("Distribution must be a power of 2 and within [1, 16]. Offending item: " + entry);
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ public class SegmentConfigurationTest {
|
|||||||
Set<Integer> segmentTotals = new HashSet<>();
|
Set<Integer> segmentTotals = new HashSet<>();
|
||||||
|
|
||||||
// when / then
|
// when / then
|
||||||
for (SegmentConfiguration entry : SegmentConfiguration.values()) {
|
for (SegmentSize entry : SegmentSize.values()) {
|
||||||
int totalSegments = entry.getTotalSegments();
|
int totalSegments = entry.getTotalSegments();
|
||||||
assertThat(entry + " must have a positive segment size",
|
assertThat(entry + " must have a positive segment size",
|
||||||
totalSegments, greaterThan(0));
|
totalSegments, greaterThan(0));
|
Loading…
Reference in New Issue
Block a user