Exemple #1
0
 public RootLock(BPlusTree <TKey, TValue> tree, LockType type, bool exclusiveTreeAccess, string methodName)
 {
     tree.NotDisposed();
     _tree       = tree;
     _type       = type;
     _version    = type == LockType.Read ? tree._storage.CurrentVersion : null;
     _methodName = methodName;
     _exclusive  = exclusiveTreeAccess;
     _locked     = _exclusive ? _tree._selfLock.TryWrite(tree._options.LockTimeout) : _tree._selfLock.TryRead(tree._options.LockTimeout);
     LockTimeoutException.Assert(_locked);
     try
     {
         Pin = _tree._storage.LockRoot(type);
     }
     catch
     {
         if (_exclusive)
         {
             _tree._selfLock.ReleaseWrite();
         }
         else
         {
             _tree._selfLock.ReleaseRead();
         }
         throw;
     }
 }
 public Enumerator(BPlusTree <TKey, TValue> tree)
 {
     tree.NotDisposed();
     _tree       = tree;
     _currentSet = new Element[_tree._options.MaximumValueNodes];
     Reset();
 }
 public Enumerator(BPlusTree <TKey, TValue> tree, TKey startKey)
 {
     tree.NotDisposed();
     _tree       = tree;
     _currentSet = new Element[_tree._options.MaximumValueNodes];
     _hasStart   = true;
     _startKey   = startKey;
     Reset();
 }