public GenericAllocator(LogSettings settings, SerializerSettings <Key, Value> serializerSettings, IFasterEqualityComparer <Key> comparer) : base(settings, comparer) { SerializerSettings = serializerSettings; if (default(Key) == null && ((SerializerSettings == null) || (SerializerSettings.keySerializer == null))) { throw new Exception("Key is a class, but no serializer specified via SerializerSettings"); } if (default(Value) == null && ((SerializerSettings == null) || (SerializerSettings.valueSerializer == null))) { throw new Exception("Value is a class, but no serializer specified via SerializerSettings"); } values = new Record <Key, Value> [BufferSize][]; segmentOffsets = new long[SegmentBufferSize]; objectLogDevice = settings.ObjectLogDevice; if (KeyHasObjects() || ValueHasObjects()) { if (objectLogDevice == null) { throw new Exception("Objects in key/value, but object log not provided during creation of FASTER instance"); } } epoch = LightEpoch.Instance; ioBufferPool = SectorAlignedBufferPool.GetPool(1, sectorSize); }
/// <summary> /// /// </summary> /// <param name="filename"></param> /// <param name="preallocateFile"></param> /// <param name="deleteOnClose"></param> public ManagedLocalStorageDevice(string filename, bool preallocateFile = false, bool deleteOnClose = false) : base(filename, GetSectorSize(filename)) { pool = SectorAlignedBufferPool.GetPool(1, 1); this.preallocateFile = preallocateFile; this.deleteOnClose = deleteOnClose; logHandles = new ConcurrentDictionary <int, Stream>(); }