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

            _btreeRoot = _keyValueDB.MakeWrittableTransaction(this, oldBTreeRoot);
            _keyValueDB.StartedUsingBTreeRoot(_btreeRoot);
            _keyValueDB.FinishedUsingBTreeRoot(oldBTreeRoot);
            _btreeRoot.DescriptionForLeaks = _descriptionForLeaks;
            _writting = true;
            InvalidateCurrentKey();
            _keyValueDB.WriteStartTransaction();
        }
示例#2
0
 public KeyValueDBTransaction(KeyValueDB keyValueDB, IBTreeRootNode btreeRoot, bool writing, bool readOnly)
 {
     _preapprovedWriting = writing;
     _readOnly           = readOnly;
     _keyValueDB         = keyValueDB;
     _btreeRoot          = btreeRoot;
     _keyIndex           = -1;
     _cursorMovedCounter = 0;
     _keyValueDB.StartedUsingBTreeRoot(_btreeRoot);
 }
示例#3
0
 public KeyValueDBTransaction(KeyValueDB keyValueDB, IBTreeRootNode btreeRoot, bool writting, bool readOnly)
 {
     _preapprovedWritting = writting;
     _readOnly            = readOnly;
     _keyValueDB          = keyValueDB;
     _btreeRoot           = btreeRoot;
     _prefix         = BitArrayManipulation.EmptyByteArray;
     _prefixKeyStart = 0;
     _prefixKeyCount = -1;
     _keyIndex       = -1;
     _keyValueDB.StartedUsingBTreeRoot(_btreeRoot);
 }