mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Make all but one field on RegistryConfig static
The next step will be to get rid of RegistryConfig descendants and RegistryConfigLoader entirely. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143812815
This commit is contained in:
parent
7fba7c1e4f
commit
c5c74961bb
23 changed files with 224 additions and 324 deletions
|
@ -14,12 +14,13 @@
|
|||
|
||||
package google.registry.model.index;
|
||||
|
||||
import static google.registry.config.RegistryConfig.getEppResourceIndexBucketCount;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.VirtualEntity;
|
||||
|
@ -38,7 +39,7 @@ public class EppResourceIndexBucket extends ImmutableObject {
|
|||
* change the number of buckets and utilize a random distribution once we do.
|
||||
*/
|
||||
private static long getBucketIdFromEppResource(Key<? extends EppResource> resourceKey) {
|
||||
int numBuckets = RegistryEnvironment.get().config().getEppResourceIndexBucketCount();
|
||||
int numBuckets = getEppResourceIndexBucketCount();
|
||||
// IDs can't be 0, so add 1 to the hash.
|
||||
return Hashing.consistentHash(resourceKey.getName().hashCode(), numBuckets) + 1;
|
||||
}
|
||||
|
@ -56,8 +57,7 @@ public class EppResourceIndexBucket extends ImmutableObject {
|
|||
/** Returns the keys to all buckets. */
|
||||
public static Iterable<Key<EppResourceIndexBucket>> getAllBuckets() {
|
||||
ImmutableList.Builder<Key<EppResourceIndexBucket>> builder = new ImmutableList.Builder<>();
|
||||
int numBuckets = RegistryEnvironment.get().config().getEppResourceIndexBucketCount();
|
||||
for (int bucketId = 1; bucketId <= numBuckets; bucketId++) {
|
||||
for (int bucketId = 1; bucketId <= getEppResourceIndexBucketCount(); bucketId++) {
|
||||
builder.add(getBucketKey(bucketId));
|
||||
}
|
||||
return builder.build();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue