private void RenewEngine() { _Pool.Do(() => { RenewEngineCore(); }); }
private void RenewEngine() { _Pool.Do(() => { DisposeEngine(); _Engine = new DBreezeEngine(directory); _Tx = _Engine.GetTransaction(); }); }
private void RenewEngine() { _Pool.Do(() => { DisposeEngine(); int tried = 0; while (true) { try { _Engine = new DBreezeEngine(directory); break; } catch when(tried < 5) { tried++; Thread.Sleep(5000); } } _Tx = _Engine.GetTransaction(); }); }
public void UpdateOrInsert <T>(string partitionKey, string rowKey, T data, Func <T, T, T> update) { _CustomThreadPool.Do(() => { var engine = GetEngine(partitionKey); using (var tx = engine.GetTransaction()) { T newValue = data; var existingRow = tx.Select <string, byte[]>(GetTableName <T>(), rowKey); if (existingRow != null && existingRow.Exists) { var existing = Serializer.ToObject <T>(Unzip(existingRow.Value)); if (existing != null) { newValue = update(existing, newValue); } } tx.Insert(GetTableName <T>(), rowKey, Zip(Serializer.ToString(newValue))); tx.Commit(); } }); }