Search in sources :

Example 1 with AccountStatsStore

use of com.github.ambry.accountstats.AccountStatsStore in project ambry by linkedin.

the class FrontendRestRequestServiceFactory method getRestRequestService.

/**
 * Returns a new instance of {@link FrontendRestRequestService}.
 * @return a new instance of {@link FrontendRestRequestService}.
 */
@Override
public RestRequestService getRestRequestService() {
    try {
        IdSigningService idSigningService = Utils.<IdSigningServiceFactory>getObj(frontendConfig.idSigningServiceFactory, verifiableProperties, clusterMap.getMetricRegistry()).getIdSigningService();
        NamedBlobDb namedBlobDb = Utils.isNullOrEmpty(frontendConfig.namedBlobDbFactory) ? null : Utils.<NamedBlobDbFactory>getObj(frontendConfig.namedBlobDbFactory, verifiableProperties, clusterMap.getMetricRegistry(), accountService).getNamedBlobDb();
        IdConverterFactory idConverterFactory = Utils.getObj(frontendConfig.idConverterFactory, verifiableProperties, clusterMap.getMetricRegistry(), idSigningService, namedBlobDb);
        UrlSigningService urlSigningService = Utils.<UrlSigningServiceFactory>getObj(frontendConfig.urlSigningServiceFactory, verifiableProperties, clusterMap.getMetricRegistry()).getUrlSigningService();
        AccountAndContainerInjector accountAndContainerInjector = new AccountAndContainerInjector(accountService, frontendMetrics, frontendConfig);
        AccountStatsStore accountStatsStore = Utils.<AccountStatsStoreFactory>getObj(frontendConfig.accountStatsStoreFactory, verifiableProperties, clusterMapConfig, clusterMap.getMetricRegistry()).getAccountStatsStore();
        QuotaConfig quotaConfig = new QuotaConfig(verifiableProperties);
        QuotaManager quotaManager = ((QuotaManagerFactory) Utils.getObj(quotaConfig.quotaManagerFactory, quotaConfig, new SimpleQuotaRecommendationMergePolicy(quotaConfig), accountService, accountStatsStore, clusterMap.getMetricRegistry())).getQuotaManager();
        SecurityServiceFactory securityServiceFactory = Utils.getObj(frontendConfig.securityServiceFactory, verifiableProperties, clusterMap, accountService, urlSigningService, idSigningService, accountAndContainerInjector, quotaManager);
        return new FrontendRestRequestService(frontendConfig, frontendMetrics, router, clusterMap, idConverterFactory, securityServiceFactory, urlSigningService, idSigningService, namedBlobDb, accountService, accountAndContainerInjector, clusterMapConfig.clusterMapDatacenterName, clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapClusterName, accountStatsStore, quotaManager);
    } catch (Exception e) {
        throw new IllegalStateException("Could not instantiate FrontendRestRequestService", e);
    }
}
Also used : NamedBlobDb(com.github.ambry.named.NamedBlobDb) AccountStatsStore(com.github.ambry.accountstats.AccountStatsStore) QuotaManagerFactory(com.github.ambry.quota.QuotaManagerFactory) NamedBlobDbFactory(com.github.ambry.named.NamedBlobDbFactory) QuotaConfig(com.github.ambry.config.QuotaConfig) SimpleQuotaRecommendationMergePolicy(com.github.ambry.quota.SimpleQuotaRecommendationMergePolicy) QuotaManager(com.github.ambry.quota.QuotaManager)

Example 2 with AccountStatsStore

use of com.github.ambry.accountstats.AccountStatsStore in project ambry by linkedin.

the class AmbryCUQuotaEnforcerFactoryTest method testGetRequestQuotaEnforcer.

@Test
public void testGetRequestQuotaEnforcer() throws IOException {
    QuotaConfig quotaConfig = new QuotaConfig(new VerifiableProperties(new Properties()));
    QuotaSource quotaSource = new AmbryCUQuotaSource(quotaConfig, Mockito.mock(AccountService.class));
    AccountStatsStore mockAccountStatsStore = Mockito.mock(AccountStatsStore.class);
    AmbryCUQuotaEnforcerFactory ambryCUQuotaEnforcerFactory = new AmbryCUQuotaEnforcerFactory(quotaConfig, quotaSource, mockAccountStatsStore);
    Assert.assertEquals(AmbryCUQuotaEnforcer.class, ambryCUQuotaEnforcerFactory.getQuotaEnforcer().getClass());
}
Also used : QuotaSource(com.github.ambry.quota.QuotaSource) VerifiableProperties(com.github.ambry.config.VerifiableProperties) QuotaConfig(com.github.ambry.config.QuotaConfig) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties) AccountService(com.github.ambry.account.AccountService) AccountStatsStore(com.github.ambry.accountstats.AccountStatsStore) Test(org.junit.Test)

Aggregations

AccountStatsStore (com.github.ambry.accountstats.AccountStatsStore)2 QuotaConfig (com.github.ambry.config.QuotaConfig)2 AccountService (com.github.ambry.account.AccountService)1 VerifiableProperties (com.github.ambry.config.VerifiableProperties)1 NamedBlobDb (com.github.ambry.named.NamedBlobDb)1 NamedBlobDbFactory (com.github.ambry.named.NamedBlobDbFactory)1 QuotaManager (com.github.ambry.quota.QuotaManager)1 QuotaManagerFactory (com.github.ambry.quota.QuotaManagerFactory)1 QuotaSource (com.github.ambry.quota.QuotaSource)1 SimpleQuotaRecommendationMergePolicy (com.github.ambry.quota.SimpleQuotaRecommendationMergePolicy)1 Properties (java.util.Properties)1 Test (org.junit.Test)1