Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
3 changes: 3 additions & 0 deletions src/LevelDBStore/IO/Data/LevelDB/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ public static class Native

[DllImport("libleveldb", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void leveldb_options_set_filter_policy(IntPtr /*Options*/ options, IntPtr /*FilterPolicy*/ policy);

[DllImport("libleveldb", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr leveldb_filterpolicy_create_bloom(int bits_per_key);
#endregion

#region ReadOptions
Expand Down
2 changes: 1 addition & 1 deletion src/LevelDBStore/LevelDBStore/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"PluginConfiguration": {
"Path": "Data_LevelDB_{0}"
}
Expand Down
2 changes: 1 addition & 1 deletion src/LevelDBStore/Plugins/Storage/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Store : IStore

public Store(string path)
{
this.db = DB.Open(path, new Options { CreateIfMissing = true });
this.db = DB.Open(path, new Options { CreateIfMissing = true, FilterPolicy = Native.leveldb_filterpolicy_create_bloom(15) });
byte[] value = db.Get(ReadOptions.Default, LHelper.CreateKey(SYS_Version));
if (value != null && Version.TryParse(Encoding.ASCII.GetString(value), out Version version) && version >= Version.Parse("3.0.0"))
return;
Expand Down