Skip to content

Commit

Permalink
* use new span based iterator.Seek/SeekForPrev methods.
Browse files Browse the repository at this point in the history
* Remove unsafe block support (no longer needed)
  • Loading branch information
Harry committed Dec 14, 2021
1 parent e3a5957 commit eebf88d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/bctklib/bctklib.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>neo-bctklib</AssemblyName>
<Authors>The Neo Project</Authors>
<Company>The Neo Project</Company>
Expand Down
20 changes: 2 additions & 18 deletions src/bctklib/persistence/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public static ColumnFamilyHandle GetOrCreateColumnFamily(this RocksDb db, string

if (direction == SeekDirection.Forward)
{
Seek(iterator, prefix);
iterator.Seek(prefix);
return SeekInternal(iterator, iterator.Next);
}
else
{
SeekForPrev(iterator, prefix);
iterator.SeekForPrev(prefix);
return SeekInternal(iterator, iterator.Prev);
}

Expand All @@ -49,22 +49,6 @@ public static ColumnFamilyHandle GetOrCreateColumnFamily(this RocksDb db, string
}
}
}

unsafe static Iterator Seek(Iterator @this, ReadOnlySpan<byte> prefix)
{
fixed (byte* prefixPtr = prefix)
{
return @this.Seek(prefixPtr, (ulong)prefix.Length);
}
}

unsafe static Iterator SeekForPrev(Iterator @this, ReadOnlySpan<byte> prefix)
{
fixed (byte* prefixPtr = prefix)
{
return @this.SeekForPrev(prefixPtr, (ulong)prefix.Length);
}
}
}

public static byte[]? TryGet(this TrackingMap trackingMap, IReadOnlyStore store, byte[]? key)
Expand Down

0 comments on commit eebf88d

Please sign in to comment.