Ejemplo n.º 1
0
        /// <nodoc />
        public LocalCacheServer(
            IAbsFileSystem fileSystem,
            ILogger logger,
            string scenario,
            Func <AbsolutePath, ICache> cacheFactory,
            LocalServerConfiguration localContentServerConfiguration,
            Capabilities capabilities = Capabilities.All)
            : base(logger, fileSystem, scenario, cacheFactory, localContentServerConfiguration)
        {
            var storesByName = new Dictionary <string, IContentStore>();

            foreach (var kvp in localContentServerConfiguration.NamedCacheRoots)
            {
                AbsolutePath cacheRootPath = kvp.Value;
                fileSystem.CreateDirectory(cacheRootPath);

                var cache = cacheFactory(cacheRootPath);
                Contract.Assert(cache is IContentStore, $"Attempted to setup a cache named '{kvp.Key}' that is not an {nameof(IContentStore)} at path {cacheRootPath}, type used is {cache.GetType().Name}");

                storesByName.Add(kvp.Key, (IContentStore)cache);
            }

            _grpcContentServer = new GrpcContentServer(logger, capabilities, this, storesByName);
            _grpcCacheServer   = new GrpcCacheServer(logger, this);
        }
Ejemplo n.º 2
0
 /// <nodoc />
 public LocalContentServer(
     IAbsFileSystem fileSystem,
     ILogger logger,
     string scenario,
     Func <AbsolutePath, IContentStore> contentStoreFactory,
     LocalServerConfiguration localContentServerConfiguration)
     : base(logger, fileSystem, scenario, contentStoreFactory, localContentServerConfiguration)
 {
     _grpcContentServer = new GrpcContentServer(logger, Capabilities.ContentOnly, this, StoresByName, localContentServerConfiguration);
 }
Ejemplo n.º 3
0
 /// <nodoc />
 public LocalContentServer(
     IAbsFileSystem fileSystem,
     ILogger logger,
     string scenario,
     Func <AbsolutePath, IContentStore> contentStoreFactory,
     LocalServerConfiguration localContentServerConfiguration,
     IGrpcServiceEndpoint[]?additionalEndpoints = null,
     IColdStorage?coldStorage = null)
     : base(logger, fileSystem, scenario, contentStoreFactory, localContentServerConfiguration, additionalEndpoints)
 {
     GrpcContentServer = new GrpcContentServer(logger, Capabilities.ContentOnly, this, StoresByName, localContentServerConfiguration, coldStorage);
 }
Ejemplo n.º 4
0
        /// <nodoc />
        public LocalContentServer(
            IAbsFileSystem fileSystem,
            ILogger logger,
            string scenario,
            Func <AbsolutePath, IContentStore> contentStoreFactory,
            LocalServerConfiguration localContentServerConfiguration)
            : base(logger, fileSystem, scenario, contentStoreFactory, localContentServerConfiguration)
        {
            var nameByDrive = new Dictionary <string, string>();

            foreach (var kvp in localContentServerConfiguration.NamedCacheRoots)
            {
                nameByDrive.Add(kvp.Value.DriveLetter.ToString(), kvp.Key);
            }

            _grpcContentServer = new GrpcContentServer(logger, Capabilities.ContentOnly, this, nameByDrive, StoresByName);
        }
Ejemplo n.º 5
0
        /// <nodoc />
        public LocalCacheService(
            ILogger logger,
            IAbsFileSystem fileSystem,
            string scenario,
            Func <AbsolutePath, ICache> contentStoreFactory,
            LocalServerConfiguration localContentServerConfiguration,
            Capabilities capabilities = Capabilities.All)
            : base(logger, fileSystem, scenario, contentStoreFactory, localContentServerConfiguration)
        {
            var nameByDrive = new Dictionary <string, string>();

            foreach (var kvp in localContentServerConfiguration.NamedCacheRoots)
            {
                nameByDrive.Add(kvp.Value.DriveLetter.ToString(), kvp.Key);
            }

            // TODO: specify the right storeByName argument
            _grpcContentServer = new GrpcContentServer(logger, capabilities, this, nameByDrive, new Dictionary <string, IContentStore>());
            _grpcCacheServer   = new GrpcCacheServer(logger, this);
        }