示例#1
0
        public static QuotaKeeper Create(
            IAbsFileSystem fileSystem,
            ContentStoreInternalTracer tracer,
            CancellationToken token,
            IContentStoreInternal store,
            QuotaKeeperConfiguration configuration)
        {
            Contract.RequiresNotNull(fileSystem);
            Contract.RequiresNotNull(tracer);
            Contract.RequiresNotNull(configuration);

            return(new QuotaKeeper(fileSystem, tracer, configuration, token, store));
        }
示例#2
0
        /// <nodoc />
        public LegacyQuotaKeeper(
            IAbsFileSystem fileSystem,
            ContentStoreInternalTracer tracer,
            QuotaKeeperConfiguration configuration,
            CancellationToken token,
            IContentStoreInternal store)
            : base(configuration)
        {
            _tracer       = tracer;
            _size         = configuration.ContentDirectorySize;
            _token        = token;
            _store        = store;
            _reserveQueue = new BlockingCollection <Request <QuotaKeeperRequest, string> >();

            _rules = CreateRules(fileSystem, configuration, store);
        }
示例#3
0
        /// <nodoc />
        public LegacyQuotaKeeper(
            IAbsFileSystem fileSystem,
            ContentStoreInternalTracer tracer,
            ContentStoreConfiguration configuration,
            long startSize,
            CancellationToken token,
            IContentStoreInternal store,
            DistributedEvictionSettings distributedEvictionSettings = null)
        {
            _tracer       = tracer;
            _size         = startSize;
            _token        = token;
            _store        = store;
            _reserveQueue = new BlockingCollection <Request <QuotaKeeperRequest, string> >();

            _rules = CreateRules(fileSystem, configuration, store, distributedEvictionSettings);
        }
示例#4
0
        /// <nodoc />
        public static QuotaKeeper Create(
            IAbsFileSystem fileSystem,
            ContentStoreInternalTracer tracer,
            CancellationToken token,
            IContentStoreInternal store,
            QuotaKeeperConfiguration configuration)
        {
            Contract.Requires(fileSystem != null);
            Contract.Requires(tracer != null);
            Contract.Requires(configuration != null);

            if (configuration.UseLegacyQuotaKeeper)
            {
                return(new LegacyQuotaKeeper(fileSystem, tracer, configuration, token, store));
            }

            return(new QuotaKeeperV2(fileSystem, tracer, configuration, token, store));
        }
示例#5
0
 public QuotaKeeper(
     IAbsFileSystem fileSystem,
     ContentStoreInternalTracer tracer,
     QuotaKeeperConfiguration configuration,
     CancellationToken token,
     IContentStoreInternal store)
 {
     _contentStoreTracer = tracer;
     _tracer             = new Tracer(name: Component);
     _allContentSize     = configuration.ContentDirectorySize;
     _token         = token;
     _store         = store;
     _reserveQueue  = new BlockingCollection <QuotaRequest>();
     _evictionQueue = new ConcurrentQueue <ReserveSpaceRequest>();
     _distributedEvictionSettings = configuration.DistributedEvictionSettings;
     _rules   = CreateRules(fileSystem, configuration, store);
     Counters = new CounterCollection <QuotaKeeperCounters>();
 }
示例#6
0
 public QuotaKeeper(
     IAbsFileSystem fileSystem,
     ContentStoreInternalTracer tracer,
     QuotaKeeperConfiguration configuration,
     CancellationToken token,
     FileSystemContentStoreInternal store,
     IDistributedLocationStore?distributedStore)
 {
     _contentStoreTracer = tracer;
     Tracer            = new Tracer(name: $"{Component}({store.RootPath})");
     _allContentSize   = configuration.ContentDirectorySize;
     _token            = token;
     _store            = store;
     _distributedStore = distributedStore;
     _reserveQueue     = new BlockingCollection <QuotaRequest>();
     _evictionQueue    = new ConcurrentQueue <ReserveSpaceRequest>();
     _rules            = CreateRules(fileSystem, configuration, store);
     Counters          = new CounterCollection <QuotaKeeperCounters>();
 }
示例#7
0
        /// <nodoc />
        public static QuotaKeeper Create(
            IAbsFileSystem fileSystem,
            ContentStoreInternalTracer tracer,
            ContentStoreConfiguration configuration,
            long startSize,
            CancellationToken token,
            IContentStoreInternal store,
            DistributedEvictionSettings distributedEvictionSettings = null,
            bool useLegacyQuotaKeeper = false)
        {
            Contract.Requires(fileSystem != null);
            Contract.Requires(tracer != null);
            Contract.Requires(configuration != null);

            if (useLegacyQuotaKeeper)
            {
                return(new LegacyQuotaKeeper(fileSystem, tracer, configuration, startSize, token, store, distributedEvictionSettings));
            }

            return(new QuotaKeeperV2(fileSystem, tracer, configuration, startSize, token, store, distributedEvictionSettings));
        }