/** * Retrieve config reader for the enforcer cache. * * @return the config reader. */ public CacheConfigReader enforcer() { return getCacheConfigReader("enforcer"); }
/** * Retrieve duration to wait for entity shard regions. * * @return Internal ask timeout duration. */ public Duration askTimeout() { return getIfPresent("ask-timeout", config::getDuration).orElse(DEFAULT_ASK_TIMEOUT); }
@Override public ActorRef startEnforcerActor(final ActorContext context, final ConciergeConfigReader configReader, final ActorRef pubSubMediator) { final Duration askTimeout = configReader.caches().askTimeout(); final ActorSystem actorSystem = context.system(); new ThingEnforcementIdCacheLoader(askTimeout, thingsShardRegionProxy); final Cache<EntityId, Entry<EntityId>> thingIdCache = CacheFactory.createCache(thingEnforcerIdCacheLoader, configReader.caches().id(), ID_CACHE_METRIC_NAME_PREFIX + ThingCommand.RESOURCE_TYPE, actorSystem.dispatchers().lookup("thing-id-cache-dispatcher")); new PolicyEnforcerCacheLoader(askTimeout, policiesShardRegionProxy); final Cache<EntityId, Entry<Enforcer>> policyEnforcerCache = CacheFactory.createCache(policyEnforcerCacheLoader, configReader.caches().enforcer(), ENFORCER_CACHE_METRIC_NAME_PREFIX + "policy", actorSystem.dispatchers().lookup("policy-enforcer-cache-dispatcher")); new AclEnforcerCacheLoader(askTimeout, thingsShardRegionProxy); final Cache<EntityId, Entry<Enforcer>> aclEnforcerCache = CacheFactory.createCache(aclEnforcerCacheLoader, configReader.caches().enforcer(), ENFORCER_CACHE_METRIC_NAME_PREFIX + "acl", actorSystem.dispatchers().lookup("acl-enforcer-cache-dispatcher")); final Duration activityCheckInterval = configReader.caches().id().expireAfterWrite(); final ActorRef conciergeForwarder = getInternalConciergeForwarder(context, configReader, pubSubMediator); final Executor enforcerExecutor = actorSystem.dispatchers().lookup(ENFORCER_DISPATCHER);
/** * Retrieve configuration reader of caches. * * @return the configuration reader. */ public CachesConfigReader caches() { return new CachesConfigReader(getChild(PATH_CACHES)); }
private CacheConfigReader getCacheConfigReader(final String childPath) { return new CacheConfigReader(getChild(childPath)); }
/** * Retrieve configuration reader of caches. * * @return the configuration reader. */ public CachesConfigReader caches() { return new CachesConfigReader(getChild(PATH_CACHES)); }
private CacheConfigReader getCacheConfigReader(final String childPath) { return CacheConfigReader.newInstance(getChild(childPath)); }
/** * Retrieve config reader for the id cache. * * @return the config reader. */ public CacheConfigReader id() { return getCacheConfigReader("id"); }
/** * Retrieve duration to wait for entity shard regions. * * @return Internal ask timeout duration. */ public Duration askTimeout() { return getIfPresent("ask-timeout", config::getDuration).orElse(DEFAULT_ASK_TIMEOUT); }
/** * Retrieve config reader for the enforcer cache. * * @return the config reader. */ public CacheConfigReader enforcer() { return getCacheConfigReader("enforcer"); }
/** * Retrieve config reader for the id cache. * * @return the config reader. */ public CacheConfigReader id() { return getCacheConfigReader("id"); }