private MakeWrittableTransaction ( BTDB.KVDBLayer.InMemoryKeyValueDBTransaction keyValueDBTransaction, IBTreeRootNode btreeRoot ) : IBTreeRootNode | ||
keyValueDBTransaction | BTDB.KVDBLayer.InMemoryKeyValueDBTransaction | |
btreeRoot | IBTreeRootNode | |
리턴 | 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();
}
}
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(); }