BTDB.KVDBLayer.InMemoryKeyValueDB.MakeWrittableTransaction C# (CSharp) Method

MakeWrittableTransaction() private method

private MakeWrittableTransaction ( BTDB.KVDBLayer.InMemoryKeyValueDBTransaction keyValueDBTransaction, IBTreeRootNode btreeRoot ) : IBTreeRootNode
keyValueDBTransaction BTDB.KVDBLayer.InMemoryKeyValueDBTransaction
btreeRoot IBTreeRootNode
return IBTreeRootNode
        internal IBTreeRootNode MakeWrittableTransaction(InMemoryKeyValueDBTransaction keyValueDBTransaction, IBTreeRootNode btreeRoot)
        {
            lock (_writeLock)
            {
                if (_writingTransaction != null) throw new BTDBTransactionRetryException("Another writting transaction already running");
                if (LastCommited != btreeRoot) throw new BTDBTransactionRetryException("Another writting transaction already finished");
                _writingTransaction = keyValueDBTransaction;
                return btreeRoot.NewTransactionRoot();
            }
        }

Usage Example

Esempio n. 1
0
        void MakeWrittable()
        {
            if (_writting)
            {
                return;
            }
            if (_preapprovedWritting)
            {
                _writting            = true;
                _preapprovedWritting = false;
                return;
            }
            if (_readOnly)
            {
                throw new BTDBTransactionRetryException("Cannot write from readOnly transaction");
            }
            var oldBTreeRoot = BtreeRoot;

            _btreeRoot = _keyValueDB.MakeWrittableTransaction(this, oldBTreeRoot);
            _writting  = true;
            InvalidateCurrentKey();
        }