public void Dispose() { if (_db.xIsNotNull()) { _db.Dispose(); } }
public override void Dispose() { try { if (!_disposed) { _chainDb?.Dispose(); _txIndexDb?.Dispose(); _blockIndexDb?.Dispose(); _blockPerceptionDb?.Dispose(); _stagedTxDb?.Dispose(); _txExecutionDb?.Dispose(); _txIdBlockHashIndexDb?.Dispose(); foreach (var db in _txDbCache.Values) { db.Dispose(); } _txDbCache.Clear(); foreach (var db in _blockDbCache.Values) { db.Dispose(); } _blockDbCache.Clear(); _disposed = true; } } catch (Exception e) { LogUnexpectedException(nameof(Dispose), e); } }
public void Dispose() { if (_rocksDb.xIsNotNull()) { _rocksDb.Dispose(); } }
public override void Dispose() { _chainDb?.Dispose(); _txDb?.Dispose(); _blockDb?.Dispose(); _stagedTxDb?.Dispose(); }
public void Dispose() { if (_rocksDb != null) { _rocksDb.Dispose(); } }
public void Dispose() { if (!_disposed) { _keyValueDb.Dispose(); _disposed = true; } }
public void Dispose() { disposed = true; if (!shared) { db.Dispose(); } }
public void Dispose() { if (!objectDisposed) { db.Dispose(); blockIndex.Clear(); objectDisposed = true; } }
public void Dispose() { // Save the last ids to database foreach (var id in _lastTxIdDictionary) { _db.Put("lastTxId", id.Value.ToString(), GetColFamily(id.Key + ":lastid")); } _db?.Dispose(); }
internal void Close() { lock (Raft) { Logs?.Dispose(); Logs = null; Rafts?.Dispose(); Rafts = null; } }
protected override void PostStop() { #if DEBUG Console.WriteLine("PostStop called"); #endif database?.Dispose(); producer.Flush(); producer.Dispose(); base.PostStop(); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _dbInstance.Dispose(); } _dbInstance = null; disposedValue = true; } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _preAggDatabase?.Dispose(); } _preAggDatabase = null; disposedValue = true; } }
private static bool CheckPwd(string base64Pwd) { byte[] pwdBytes = Convert.FromBase64String(base64Pwd); string pwd = Encoding.UTF8.GetString(pwdBytes); DbOptions dbop = new DbOptions() .SetCreateIfMissing() .SetEnableWriteThreadAdaptiveYield(true); RocksDb db = RocksDb.Open(dbop, @"E:\db\rocksdb\asset"); // db里的密码做了sha256 string password = db.Get("assetPwd"); db.Dispose(); return(SecurityHelp.StringSHA256(pwd) == password); }
public void create_rocksdb_test() { Parallel.ForEach(Enumerable.Range(1, 10), i => { // Using strings below, but can also use byte arrays for both keys and values // much care has been taken to minimize buffer copying _rocksDb.Put($"key{i}", "value"); string value = _rocksDb.Get($"key{i}"); Assert.AreEqual("value", value); _rocksDb.Remove($"key{i}"); }); _rocksDb.Dispose(); }
/// <summary> /// Disposes. /// </summary> public void Dispose() { if (m_snapshot == null) { m_store.Dispose(); } else { // If this is snapshot of another store, only dispose the m_snapshot object. // The m_store object cannot be disposed more than once. // We would wait for the non-snapshot dbstore to dispose the m_store object. m_snapshot.Dispose(); } }
// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _db?.Dispose(); } _disposed = true; }
public void Dispose() { is_disposed = true; if (leveld_db != null) { leveld_db.Dispose(); leveld_db = null; } if (struct_db != null) { struct_db.Dispose(); struct_db = null; } }
public override void Dispose() { _chainDb?.Dispose(); _txIndexDb?.Dispose(); _blockIndexDb?.Dispose(); _blockPerceptionDb?.Dispose(); _stagedTxDb?.Dispose(); foreach (var db in _txDbCache.Values) { db.Dispose(); } _txDbCache.Clear(); foreach (var db in _blockDbCache.Values) { db.Dispose(); } _blockDbCache.Clear(); }
/// <summary> /// Disposes. /// </summary> public void Dispose() { if (m_snapshot == null) { // The db instance was opened in bulk load mode. Issue a manual compaction on Dispose. // See https://github.com/facebook/rocksdb/wiki/RocksDB-FAQ for more details if (m_openBulkLoad) { foreach (var columnFamilyName in m_columns.Keys) { CompactRange((byte[])null, null, columnFamilyName); } } m_store.Dispose(); } else { // If this is snapshot of another store, only dispose the m_snapshot object. // The m_store object cannot be disposed more than once. // We would wait for the non-snapshot dbstore to dispose the m_store object. m_snapshot.Dispose(); } }
public void Dispose() { Database.Dispose(); }
public void Dispose() { db.Dispose(); }
private void Shutdown() { logger.Message("Shutting down database..."); _db.Dispose(); logger.Message("Database has been shut down!"); }
private void ReleaseUnmanagedResources() { db.Dispose(); (nodeIndex as IDisposable).Dispose(); }
public void Dispose() { _logger.LogInformation("disposing rocksdb"); _db.Dispose(); }
public static async Task Main(string[] args) { if (args.Length != 2 && args.Length != 3) { Console.WriteLine("Usage: .. <brokerList> gen|proc|del [client-id]"); Console.WriteLine(" del: delete all Kafka topics created by this example application."); Console.WriteLine(" gen: generate line data (don't supply client-id)"); Console.WriteLine(" proc: process line data. run multiple instances specifying different client-id's."); return; } string brokerList = args[0]; string mode = args[1]; CancellationTokenSource cts = new CancellationTokenSource(); Console.CancelKeyPress += (_, e) => { e.Cancel = true; // prevent the process from terminating. cts.Cancel(); }; if (mode == "del") { await DeleteTopics(brokerList); return; } await CreateTopicsMaybe(brokerList); if (mode == "gen") { try { await Generator_LineInputData(brokerList, cts.Token); } catch (OperationCanceledException) {} return; } string clientId = args[2]; RocksDb db = null; try { var options = new DbOptions() .SetCreateIfMissing(true) .SetCreateMissingColumnFamilies(true); var columnFamilies = new ColumnFamilies { { "counts", new ColumnFamilyOptions() } }; db = RocksDb.Open(options, System.IO.Path.Join(System.IO.Path.GetTempPath(), "rocksdb_" + Guid.NewGuid().ToString()), columnFamilies); var processors = new List <Task>(); processors.Add(Task.Run(() => Processor_MapWords(brokerList, clientId, cts.Token))); processors.Add(Task.Run(() => Processor_AggregateWords(brokerList, clientId, db, cts.Token))); processors.Add(Task.Run(async() => await PeriodicallyDisplayTopCountsState(brokerList, db, cts.Token))); var allTasks = await Task.WhenAny(processors.ToArray()); if (allTasks.IsFaulted) { if (!(allTasks.Exception.InnerException is OperationCanceledException)) { Console.WriteLine(allTasks.Exception.InnerException.ToString()); } } Console.WriteLine("exiting..."); } finally { if (db != null) { db.Dispose(); } } }
public void Dispose() { _db?.Dispose(); _currentBatch?.Dispose(); }
public void Dispose() { _keyValueDb.Dispose(); }
public void Dispose() { _rocksDb?.Dispose(); }
public void Dispose() { db.Dispose(); _families.Clear(); }