private StartupShutdownBase CreateLocalServer(LocalServerConfiguration localServerConfiguration, DistributedContentSettings distributedSettings = null) { var resolvedCacheSettings = DistributedContentStoreFactory.ResolveCacheSettingsInPrecedenceOrder(_arguments); Func <AbsolutePath, IContentStore> contentStoreFactory = path => DistributedContentStoreFactory.CreateLocalContentStore( distributedSettings, _arguments, resolvedCacheSettings.Where(s => s.ResolvedCacheRootPath == path || s.ResolvedCacheRootPath.Path.StartsWith(path.Path, StringComparison.OrdinalIgnoreCase)).Single()); if (distributedSettings?.EnableMetadataStore == true) { _logger.Always("Creating local server with content and metadata store"); var factory = CreateDistributedContentStoreFactory(); Func <AbsolutePath, ICache> cacheFactory = path => { var distributedCache = new OneLevelCache( contentStoreFunc: () => contentStoreFactory(path), memoizationStoreFunc: () => CreateServerSideLocalMemoizationStore(path, factory), Guid.NewGuid(), passContentToMemoization: true); ICache cacheToReturn = distributedCache; #if MICROSOFT_INTERNAL if (distributedSettings.EnablePublishingCache) { cacheToReturn = new PublishingCache <OneLevelCache>( local: distributedCache, remote: new BuildCachePublishingStore(contentSource: distributedCache, _fileSystem, distributedSettings.PublishingConcurrencyLimit), Guid.NewGuid()); } #endif return(cacheToReturn); }; return(new LocalCacheServer( _fileSystem, _logger, _arguments.Configuration.LocalCasSettings.ServiceSettings.ScenarioName, cacheFactory, localServerConfiguration, capabilities: distributedSettings.EnablePublishingCache?Capabilities.All: Capabilities.AllNonPublishing)); } else { _logger.Always("Creating local server with content store only"); return(new LocalContentServer( _fileSystem, _logger, _arguments.Configuration.LocalCasSettings.ServiceSettings.ScenarioName, contentStoreFactory, localServerConfiguration)); } }
private StartupShutdownBase CreateLocalServer(LocalServerConfiguration localServerConfiguration, DistributedContentSettings distributedSettings = null) { var resolvedCacheSettings = DistributedContentStoreFactory.ResolveCacheSettingsInPrecedenceOrder(_arguments); Func <AbsolutePath, IContentStore> contentStoreFactory = path => DistributedContentStoreFactory.CreateLocalContentStore( distributedSettings, _arguments, resolvedCacheSettings.Where(s => s.ResolvedCacheRootPath == path || s.ResolvedCacheRootPath.Path.StartsWith(path.Path, StringComparison.OrdinalIgnoreCase)).Single()); if (distributedSettings?.EnableMetadataStore == true) { var factory = CreateDistributedContentStoreFactory(); Func <AbsolutePath, ICache> cacheFactory = path => { return(new OneLevelCache( contentStoreFunc: () => contentStoreFactory(path), memoizationStoreFunc: () => CreateServerSideLocalMemoizationStore(path, factory), Guid.NewGuid(), passContentToMemoization: true)); }; return(new LocalCacheServer( _fileSystem, _logger, _arguments.Configuration.LocalCasSettings.ServiceSettings.ScenarioName, cacheFactory, localServerConfiguration)); } else { return(new LocalContentServer( _fileSystem, _logger, _arguments.Configuration.LocalCasSettings.ServiceSettings.ScenarioName, contentStoreFactory, localServerConfiguration)); } }