// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; namespace FASTER.core { /// /// Configuration settings for serializing objects /// /// /// public class SerializerSettings { /// /// Key serializer /// public Func> keySerializer; /// /// Value serializer /// public Func> valueSerializer; } /// /// Interface for variable length in-place objects /// modeled as structs, in FASTER /// /// public interface IVariableLengthStruct { /// /// Actual length of object /// /// /// int GetLength(ref T t); /// /// Average length of objects, make sure this includes the object /// header needed to compute the actual object length /// /// int GetAverageLength(); /// /// Initial length, when populating for RMW from given input /// /// /// /// int GetInitialLength(ref Input input); } /// /// Length specification for fixed size (normal) structs /// /// public struct FixedLengthStruct : IVariableLengthStruct { private static readonly int size = Utility.GetSize(default(T)); /// /// Get average length /// /// public int GetAverageLength() { return size; } /// /// Get initial length /// /// /// /// public int GetInitialLength(ref Input input) { return size; } /// /// Get length /// /// /// public int GetLength(ref T t) { return size; } } /// /// Settings for variable length keys and values /// /// /// public class VariableLengthStructSettings { /// /// Key length /// public IVariableLengthStruct keyLength; /// /// Value length /// public IVariableLengthStruct valueLength; } /// /// Configuration settings for hybrid log /// public class LogSettings { /// /// Device used for main hybrid log /// public IDevice LogDevice = new NullDevice(); /// /// Device used for serialized heap objects in hybrid log /// public IDevice ObjectLogDevice = new NullDevice(); /// /// Size of a segment (group of pages), in bits /// public int PageSizeBits = 25; /// /// Size of a segment (group of pages), in bits /// public int SegmentSizeBits = 30; /// /// Total size of in-memory part of log, in bits /// public int MemorySizeBits = 34; /// /// Fraction of log marked as mutable (in-place updates) /// public double MutableFraction = 0.9; /// /// Copy reads to tail of log /// public bool CopyReadsToTail = false; /// /// Settings for optional read cache /// Overrides the "copy reads to tail" setting /// public ReadCacheSettings ReadCacheSettings = null; } /// /// Configuration settings for hybrid log /// public class ReadCacheSettings { /// /// Size of a segment (group of pages), in bits /// public int PageSizeBits = 25; /// /// Total size of in-memory part of log, in bits /// public int MemorySizeBits = 34; /// /// Fraction of log head (in memory) used for second chance /// copy to tail. This is (1 - MutableFraction) for the /// underlying log /// public double SecondChanceFraction = 0.1; } }