Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add B+Tree Node and Leaf size fine tuning options. #38

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ZoneTree/Options/ZoneTreeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ public sealed class ZoneTreeOptions<TKey, TValue>
/// </summary>
public BTreeLockMode BTreeLockMode { get; set; } = BTreeLockMode.NodeLevelMonitor;

/// <summary>
/// The B+Tree node size.
/// </summary>
public int BTreeNodeSize { get; set; } = 128;

/// <summary>
/// The B+Tree leaf size.
/// </summary>
public int BTreeLeafSize { get; set; } = 128;

/// <summary>
/// ZoneTree Logger.
/// </summary>
Expand Down
11 changes: 9 additions & 2 deletions src/ZoneTree/Segments/InMemory/MutableSegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public MutableSegment(ZoneTreeOptions<TKey, TValue> options,

BTree = new(Comparer,
Options.BTreeLockMode,
indexOpProvider);
indexOpProvider,
Options.BTreeNodeSize,
Options.BTreeLeafSize);

MarkValueDeleted = options.MarkValueDeleted;
MutableSegmentMaxItemCount = options.MutableSegmentMaxItemCount;
Expand All @@ -73,7 +75,12 @@ public MutableSegment(
Options = options;
Comparer = options.Comparer;

BTree = new(Comparer, Options.BTreeLockMode);
BTree = new(
Comparer,
Options.BTreeLockMode,
null,
Options.BTreeNodeSize,
Options.BTreeLeafSize);
BTree.SetNextOpIndex(nextOpIndex);

MarkValueDeleted = options.MarkValueDeleted;
Expand Down