mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Capitalize the Bloom in Bloom filter in comments
(Because it's someone's name.) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150353742
This commit is contained in:
parent
bd6a2d02dd
commit
ff70494bd8
4 changed files with 12 additions and 12 deletions
|
@ -77,7 +77,7 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
long revisionId;
|
long revisionId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bloom filter that is used to determine efficiently and quickly whether a label might be
|
* A Bloom filter that is used to determine efficiently and quickly whether a label might be
|
||||||
* premium.
|
* premium.
|
||||||
*
|
*
|
||||||
* <p>If the label might be premium, then the premium list entry must be loaded by key and
|
* <p>If the label might be premium, then the premium list entry must be loaded by key and
|
||||||
|
@ -87,7 +87,7 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
private BloomFilter<String> probablePremiumLabels;
|
private BloomFilter<String> probablePremiumLabels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bloom filter.
|
* Get the Bloom filter.
|
||||||
*
|
*
|
||||||
* <p>Note that this is not a copy, but the mutable object itself, because copying would be
|
* <p>Note that this is not a copy, but the mutable object itself, because copying would be
|
||||||
* expensive. You probably should not modify the filter unless you know what you're doing.
|
* expensive. You probably should not modify the filter unless you know what you're doing.
|
||||||
|
@ -97,7 +97,7 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum size of the bloom filter.
|
* The maximum size of the Bloom filter.
|
||||||
*
|
*
|
||||||
* <p>Trying to set it any larger will throw an error, as we know it won't fit into a Datastore
|
* <p>Trying to set it any larger will throw an error, as we know it won't fit into a Datastore
|
||||||
* entity. We use 90% of the 1 MB Datastore limit to leave some wriggle room for the other
|
* entity. We use 90% of the 1 MB Datastore limit to leave some wriggle room for the other
|
||||||
|
@ -122,9 +122,9 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
revision.probablePremiumLabels.writeTo(bos);
|
revision.probablePremiumLabels.writeTo(bos);
|
||||||
checkArgument(bos.size() <= MAX_BLOOM_FILTER_BYTES,
|
checkArgument(bos.size() <= MAX_BLOOM_FILTER_BYTES,
|
||||||
"Too many premium labels were specified; bloom filter exceeds max entity size");
|
"Too many premium labels were specified; Bloom filter exceeds max entity size");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException("Could not serialize premium labels bloom filter", e);
|
throw new IllegalStateException("Could not serialize premium labels Bloom filter", e);
|
||||||
}
|
}
|
||||||
return revision;
|
return revision;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
}});
|
}});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-memory cache for {@link PremiumListRevision}s, used for retrieving bloom filters quickly.
|
* In-memory cache for {@link PremiumListRevision}s, used for retrieving Bloom filters quickly.
|
||||||
*
|
*
|
||||||
* <p>This is cached for a long duration (essentially indefinitely) because a given
|
* <p>This is cached for a long duration (essentially indefinitely) because a given
|
||||||
* {@link PremiumListRevision} is immutable and cannot ever be changed once created, so its cache
|
* {@link PremiumListRevision} is immutable and cannot ever be changed once created, so its cache
|
||||||
|
@ -190,7 +190,7 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
*
|
*
|
||||||
* <p>A maximum size is set here on the cache because it can potentially grow too big to fit in
|
* <p>A maximum size is set here on the cache because it can potentially grow too big to fit in
|
||||||
* memory if there are a large number of distinct premium list entries being queried (both those
|
* memory if there are a large number of distinct premium list entries being queried (both those
|
||||||
* that exist, as well as those that might exist according to the bloom filter, must be cached).
|
* that exist, as well as those that might exist according to the Bloom filter, must be cached).
|
||||||
* The entries judged least likely to be accessed again will be evicted first.
|
* The entries judged least likely to be accessed again will be evicted first.
|
||||||
*/
|
*/
|
||||||
@NonFinalForTesting
|
@NonFinalForTesting
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class PremiumListUtils {
|
||||||
}
|
}
|
||||||
checkState(
|
checkState(
|
||||||
revision.getProbablePremiumLabels() != null,
|
revision.getProbablePremiumLabels() != null,
|
||||||
"Probable premium labels bloom filter is null on revision '%s'",
|
"Probable premium labels Bloom filter is null on revision '%s'",
|
||||||
premiumList.getRevisionKey());
|
premiumList.getRevisionKey());
|
||||||
|
|
||||||
CheckResults checkResults = checkStatus(revision, label);
|
CheckResults checkResults = checkStatus(revision, label);
|
||||||
|
@ -144,7 +144,7 @@ public final class PremiumListUtils {
|
||||||
ImmutableMap<String, PremiumListEntry> premiumListEntries) {
|
ImmutableMap<String, PremiumListEntry> premiumListEntries) {
|
||||||
final Optional<PremiumList> oldPremiumList = PremiumList.get(premiumList.getName());
|
final Optional<PremiumList> oldPremiumList = PremiumList.get(premiumList.getName());
|
||||||
|
|
||||||
// Create the new revision (with its bloom filter) and parent the entries on it.
|
// Create the new revision (with its Bloom filter) and parent the entries on it.
|
||||||
final PremiumListRevision newRevision =
|
final PremiumListRevision newRevision =
|
||||||
PremiumListRevision.create(premiumList, premiumListEntries.keySet());
|
PremiumListRevision.create(premiumList, premiumListEntries.keySet());
|
||||||
final Key<PremiumListRevision> newRevisionKey = Key.create(newRevision);
|
final Key<PremiumListRevision> newRevisionKey = Key.create(newRevision);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class BloomFilterOfStringTranslatorFactory
|
||||||
Funnel<String> castedFunnel = (Funnel<String>) (Funnel<?>) unencodedCharsFunnel();
|
Funnel<String> castedFunnel = (Funnel<String>) (Funnel<?>) unencodedCharsFunnel();
|
||||||
return BloomFilter.readFrom(new ByteArrayInputStream(value.getBytes()), castedFunnel);
|
return BloomFilter.readFrom(new ByteArrayInputStream(value.getBytes()), castedFunnel);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException("Error loading bloom filter data", e);
|
throw new IllegalStateException("Error loading Bloom filter data", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class BloomFilterOfStringTranslatorFactory
|
||||||
try {
|
try {
|
||||||
value.writeTo(bos);
|
value.writeTo(bos);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException("Error saving bloom filter data", e);
|
throw new IllegalStateException("Error saving Bloom filter data", e);
|
||||||
}
|
}
|
||||||
return new Blob(bos.toByteArray());
|
return new Blob(bos.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class PremiumListUtilsTest {
|
||||||
.setLabel("missingno")
|
.setLabel("missingno")
|
||||||
.setPrice(Money.parse("USD 1000"))
|
.setPrice(Money.parse("USD 1000"))
|
||||||
.build());
|
.build());
|
||||||
// "missingno" shouldn't be in the bloom filter, thus it should return not premium without
|
// "missingno" shouldn't be in the Bloom filter, thus it should return not premium without
|
||||||
// attempting to load the entity that is actually present.
|
// attempting to load the entity that is actually present.
|
||||||
assertThat(getPremiumPrice("missingno", Registry.get("tld"))).isAbsent();
|
assertThat(getPremiumPrice("missingno", Registry.get("tld"))).isAbsent();
|
||||||
// However, if we manually query the cache to force an entity load, it should be found.
|
// However, if we manually query the cache to force an entity load, it should be found.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue