// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. #pragma warning disable 0162 using System; using System.Diagnostics; using System.IO; namespace FASTER.core { /// /// Delegate for getting memory from user /// /// Minimum length of returned byte array /// public delegate byte[] GetMemory(int minLength); /// /// Type of checksum to add to log /// public enum LogChecksumType { /// /// No checksums /// None, /// /// Checksum per entry /// PerEntry } /// /// FASTER Log Settings /// public class FasterLogSettings { /// /// Device used for log /// public IDevice LogDevice = new NullDevice(); /// /// Size of a page, in bits /// public int PageSizeBits = 22; /// /// Total size of in-memory part of log, in bits /// Should be at least one page long /// Num pages = 2^(MemorySizeBits-PageSizeBits) /// public int MemorySizeBits = 23; /// /// Size of a segment (group of pages), in bits /// This is the granularity of files on disk /// public int SegmentSizeBits = 30; /// /// Log commit manager /// public ILogCommitManager LogCommitManager = null; /// /// Use specified directory for storing and retrieving checkpoints /// This is a shortcut to providing the following: /// FasterLogSettings.LogCommitManager = new LocalLogCommitManager(LogCommitFile) /// public string LogCommitFile = null; /// /// User callback to allocate memory for read entries /// public GetMemory GetMemory = null; /// /// Type of checksum to add to log /// public LogChecksumType LogChecksum = LogChecksumType.None; internal LogSettings GetLogSettings() { return new LogSettings { LogDevice = LogDevice, PageSizeBits = PageSizeBits, SegmentSizeBits = SegmentSizeBits, MemorySizeBits = MemorySizeBits, CopyReadsToTail = false, MutableFraction = 0, ObjectLogDevice = null, ReadCacheSettings = null }; } } }