Esempio n. 1
0
        /// <summary>
        /// mgindex special storage for strings ctor -> no idx file
        /// use SaveData() GetData()
        /// </summary>
        /// <param name="folder">文件目录</param>
        /// <param name="filename">文件名</param>
        public KeyStoreHF(string folder, string filename)
        {
            _Path = folder;
            Directory.CreateDirectory(_Path);
            if (_Path.EndsWith(_S) == false)
            {
                _Path += _S;
            }

            _datastore = new StorageFileHF(Path.Combine(_Path, filename), Global.HighFrequencyKVDiskBlockSize);
            _datastore.Initialize();
            _BlockSize = _datastore.GetBlockSize();
        }
Esempio n. 2
0
        public KeyStoreHF(string folder)
        {
            _Path = folder;
            Directory.CreateDirectory(_Path);
            if (_Path.EndsWith(_S) == false)
            {
                _Path += _S;
            }

            if (File.Exists(_Path + _dirtyFilename))
            {
                _log.Error("Last shutdown failed, rebuilding data files...");
                RebuildDataFiles();
            }
            _datastore = new StorageFileHF(Path.Combine(_Path, "data.mghf"), Global.HighFrequencyKVDiskBlockSize);
            _keys      = new MGIndex <string>(_Path, "keys.idx", 255, /*Global.PageItemCount,*/ false);
            _datastore.Initialize();
            _BlockSize = _datastore.GetBlockSize();
        }