Skip to content

Commit

Permalink
Merge pull request #38 from koculu/add-btree-node-size-fine-tuning-op…
Browse files Browse the repository at this point in the history
…tions

Add B+Tree Node and Leaf size fine tuning options.
  • Loading branch information
koculu committed Jun 16, 2023
2 parents 04f5caa + 765f8b8 commit f8b01ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
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 sealed class MutableSegment<TKey, TValue> : IMutableSegment<TKey, TValue>

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

MarkValueDeleted = options.MarkValueDeleted;
MutableSegmentMaxItemCount = options.MutableSegmentMaxItemCount;
Expand All @@ -73,7 +75,12 @@ public sealed class MutableSegment<TKey, TValue> : IMutableSegment<TKey, TValue>
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

0 comments on commit f8b01ad

Please sign in to comment.