Skip to content

Commit

Permalink
Unneeded drop index helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rejemy committed Feb 22, 2019
1 parent c403bcd commit dc6e404
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions LiteDB/Engine/Services/IndexService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,41 +278,6 @@ public void Delete(CollectionIndex index, PageAddress nodeAddress)
}
}

/// <summary>
/// Drop all indexes pages. Each index use a single page sequence
/// </summary>
public void DropIndex(CollectionIndex index)
{
var pages = new HashSet<uint>();
var nodes = this.FindAll(index, Query.Ascending);

// get reference for pageID from all index nodes
foreach (var node in nodes)
{
pages.Add(node.Position.PageID);

// for each node I need remove from node list datablock reference
var prevNode = this.GetNode(node.PrevNode);
var nextNode = this.GetNode(node.NextNode);

if (prevNode != null)
{
prevNode.NextNode = node.NextNode;
_pager.SetDirty(prevNode.Page);
}
if (nextNode != null)
{
nextNode.PrevNode = node.PrevNode;
_pager.SetDirty(nextNode.Page);
}
}

// now delete all pages
foreach (var pageID in pages)
{
_pager.DeletePage(pageID);
}
}

/// <summary>
/// Get a node inside a page using PageAddress - Returns null if address IsEmpty
Expand Down

0 comments on commit dc6e404

Please sign in to comment.