diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-01-10 19:40:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 19:40:25 +0100 |
commit | b496bdc14a9786efdbe00e1ed45a70fec1b73241 (patch) | |
tree | 3ee71fd0477c6acc5ad3d51d9c28d561819fe562 /configserver | |
parent | 3504451650259601f0f1c2dfdf8c406253e02aab (diff) | |
parent | 9195a7ac15d975df8c8f8bef2fc6ce82c2ff3e12 (diff) |
Merge pull request #15977 from vespa-engine/hmusum/remove-unnecessary-component
Remove unnecessary component
Diffstat (limited to 'configserver')
12 files changed, 31 insertions, 90 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/GlobalComponentRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/GlobalComponentRegistry.java index 1eb18773898..454366e8fae 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/GlobalComponentRegistry.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/GlobalComponentRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server; import com.yahoo.cloud.config.ConfigserverConfig; @@ -9,7 +9,6 @@ import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.Zone; import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; -import com.yahoo.vespa.config.server.host.HostRegistries; import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.session.SessionPreparer; @@ -38,7 +37,6 @@ public interface GlobalComponentRegistry { ReloadListener getReloadListener(); ConfigDefinitionRepo getStaticConfigDefinitionRepo(); PermanentApplicationPackage getPermanentApplicationPackage(); - HostRegistries getHostRegistries(); ModelFactoryRegistry getModelFactoryRegistry(); Optional<Provisioner> getHostProvisioner(); Zone getZone(); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistry.java index 9badd19009f..ce0641a7b47 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistry.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server; import com.google.inject.Inject; @@ -11,7 +11,6 @@ import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.Zone; import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; -import com.yahoo.vespa.config.server.host.HostRegistries; import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.provision.HostProvisionerProvider; @@ -44,7 +43,6 @@ public class InjectedGlobalComponentRegistry implements GlobalComponentRegistry private final ConfigserverConfig configserverConfig; private final ConfigDefinitionRepo staticConfigDefinitionRepo; private final PermanentApplicationPackage permanentApplicationPackage; - private final HostRegistries hostRegistries; private final Optional<Provisioner> hostProvisioner; private final Zone zone; private final ConfigServerDB configServerDB; @@ -62,10 +60,8 @@ public class InjectedGlobalComponentRegistry implements GlobalComponentRegistry SessionPreparer sessionPreparer, RpcServer rpcServer, ConfigserverConfig configserverConfig, - SuperModelGenerationCounter superModelGenerationCounter, ConfigDefinitionRepo staticConfigDefinitionRepo, PermanentApplicationPackage permanentApplicationPackage, - HostRegistries hostRegistries, HostProvisionerProvider hostProvisionerProvider, Zone zone, ConfigServerDB configServerDB, @@ -80,7 +76,6 @@ public class InjectedGlobalComponentRegistry implements GlobalComponentRegistry this.configserverConfig = configserverConfig; this.staticConfigDefinitionRepo = staticConfigDefinitionRepo; this.permanentApplicationPackage = permanentApplicationPackage; - this.hostRegistries = hostRegistries; this.hostProvisioner = hostProvisionerProvider.getHostProvisioner(); this.zone = zone; this.configServerDB = configServerDB; @@ -109,8 +104,6 @@ public class InjectedGlobalComponentRegistry implements GlobalComponentRegistry @Override public PermanentApplicationPackage getPermanentApplicationPackage() { return permanentApplicationPackage; } @Override - public HostRegistries getHostRegistries() { return hostRegistries; } - @Override public ModelFactoryRegistry getModelFactoryRegistry() { return modelFactoryRegistry; } @Override diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java index 5a34217dbdd..2616f270bf8 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java @@ -27,7 +27,6 @@ import com.yahoo.vespa.curator.Curator; import com.yahoo.vespa.curator.Lock; import com.yahoo.vespa.curator.transaction.CuratorTransaction; import org.apache.curator.framework.CuratorFramework; -import org.apache.curator.framework.recipes.cache.ChildData; import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; import java.nio.file.Files; @@ -96,7 +95,7 @@ public class TenantApplications implements RequestHandler, HostValidator<Applica componentRegistry.getMetrics(), componentRegistry.getReloadListener(), componentRegistry.getConfigserverConfig(), - componentRegistry.getHostRegistries().createApplicationHostRegistry(tenantName), + new HostRegistry<>(), new TenantFileSystemDirs(componentRegistry.getConfigServerDB(), tenantName), componentRegistry.getClock()); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/host/HostRegistries.java b/configserver/src/main/java/com/yahoo/vespa/config/server/host/HostRegistries.java deleted file mode 100644 index c25ab0315a3..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/host/HostRegistries.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.host; - -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.TenantName; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Component to hold host registries. - * - * @author hmusum - */ -public class HostRegistries { - - private final HostRegistry<TenantName> tenantHostRegistry = new HostRegistry<>(); - private final Map<TenantName, HostRegistry<ApplicationId>> applicationHostRegistries = new ConcurrentHashMap<>(); - - public HostRegistry<TenantName> getTenantHostRegistry() { - return tenantHostRegistry; - } - - public HostRegistry<ApplicationId> getApplicationHostRegistry(TenantName tenant) { - return applicationHostRegistries.get(tenant); - } - - public HostRegistry<ApplicationId> createApplicationHostRegistry(TenantName tenant) { - HostRegistry<ApplicationId> applicationIdHostRegistry = new HostRegistry<>(); - applicationHostRegistries.put(tenant, applicationIdHostRegistry); - return applicationIdHostRegistry; - } - -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java index e64859e7267..8e589537ced 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java @@ -34,7 +34,6 @@ import com.yahoo.vespa.config.server.RequestHandler; import com.yahoo.vespa.config.server.SuperModelRequestHandler; import com.yahoo.vespa.config.server.application.ApplicationSet; import com.yahoo.vespa.config.server.filedistribution.FileServer; -import com.yahoo.vespa.config.server.host.HostRegistries; import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.monitoring.MetricUpdater; import com.yahoo.vespa.config.server.monitoring.MetricUpdaterFactory; @@ -122,7 +121,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { */ @Inject public RpcServer(ConfigserverConfig config, SuperModelRequestHandler superModelRequestHandler, - MetricUpdaterFactory metrics, HostRegistries hostRegistries, + MetricUpdaterFactory metrics, HostRegistry<TenantName> hostRegistry, HostLivenessTracker hostLivenessTracker, FileServer fileServer, RpcAuthorizer rpcAuthorizer, RpcRequestHandlerProvider handlerProvider) { this.superModelRequestHandler = superModelRequestHandler; @@ -136,7 +135,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { 0, TimeUnit.SECONDS, workQueue, ThreadFactoryFactory.getDaemonThreadFactory(THREADPOOL_NAME)); delayedConfigResponses = new DelayedConfigResponses(this, config.numDelayedResponseThreads()); spec = new Spec(null, config.rpcport()); - hostRegistry = hostRegistries.getTenantHostRegistry(); + this.hostRegistry = hostRegistry; this.useRequestVersion = config.useVespaVersionInRequest(); this.hostedVespa = config.hostedVespa(); this.canReturnEmptySentinelConfig = config.canReturnEmptySentinelConfig(); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/DefaultRpcAuthorizerProvider.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/DefaultRpcAuthorizerProvider.java index 8d1d4f58e37..5e2eb56c542 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/DefaultRpcAuthorizerProvider.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/DefaultRpcAuthorizerProvider.java @@ -1,12 +1,13 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.rpc.security; import com.google.inject.Inject; import com.yahoo.cloud.config.ConfigserverConfig; +import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.security.NodeIdentifier; import com.yahoo.container.di.componentgraph.Provider; import com.yahoo.security.tls.TransportSecurityUtils; -import com.yahoo.vespa.config.server.host.HostRegistries; +import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.rpc.RequestHandlerProvider; /** @@ -21,13 +22,13 @@ public class DefaultRpcAuthorizerProvider implements Provider<RpcAuthorizer> { @Inject public DefaultRpcAuthorizerProvider(ConfigserverConfig config, NodeIdentifier nodeIdentifier, - HostRegistries hostRegistries, + HostRegistry<TenantName> hostRegistry, RequestHandlerProvider handlerProvider) { boolean useMultiTenantAuthorizer = TransportSecurityUtils.isTransportSecurityEnabled() && config.multitenant() && config.hostedVespa(); this.rpcAuthorizer = useMultiTenantAuthorizer - ? new MultiTenantRpcAuthorizer(nodeIdentifier, hostRegistries, handlerProvider, getThreadPoolSize(config)) + ? new MultiTenantRpcAuthorizer(nodeIdentifier, hostRegistry, handlerProvider, getThreadPoolSize(config)) : new NoopRpcAuthorizer(); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizer.java index 49a8df3d0e4..9e2ea0b34c3 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizer.java @@ -1,4 +1,4 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.rpc.security; import com.yahoo.cloud.config.SentinelConfig; @@ -16,7 +16,6 @@ import com.yahoo.security.tls.TransportSecurityUtils; import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3; import com.yahoo.vespa.config.server.RequestHandler; -import com.yahoo.vespa.config.server.host.HostRegistries; import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.rpc.RequestHandlerProvider; @@ -34,7 +33,6 @@ import java.util.logging.Logger; import static com.yahoo.vespa.config.server.rpc.security.AuthorizationException.Type; import static com.yahoo.yolean.Exceptions.throwUnchecked; - /** * A {@link RpcAuthorizer} that perform access control for configserver RPC methods when TLS and multi-tenant mode are enabled. * @@ -50,11 +48,11 @@ public class MultiTenantRpcAuthorizer implements RpcAuthorizer { private final Executor executor; public MultiTenantRpcAuthorizer(NodeIdentifier nodeIdentifier, - HostRegistries hostRegistries, + HostRegistry<TenantName> hostRegistry, RequestHandlerProvider handlerProvider, int threadPoolSize) { this(nodeIdentifier, - hostRegistries.getTenantHostRegistry(), + hostRegistry, handlerProvider, Executors.newFixedThreadPool(threadPoolSize, new DaemonThreadFactory("multi-tenant-rpc-authorizer-"))); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java index 5c15b72eaac..471b1b15920 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.tenant; import com.google.common.collect.ImmutableSet; @@ -14,6 +14,7 @@ import com.yahoo.transaction.Transaction; import com.yahoo.vespa.config.server.GlobalComponentRegistry; import com.yahoo.vespa.config.server.application.TenantApplications; import com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs; +import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.monitoring.MetricUpdater; import com.yahoo.vespa.config.server.session.SessionRepository; import com.yahoo.vespa.curator.Curator; @@ -228,7 +229,7 @@ public class TenantRepository { componentRegistry.getMetrics(), componentRegistry.getReloadListener(), componentRegistry.getConfigserverConfig(), - componentRegistry.getHostRegistries().createApplicationHostRegistry(tenantName), + new HostRegistry<>(), new TenantFileSystemDirs(componentRegistry.getConfigServerDB(), tenantName), componentRegistry.getClock()); SessionRepository sessionRepository = new SessionRepository(tenantName, diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java index bf54c2b309e..2be18674e44 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java @@ -8,12 +8,12 @@ import com.yahoo.config.provision.Zone; import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.filedistribution.FileServer; import com.yahoo.vespa.config.server.host.ConfigRequestHostLivenessTracker; -import com.yahoo.vespa.config.server.host.HostRegistries; +import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.provision.HostProvisionerProvider; -import com.yahoo.vespa.config.server.rpc.RpcServer; import com.yahoo.vespa.config.server.rpc.RpcRequestHandlerProvider; +import com.yahoo.vespa.config.server.rpc.RpcServer; import com.yahoo.vespa.config.server.rpc.security.NoopRpcAuthorizer; import com.yahoo.vespa.config.server.session.SessionPreparer; import com.yahoo.vespa.config.server.session.SessionTest; @@ -46,7 +46,6 @@ public class InjectedGlobalComponentRegistryTest { private RpcServer rpcServer; private ConfigDefinitionRepo defRepo; private PermanentApplicationPackage permanentApplicationPackage; - private HostRegistries hostRegistries; private GlobalComponentRegistry globalComponentRegistry; private ModelFactoryRegistry modelFactoryRegistry; private Zone zone; @@ -66,18 +65,16 @@ public class InjectedGlobalComponentRegistryTest { .configDefinitionsDir(temporaryFolder.newFolder("configdefinitions").getAbsolutePath())); sessionPreparer = new SessionTest.MockSessionPreparer(); rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(), - new HostRegistries(), new ConfigRequestHostLivenessTracker(), + new HostRegistry<>(), new ConfigRequestHostLivenessTracker(), new FileServer(temporaryFolder.newFolder("filereferences")), new NoopRpcAuthorizer(), new RpcRequestHandlerProvider()); - SuperModelGenerationCounter generationCounter = new SuperModelGenerationCounter(curator); defRepo = new StaticConfigDefinitionRepo(); permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig); - hostRegistries = new HostRegistries(); HostProvisionerProvider hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new MockProvisioner()); zone = Zone.defaultZone(); globalComponentRegistry = new InjectedGlobalComponentRegistry(curator, configCurator, metrics, modelFactoryRegistry, sessionPreparer, rpcServer, configserverConfig, - generationCounter, defRepo, permanentApplicationPackage, hostRegistries, hostProvisionerProvider, zone, + defRepo, permanentApplicationPackage, hostProvisionerProvider, zone, new ConfigServerDB(configserverConfig), new InMemoryFlagSource(), new MockSecretStore()); } @@ -92,7 +89,6 @@ public class InjectedGlobalComponentRegistryTest { assertThat(globalComponentRegistry.getTenantListener().hashCode(), is(rpcServer.hashCode())); assertThat(globalComponentRegistry.getStaticConfigDefinitionRepo(), is(defRepo)); assertThat(globalComponentRegistry.getPermanentApplicationPackage(), is(permanentApplicationPackage)); - assertThat(globalComponentRegistry.getHostRegistries(), is(hostRegistries)); assertThat(globalComponentRegistry.getZone(), is (zone)); assertTrue(globalComponentRegistry.getHostProvisioner().isPresent()); } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java b/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java index e6652c3c5e1..3bc68533d02 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server; import com.yahoo.cloud.config.ConfigserverConfig; @@ -12,12 +12,11 @@ import com.yahoo.config.provision.Zone; import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.application.TenantApplicationsTest; -import com.yahoo.vespa.config.server.host.HostRegistries; +import com.yahoo.vespa.config.server.filedistribution.FileDistributionFactory; +import com.yahoo.vespa.config.server.filedistribution.MockFileDistributionFactory; import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.provision.HostProvisionerProvider; -import com.yahoo.vespa.config.server.filedistribution.FileDistributionFactory; -import com.yahoo.vespa.config.server.filedistribution.MockFileDistributionFactory; import com.yahoo.vespa.config.server.session.SessionPreparer; import com.yahoo.vespa.config.server.tenant.MockTenantListener; import com.yahoo.vespa.config.server.tenant.TenantListener; @@ -50,7 +49,6 @@ public class TestComponentRegistry implements GlobalComponentRegistry { private final ReloadListener reloadListener; private final TenantListener tenantListener; private final PermanentApplicationPackage permanentApplicationPackage; - private final HostRegistries hostRegistries; private final FileDistributionFactory fileDistributionFactory; private final ModelFactoryRegistry modelFactoryRegistry; private final Optional<Provisioner> hostProvisioner; @@ -66,7 +64,6 @@ public class TestComponentRegistry implements GlobalComponentRegistry { ModelFactoryRegistry modelFactoryRegistry, PermanentApplicationPackage permanentApplicationPackage, FileDistributionFactory fileDistributionFactory, - HostRegistries hostRegistries, ConfigserverConfig configserverConfig, SessionPreparer sessionPreparer, Optional<Provisioner> hostProvisioner, @@ -85,7 +82,6 @@ public class TestComponentRegistry implements GlobalComponentRegistry { this.tenantListener = tenantListener; this.defRepo = defRepo; this.permanentApplicationPackage = permanentApplicationPackage; - this.hostRegistries = hostRegistries; this.fileDistributionFactory = fileDistributionFactory; this.modelFactoryRegistry = modelFactoryRegistry; this.hostProvisioner = hostProvisioner; @@ -112,7 +108,6 @@ public class TestComponentRegistry implements GlobalComponentRegistry { private ReloadListener reloadListener = new TenantApplicationsTest.MockReloadListener(); private final MockTenantListener tenantListener = new MockTenantListener(); private Optional<PermanentApplicationPackage> permanentApplicationPackage = Optional.empty(); - private final HostRegistries hostRegistries = new HostRegistries(); private final Optional<FileDistributionFactory> fileDistributionFactory = Optional.empty(); private ModelFactoryRegistry modelFactoryRegistry = new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry()))); private Optional<Provisioner> hostProvisioner = Optional.empty(); @@ -188,7 +183,7 @@ public class TestComponentRegistry implements GlobalComponentRegistry { configserverConfig, defRepo, curator, zone, flagSource, secretStore); return new TestComponentRegistry(curator, ConfigCurator.create(curator), metrics, modelFactoryRegistry, - permApp, fileDistributionProvider, hostRegistries, configserverConfig, + permApp, fileDistributionProvider, configserverConfig, sessionPreparer, hostProvisioner, defRepo, reloadListener, tenantListener, zone, clock, secretStore, flagSource); } @@ -213,8 +208,6 @@ public class TestComponentRegistry implements GlobalComponentRegistry { @Override public PermanentApplicationPackage getPermanentApplicationPackage() { return permanentApplicationPackage; } @Override - public HostRegistries getHostRegistries() { return hostRegistries;} - @Override public ModelFactoryRegistry getModelFactoryRegistry() { return modelFactoryRegistry; } @Override public Optional<Provisioner> getHostProvisioner() { diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpcServer.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpcServer.java index 7f4733f0b7c..6db2e8006ed 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpcServer.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpcServer.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.rpc; import com.yahoo.cloud.config.ConfigserverConfig; @@ -8,7 +8,7 @@ import com.yahoo.vespa.config.protocol.JRTServerConfigRequest; import com.yahoo.vespa.config.server.GetConfigContext; import com.yahoo.vespa.config.server.filedistribution.FileServer; import com.yahoo.vespa.config.server.host.ConfigRequestHostLivenessTracker; -import com.yahoo.vespa.config.server.host.HostRegistries; +import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.rpc.security.NoopRpcAuthorizer; @@ -37,7 +37,7 @@ public class MockRpcServer extends RpcServer { super(createConfig(port), null, Metrics.createTestMetrics(), - new HostRegistries(), + new HostRegistry<>(), new ConfigRequestHostLivenessTracker(), new FileServer(tempDir), new NoopRpcAuthorizer(), diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/RpcTester.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/RpcTester.java index 2b2ed13fcfe..c044978ab42 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/RpcTester.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/RpcTester.java @@ -24,7 +24,7 @@ import com.yahoo.vespa.config.server.TestConfigDefinitionRepo; import com.yahoo.vespa.config.server.application.OrchestratorMock; import com.yahoo.vespa.config.server.filedistribution.FileServer; import com.yahoo.vespa.config.server.host.ConfigRequestHostLivenessTracker; -import com.yahoo.vespa.config.server.host.HostRegistries; +import com.yahoo.vespa.config.server.host.HostRegistry; import com.yahoo.vespa.config.server.monitoring.Metrics; import com.yahoo.vespa.config.server.rpc.security.NoopRpcAuthorizer; import com.yahoo.vespa.config.server.tenant.Tenant; @@ -61,7 +61,6 @@ public class RpcTester implements AutoCloseable { private RpcServer rpcServer; private Thread t; private Supervisor sup; - private final ApplicationId applicationId; private final TenantName tenantName; private final TenantRepository tenantRepository; @@ -76,7 +75,6 @@ public class RpcTester implements AutoCloseable { RpcTester(ApplicationId applicationId, TemporaryFolder temporaryFolder, ConfigserverConfig.Builder configBuilder) throws InterruptedException, IOException { this.temporaryFolder = temporaryFolder; - this.applicationId = applicationId; this.tenantName = applicationId.tenant(); int port = allocatePort(); spec = createSpec(port); @@ -114,9 +112,8 @@ public class RpcTester implements AutoCloseable { } void createAndStartRpcServer() throws IOException { - HostRegistries hostRegistries = new HostRegistries(); - hostRegistries.createApplicationHostRegistry(tenantName).update(applicationId, List.of("localhost")); - hostRegistries.getTenantHostRegistry().update(tenantName, List.of("localhost")); + HostRegistry<TenantName> hostRegistry = new HostRegistry<>(); + hostRegistry.update(tenantName, List.of("localhost")); rpcServer = new RpcServer(configserverConfig, new SuperModelRequestHandler(new TestConfigDefinitionRepo(), configserverConfig, @@ -126,7 +123,7 @@ public class RpcTester implements AutoCloseable { generationCounter, new InMemoryFlagSource())), Metrics.createTestMetrics(), - hostRegistries, + hostRegistry, hostLivenessTracker, new FileServer(temporaryFolder.newFolder()), new NoopRpcAuthorizer(), |