Skip to content

Commit

Permalink
Merge pull request #61 from koculu/60-enhancement-expose-comparer-key…
Browse files Browse the repository at this point in the history
…-and-value-serializers-on-zonetree-api

Expose comparer, key and value serializers on IZoneTree.
  • Loading branch information
koculu authored Jun 14, 2024
2 parents 60dcda5 + a1ce94b commit 3486123
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/ZoneTree/Core/ZoneTree.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Collections.Concurrent;
using Tenray.ZoneTree.Collections;
using Tenray.ZoneTree.Comparers;
using Tenray.ZoneTree.Logger;
using Tenray.ZoneTree.Options;
using Tenray.ZoneTree.Segments;
using Tenray.ZoneTree.Segments.InMemory;
using Tenray.ZoneTree.Segments.NullDisk;
using Tenray.ZoneTree.Serializers;

namespace Tenray.ZoneTree.Core;

Expand Down Expand Up @@ -124,6 +126,12 @@ public long TotalRecordCount

public bool IsReadOnly { get => _isReadOnly; set => _isReadOnly = value; }

public IRefComparer<TKey> Comparer => Options.Comparer;

public ISerializer<TKey> KeySerializer => Options.KeySerializer;

public ISerializer<TValue> ValueSerializer => Options.ValueSerializer;

public ZoneTree(ZoneTreeOptions<TKey, TValue> options)
{
Logger = options.Logger;
Expand Down
19 changes: 18 additions & 1 deletion src/ZoneTree/IZoneTree.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Tenray.ZoneTree.Logger;
using Tenray.ZoneTree.Comparers;
using Tenray.ZoneTree.Logger;
using Tenray.ZoneTree.Serializers;

namespace Tenray.ZoneTree;

Expand All @@ -9,6 +11,21 @@ namespace Tenray.ZoneTree;
/// <typeparam name="TValue">The value type</typeparam>
public interface IZoneTree<TKey, TValue> : IDisposable
{
/// <summary>
/// The key comparer.
/// </summary>
public IRefComparer<TKey> Comparer { get; }

/// <summary>
/// The key serializer.
/// </summary>
public ISerializer<TKey> KeySerializer { get; }

/// <summary>
/// The value serializer.
/// </summary>
public ISerializer<TValue> ValueSerializer { get; }

/// <summary>
/// Checks the existence of the key in the tree.
/// </summary>
Expand Down

0 comments on commit 3486123

Please sign in to comment.