public BinaryStorage(StorageConfiguration configuration) { var options = new BPlusTree <string, Data> .OptionsV2(PrimitiveSerializer.String, new DataSerializer()); options.CreateFile = CreatePolicy.IfNeeded; options.FileName = Path.Combine(configuration.WorkingFolder, "index.bin"); options.CallLevelLock = new ReaderWriterLocking(); options.CachePolicy = CachePolicy.Recent; options.CacheKeepAliveMaximumHistory = cacheSize / (estimatedKeySize + estimatedDataSize); options.CalcBTreeOrder(estimatedKeySize, estimatedDataSize); index = new BPlusTree <string, Data> (options); storageFile = Path.Combine(configuration.WorkingFolder, "storage.bin"); storageStream = new FileStream(storageFile, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, FileOptions.Asynchronous | FileOptions.SequentialScan | FileOptions.WriteThrough); }
public BinaryStorage(StorageConfiguration configuration, IIndexFile index) { this.configuration = Utils.CheckNotNull(configuration, Messages.ConfigurationNull); storage = new FileStream(Path.Combine(configuration.WorkingFolder, STORAGE_FILE_NAME), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); this.index = index; }
//This constructor actually not needed, but as I'm not allowed to modify TestApp IndexFile will be passed as parameter public BinaryStorage(StorageConfiguration configuration) : this(Utils.CheckNotNull(configuration, Messages.ConfigurationNull), new IndexFile(Path.Combine(configuration.WorkingFolder, INDEX_FILE_NAME))) { }