private void ChangeTypeIfNeeded() { if (_state != TYPE.Indexes) { return; } uint T = (_curMax >> 5) + 1; int c = _offsets.Count(); if (c > T && c > Global.BitmapOffsetSwitchOverCount) { // change type to WAH _state = TYPE.Bitarray; _uncompressed = new uint[0]; // create bitmap foreach (var i in _offsets.Keys()) { Set((int)i, true); } // clear list if (Global.UseLessMemoryStructures) { _offsets = new SafeSortedList <uint, bool>(); } else { _offsets = new SafeDictionary <uint, bool>(); } //new Dictionary<uint, bool>(); } }
public MGIndex(string path, string filename, byte keysize, bool allowdups) { if (Global.UseLessMemoryStructures) { _cache = new SafeSortedList <int, Page <T> >(); } else { _cache = new SafeDictionary <int, Page <T> >(); } _AllowDuplicates = allowdups; if (path.EndsWith(Path.DirectorySeparatorChar.ToString()) == false) { path += Path.DirectorySeparatorChar; } _index = new IndexFile <T>(path + filename, keysize); // load page list _index.GetPageList(_pageListDiskPages, _pageList, out _LastIndexedRecordNumber); if (_pageList.Count() == 0) { Page <T> page = new Page <T>(); page.FirstKey = (T)RDBDataType <T> .GetEmpty(); page.DiskPageNumber = _index.GetNewPageNumber(); page.isDirty = true; _pageList.Add(page.FirstKey, new PageInfo(page.DiskPageNumber, 0, 0)); _cache.Add(page.DiskPageNumber, page); } }
public ClientImpl(ClientBuilder clientBuilder) { // Copy the builder so external modifications won't affect this client impl. this.builder = clientBuilder.Copy(); this.kvClient = null; this.authClient = null; this.maintenanceClient = null; this.clusterClient = null; this.leaseClient = null; this.watchClient = null; this.lockClient = null; this.connectionManager = new ClientConnectionManager(this.builder); }
public string StoreData(byte[] value) { try { IKV storage = GetStorageWithLessPairs(); string key = storage.StoreData(value); Console.WriteLine("\nValue stored with success, with the key - {0}!", key); return(key); } catch (FaultException <BrokerExceptionFaultContract> e) { Console.WriteLine("\n" + e.Detail.Message); throw new FaultException <BrokerExceptionFaultContract>(new BrokerExceptionFaultContract(e.Message), new FaultReason(e.Message)); } }
public BitmapIndex(String filename) { if (Global.UseLessMemoryStructures) { _cache = new SafeSortedList <int, MGRB>(); } else { _cache = new SafeDictionary <int, MGRB>(); } _filename = filename; Initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="SessionTokenManager"/> class. /// </summary> /// <param name="kv">key vault</param> /// <param name="connectionStringProvider">connection string provider</param> public SessionTokenManager(IKV kv, IConnectionStringProvider connectionStringProvider) { if (kv == null) { throw new ArgumentNullException("Session token manager cannot take a null kv."); } if (connectionStringProvider == null) { throw new ArgumentNullException("Session token manager cannot take a null connection string provider."); } this.kv = kv; this.connectionStringProvider = connectionStringProvider; }
public void Commit(bool freeMemory) { if (_isDirty == false) { return; } using (new L(this)) { log.Debug("writing " + _filename); int[] keys = _cache.Keys(); Array.Sort(keys); foreach (int k in keys) { MGRB bmp = null; if (_cache.TryGetValue(k, out bmp) && bmp.isDirty) { bmp.Optimize(); SaveBitmap(k, bmp); bmp.isDirty = false; } } Flush(); if (freeMemory) { if (Global.UseLessMemoryStructures) { _cache = new SafeSortedList <int, MGRB>(); } else { _cache = new SafeDictionary <int, MGRB>(); } log.Debug(" freeing cache"); } _isDirty = false; } }
/// <summary> /// Initializes a new instance of the <see cref="KVSettingsReader"/> class. /// </summary> /// <param name="syncSettingsReader">synchronous settings reader</param> /// <param name="kv">key vault</param> public KVSettingsReader(ISettingsReader syncSettingsReader, IKV kv) { this.syncSettingsReader = syncSettingsReader; this.kv = kv; }
/// <summary> /// Initializes a new instance of the <see cref="KVTests"/> class. /// </summary> /// <param name="kv">An <see cref="IKV"/> instance to use for the unit tests.</param> public KVTests(IKV kv) { this.kv = kv; }
/// <summary> /// Initializes a new instance of the <see cref="KVTests"/> class. /// Uses the information from the settings file. /// </summary> public KVTests() { this.kv = new KV(TestLog, ClientId, VaultUrl, CertThumbprint, StoreLoc, Client); }