Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void main(String[] args) throws Exception
        public static void Main(string[] args)
        {
            // Just start and immediately close. The process spawning this subprocess will kill it in the middle of all this
            File file = new File(args[0]);

            using (FileSystemAbstraction fs = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                SingleFilePageSwapperFactory swapper = new SingleFilePageSwapperFactory();
                swapper.Open(fs, EMPTY);
                using (PageCache pageCache = new MuninnPageCache(swapper, 10, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, EmptyVersionContextSupplier.EMPTY, jobScheduler))
                {
                    fs.DeleteFile(file);
                    (new GBPTreeBuilder <>(pageCache, file, longLayout().build())).Build().Dispose();
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFitAsManyPagesAsItCan()
        public virtual void ShouldFitAsManyPagesAsItCan()
        {
            // Given
            long   pageCount = 60;
            long   memory    = MuninnPageCache.memoryRequiredForPages(pageCount);
            Config config    = Config.defaults(pagecache_memory, Convert.ToString(memory));

            // When
            ConfiguringPageCacheFactory factory = new ConfiguringPageCacheFactory(FsRule.get(), config, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, NullLog.Instance, EmptyVersionContextSupplier.EMPTY, _jobScheduler);

            // Then
            using (PageCache cache = factory.OrCreatePageCache)
            {
                assertThat(cache.PageSize(), equalTo(Org.Neo4j.Io.pagecache.PageCache_Fields.PAGE_SIZE));
                assertThat(cache.MaxCachedPages(), equalTo(pageCount));
            }
        }
Пример #3
0
        internal CommandPrimer(Random rng, MuninnPageCache cache, File[] files, IDictionary <File, PagedFile> fileMap, int filePageCount, int filePageSize, RecordFormat recordFormat)
        {
            this._rng           = rng;
            this._cache         = cache;
            this._files         = files;
            this._fileMap       = fileMap;
            this._filePageCount = filePageCount;
            this._filePageSize  = filePageSize;
            this._recordFormat  = recordFormat;
            _mappedFiles        = new List <File>();
            ((IList <File>)_mappedFiles).AddRange(fileMap.Keys);
            _filesTouched = new HashSet <File>();
            _filesTouched.addAll(_mappedFiles);
            _recordsWrittenTo = new Dictionary <File, IList <int> >();
            _recordsPerPage   = cache.PageSize() / recordFormat.RecordSize;
            _maxRecordCount   = filePageCount * _recordsPerPage;
            _recordLocks      = new TinyLockManager();

            foreach (File file in files)
            {
                _recordsWrittenTo[file] = new List <int>();
            }
        }
Пример #4
0
 protected internal override void Run(MuninnPageCache pageCache)
 {
     pageCache.ContinuouslySweepPages();
 }
Пример #5
0
 internal EvictionTask(MuninnPageCache pageCache) : base(pageCache)
 {
 }