예제 #1
0
        public KeyIndex(string filename, long keysFileLength, bool mmapFile)
        {
            _keyIndexReader = new BinaryFileReader(filename, mmapFile);
            long filelength = _keyIndexReader.BaseStream.Length;

            _keyIndexReader.Seek(-12, SeekOrigin.End);
            _numRecords = _keyIndexReader.ReadInt64();

            _keyGroupSize = _keyIndexReader.ReadUInt32();
            _numKeyGroups = _CalcNumKeyGroups(_numRecords, _keyGroupSize);

            _keysFileLength = keysFileLength;
        }
예제 #2
0
        public KeyCacheReader(string dbdir, uint keyGroupSize, bool mmapFiles)
        {
            _keyGroupSize = keyGroupSize;

            #if NAMEDPIPEMODE
            string file = dbdir + ":cache-index";
            _cacheIndexReader = new BinaryFileReader(file, mmapFiles);

            file = dbdir + ":cache";
            _cacheReader = new BinaryFileReader(file, mmapFiles);

            _bytesPerIndex = TMSNStoreUtils.BytesPerKeyIndexOffset;

            #else
            string file = Path.Combine(dbdir, "cache-index");
            _cacheIndexReader = new BinaryFileReader(file, mmapFiles);

            file = Path.Combine(dbdir, "cache");
            _cacheReader = new BinaryFileReader(file, mmapFiles);
            _bytesPerIndex = TMSNStoreUtils.BytesPerKeyIndexOffset;
            #endif
        }