Exemplo n.º 1
0
 /// <summary>
 /// Open the collection
 /// </summary>
 public override void Open()
 {
     RemoveDeletedDataBlocks();
     base.Open();
     if (DataSet != null)
     {
         DataSet.IsDeletedBlocksList = IsDeletedBlocksList;
     }
     KeySet.IsDeletedBlocksList = IsDeletedBlocksList;
     if (DataSet != null)
     {
         DataSet.Open();
     }
     KeySet.Open();
     if (RootNode != null)
     {
         if (!RootNeedsReload)
         {
             MoveFirst();
         }
     }
     else
     {
         RootNode = new BTreeNodeOnDisk(this);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Open the collection
        /// </summary>
        public override void Open()
        {
            RemoveDeletedDataBlocks();
            base.Open();
            if (DataSet != null)
            {
                DataSet.IsDeletedBlocksList = IsDeletedBlocksList;
            }
            KeySet.IsDeletedBlocksList = IsDeletedBlocksList;
            if (DataSet != null)
            {
                DataSet.Open();
            }
            KeySet.Open();
            if (RootNode != null)
            {
                if (!RootNeedsReload)
                {
                    MoveFirst();
                }
            }
            else
            {
                RootNode = new BTreeNodeOnDisk(this);
            }

            // log the read HeaderData information useful for debugging.
            //Log.Logger.Instance.Warning(ToString());
        }
Exemplo n.º 3
0
            public BTreeNodeOnDisk GetNode(BTree.BTreeAlgorithm bTree)
            {
                BTreeNodeOnDisk r = null;

                if (NodeAddress != -1)
                {
                    r = BTreeNodeOnDisk.GetNode(bTree, NodeAddress);
                }
                return(r);
            }
Exemplo n.º 4
0
 internal void ProcessPromotion()
 {
     while (PromoteParent != null)
     {
         Log.Logger.Instance.Log(Log.LogLevels.Verbose, "ProcessPromotion: PromoteParent Node Address {0}.", PromoteParent.GetAddress(this));
         BTreeNodeOnDisk n = PromoteParent;
         short           i = PromoteIndexOfNode;
         PromoteParent      = null;
         PromoteIndexOfNode = 0;
         n.Promote(this, i);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Move current item pointer to next item relative to the current item
 /// </summary>
 /// <returns></returns>
 public override bool MoveNext()
 {
     if (RootNode == null)
     {
         throw new InvalidOperationException("Can't MoveNext, ObjectStore is close.");
     }
     if (HintSequentialRead)
     {
         if (_sequentialReadBatchedIDs.Count == 0)
         {
             LoadSequentialReadBatchedIDs();
         }
         if (_sequentialReadIndex < _sequentialReadBatchedIDs.Count)
         {
             _sequentialReadIndex++;
         }
         if (_sequentialReadIndex == _sequentialReadBatchedIDs.Count)
         {
             LoadSequentialReadBatchedIDs();
         }
         return(_sequentialReadBatchedIDs.Count > 0);
     }
     if (CurrentItem != null)
     {
         BeginTreeMaintenance();
         try
         {
             BTreeNodeOnDisk o = CurrentItem.GetNode(this);
             if (
                 !(CurrentItem.NodeAddress == -1 || o.Slots == null || o.Slots[CurrentItem.NodeItemIndex] == null))
             {
                 return(o.MoveNext(this));
             }
         }
         finally
         {
             EndTreeMaintenance();
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 internal void ProcessDistribution()
 {
     if (DistributeSibling != null)
     {
         Log.Logger.Instance.Log(Log.LogLevels.Information, "ProcessDistribution: DistributeSibling Node Address {0}.", DistributeSibling.GetAddress(this));
     }
     while (DistributeSibling != null)
     {
         BTreeNodeOnDisk n    = DistributeSibling;
         BTreeItemOnDisk item = DistributeItem;
         DistributeSibling = null;
         DistributeItem    = null;
         if (DistributeLeftDirection)
         {
             n.DistributeToLeft(this, item);
         }
         else
         {
             n.DistributeToRight(this, item);
         }
     }
 }
Exemplo n.º 7
0
        public bool Detach()
        {
            BTreeNodeOnDisk currNode = CurrentNode;

            if (currNode == null || CurrentItemReference.NodeItemIndex < 0)
            {
                return(false);
            }
            BTreeItemOnDisk itm = currNode.Slots[CurrentItemReference.NodeItemIndex];

            itm.Value.Data = null;
            if (IsDataInKeySegment)
            {
                return(true);
            }
            // reset the disk buffer so it won't get recycled... (intention is to re-attach it as another entry)
            itm.Value.diskBuffer        = CreateBlock();
            itm.ValueLoaded             = true;
            itm.Value.IsDirty           = false;
            itm.IsDirty                 = true;
            itm.Value.DataIsUserDefined = false;
            IsDirty = true;
            return(true);
        }