示例#1
0
        /// <summary>
        /// Close the rocksdb handle. Note if any open iterator is open, close them before closed the state store.
        /// </summary>
        public void Close()
        {
            if (!IsOpen)
            {
                return;
            }

            if (openIterators.Count != 0)
            {
                log.LogWarning("Closing {OpenIteratorsCount} open iterators for store {Name}", openIterators.Count, Name);
                for (int i = 0; i < openIterators.Count; ++i)
                {
                    openIterators.ElementAt(i).Dispose();
                }
            }

            IsOpen = false;
            DbAdapter.Close();
            Db.Dispose();

            DbAdapter = null;
            Db        = null;
        }