Exemplo n.º 1
0
        /// <summary>
        /// The constructor for the TMSNStoreReader.
        /// </summary>
        /// <param name="dbdir">path to the directory holding the database.</param>
        /// <param name="mmapIndexFiles">instruct TMSNStore to attempt memory mapping index files otherwise read into memory.</param>
        public TMSNStoreReader(string dbdir, bool mmapIndexFiles)
        {
            string name = Path.Combine(dbdir, "keys-data");
            //UnbufferedStream.BufferSize = 32*1024;
            //_keysFs = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
            _keysFs = ZStreamIn.Open(name);
            _keysReader = new VariableLengthBinaryReader(_keysFs);

            // open the index as either a mmap or regular file
            name = Path.Combine(dbdir, "keys-data-index");
            _keyIndex = new KeyIndex(name, _keysFs.Length, mmapIndexFiles);

            // hard code the group size.
            _keyCache = new KeyCacheReader(dbdir, 32, mmapIndexFiles);

            _recordSource = new TMSNStoreRecordSource(this, dbdir);
            _ascendingFactor = (_recordSource.Sorting.IsSortedAscending ? 1 : -1);
        }
Exemplo n.º 2
0
 public InternalRecordFileReader(string filepath)
 {
     _filename = filepath;
     _fileStream = ZStreamIn.Open(_filename);
     this.ReadProperties(_fileStream);
     _fileReader = new VariableLengthBinaryReader(_fileStream);
     _currentFilePosition = _fileStream.Position;
     _fileLength = _fileStream.Length;
 }