public void OpenStorageWithWrongPageSizeShouldFail() { var factory = new StorageFactory(); using (var storage = factory.CreateBPlusTreeStorage <ComparableKeyOf <Int32>, ValueOf <Int32> >( p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), BPlusTreeStorageSettings.Default())) { storage.CreateNew(StoragePath); } var differentSettings = BPlusTreeStorageSettings.Default(); differentSettings.PageSize = PageSize._8192; using (var storage = factory.CreateBPlusTreeStorage <ComparableKeyOf <Int32>, ValueOf <Int32> >( p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), differentSettings)) { storage.OpenExisting(StoragePath); } }
public void SuccessfulCreateCloseAndOpenStorage() { var factory = new StorageFactory(); using (var storage = factory.CreateBPlusTreeStorage <ComparableKeyOf <Int32>, ValueOf <Int32> >( p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), BPlusTreeStorageSettings.Default())) { storage.CreateNew(StoragePath); } using (var storage = factory.CreateBPlusTreeStorage <ComparableKeyOf <Int32>, ValueOf <Int32> >( p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), BPlusTreeStorageSettings.Default())) { storage.OpenExisting(StoragePath); } using (var storage = factory.CreateBPlusTreeStorage <ComparableKeyOf <Int32>, ValueOf <Int32> >( p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), p => BitConverter.GetBytes(p.Value), p => BitConverter.ToInt32(p, 0), BPlusTreeStorageSettings.Default())) { storage.OpenOrCreate(StoragePath); } }
private static IKeyValueStorage <ComparableKeyOf <int>, ValueOf <string> > GetStorage() { var settings = BPlusTreeStorageSettings.Default(4); // use default settings with 4-byte keys settings.CacheSettings.MaxCachedPages = 10000; // speedup massive insert operations settings.CacheSettings.MaxDirtyPages = 1000; // by increasing cache size return(new StorageFactory().CreateBPlusTreeStorage <int, string>(settings)); }
private static IKeyValueStorage <ComparableKeyOf <int>, ValueOf <int> > GetIntStorage() { var factory = new StorageFactory(); return(factory.CreateBPlusTreeStorage <int, int>( BitConverter.GetBytes, p => BitConverter.ToInt32(p, 0), BPlusTreeStorageSettings.Default(sizeof(int)))); }
private static IKeyValueStorage <ComparableKeyOf <int>, ValueOf <string> > GetStorage() { var settings = BPlusTreeStorageSettings.Default(4); // use default settings with 4-byte keys settings.AutoFlushTimeout = TimeSpan.FromMilliseconds(50); return(new StorageFactory().CreateBPlusTreeStorage <int, string>( p => Encoding.UTF8.GetBytes(p), // value serialization p => Encoding.UTF8.GetString(p), // value deserialization settings)); }
private IBPlusTreeKeyValueStorage <ComparableKeyOf <String>, ValueOf <String> > GetStorage() { var factory = new StorageFactory(); var settings = BPlusTreeStorageSettings.Default(); settings.CacheSettings.MaxCachedPages = 3000; settings.CacheSettings.MaxDirtyPages = 2000; settings.ForcedWrites = false; settings.MaxKeySize = 16; settings.PageSize = PageSize._4096; return((IBPlusTreeKeyValueStorage <ComparableKeyOf <String>, ValueOf <String> >)factory.CreateBPlusTreeStorage( p => Encoding.UTF8.GetBytes(p), p => Encoding.UTF8.GetString(p), p => Encoding.UTF8.GetBytes(p), p => Encoding.UTF8.GetString(p), settings)); }
private IKeyValueStorage <ComparableKeyOf <string>, ValueOf <string> > GetStorage() { return(_storageFactory.CreateBPlusTreeStorage <string, string>(BPlusTreeStorageSettings.Default(255))); }
private static IKeyValueStorage <ComparableKeyOf <int>, ValueOf <byte[]> > GetByteArrayStorage() { var factory = new StorageFactory(); return(factory.CreateBPlusTreeByteArrayStorage <int>(BPlusTreeStorageSettings.Default(sizeof(int)))); }