Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Database.LSMTree.Internal.Config
Synopsis
- newtype LevelNo = LevelNo Int
- data TableConfig = TableConfig {}
- defaultTableConfig :: TableConfig
- data RunLevelNo
- runParamsForLevel :: TableConfig -> RunLevelNo -> RunParams
- data TableConfigOverride
- applyOverride :: TableConfigOverride -> TableConfig -> TableConfig
- configNoOverride :: TableConfigOverride
- configOverrideDiskCachePolicy :: DiskCachePolicy -> TableConfigOverride
- data MergePolicy = MergePolicyLazyLevelling
- data SizeRatio = Four
- sizeRatioInt :: SizeRatio -> Int
- data WriteBufferAlloc = AllocNumEntries !NumEntries
- data BloomFilterAlloc
- defaultBloomFilterAlloc :: BloomFilterAlloc
- bloomFilterAllocForLevel :: TableConfig -> RunLevelNo -> RunBloomFilterAlloc
- data FencePointerIndexType
- indexTypeForRun :: FencePointerIndexType -> IndexType
- data DiskCachePolicy
- diskCachePolicyForLevel :: DiskCachePolicy -> RunLevelNo -> RunDataCaching
- data MergeSchedule
- defaultMergeSchedule :: MergeSchedule
Documentation
Instances
Enum LevelNo Source # | |
Show LevelNo Source # | |
NFData LevelNo Source # | |
Defined in Database.LSMTree.Internal.Config | |
Eq LevelNo Source # | |
Ord LevelNo Source # | |
Defined in Database.LSMTree.Internal.Config |
Table configuration
data TableConfig Source #
Table configuration parameters, including LSM tree tuning parameters.
Some config options are fixed (for now):
- Merge policy: Tiering
- Size ratio: 4
Constructors
TableConfig | |
Fields
|
Instances
Show TableConfig Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> TableConfig -> ShowS # show :: TableConfig -> String # showList :: [TableConfig] -> ShowS # | |
NFData TableConfig Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: TableConfig -> () # | |
Eq TableConfig Source # | |
Defined in Database.LSMTree.Internal.Config | |
DecodeVersioned TableConfig Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s TableConfig Source # | |
Encode TableConfig Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: TableConfig -> Encoding Source # |
defaultTableConfig :: TableConfig Source #
A reasonable default TableConfig
.
This uses a write buffer with up to 20,000 elements and a generous amount of memory for Bloom filters (FPR of 2%).
data RunLevelNo Source #
Constructors
RegularLevel LevelNo | |
UnionLevel |
runParamsForLevel :: TableConfig -> RunLevelNo -> RunParams Source #
Table configuration override
data TableConfigOverride Source #
Override configuration options in TableConfig
that can be changed dynamically.
Some parts of the TableConfig
are considered fixed after a table is
created. That is, these options should (i) should stay the same over the
lifetime of a table, and (ii) these options should not be changed when a
snapshot is created or loaded. Other options can be changed dynamically
without sacrificing correctness.
This type has Semigroup
and Monoid
instances for composing override
options.
Instances
Monoid TableConfigOverride Source # | Behaves like a point-wise |
Defined in Database.LSMTree.Internal.Config Methods mempty :: TableConfigOverride # mappend :: TableConfigOverride -> TableConfigOverride -> TableConfigOverride # | |
Semigroup TableConfigOverride Source # | Behaves like a point-wise |
Defined in Database.LSMTree.Internal.Config Methods (<>) :: TableConfigOverride -> TableConfigOverride -> TableConfigOverride # sconcat :: NonEmpty TableConfigOverride -> TableConfigOverride # stimes :: Integral b => b -> TableConfigOverride -> TableConfigOverride # | |
Show TableConfigOverride Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> TableConfigOverride -> ShowS # show :: TableConfigOverride -> String # showList :: [TableConfigOverride] -> ShowS # |
Merge policy
data MergePolicy Source #
Constructors
MergePolicyLazyLevelling | Use tiering on intermediate levels, and levelling on the last level. This makes it easier for delete operations to disappear on the last level. |
Instances
Show MergePolicy Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> MergePolicy -> ShowS # show :: MergePolicy -> String # showList :: [MergePolicy] -> ShowS # | |
NFData MergePolicy Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: MergePolicy -> () # | |
Eq MergePolicy Source # | |
Defined in Database.LSMTree.Internal.Config | |
DecodeVersioned MergePolicy Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s MergePolicy Source # | |
Encode MergePolicy Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: MergePolicy -> Encoding Source # |
Size ratio
Constructors
Four |
Instances
Show SizeRatio Source # | |
NFData SizeRatio Source # | |
Defined in Database.LSMTree.Internal.Config | |
Eq SizeRatio Source # | |
DecodeVersioned SizeRatio Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s SizeRatio Source # | |
Encode SizeRatio Source # | |
sizeRatioInt :: SizeRatio -> Int Source #
Write buffer allocation
data WriteBufferAlloc Source #
Allocation method for the write buffer.
Constructors
AllocNumEntries !NumEntries | Total number of key/value pairs that can be present in the write buffer before flushing the write buffer to disk. NOTE: if the sizes of values vary greatly, this can lead to wonky runs on disk, and therefore unpredictable performance. |
Instances
Show WriteBufferAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> WriteBufferAlloc -> ShowS # show :: WriteBufferAlloc -> String # showList :: [WriteBufferAlloc] -> ShowS # | |
NFData WriteBufferAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: WriteBufferAlloc -> () # | |
Eq WriteBufferAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods (==) :: WriteBufferAlloc -> WriteBufferAlloc -> Bool # (/=) :: WriteBufferAlloc -> WriteBufferAlloc -> Bool # | |
DecodeVersioned WriteBufferAlloc Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s WriteBufferAlloc Source # | |
Encode WriteBufferAlloc Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: WriteBufferAlloc -> Encoding Source # |
Bloom filter allocation
data BloomFilterAlloc Source #
Allocation method for bloom filters.
NOTE: a physical database entry is a key/operation pair that exists in a file, i.e., a run. Multiple physical entries that have the same key constitute a logical database entry.
Constructors
AllocFixed | Allocate a fixed number of bits per physical entry in each bloom filter. |
Fields
| |
AllocRequestFPR | Allocate as many bits as required per physical entry to get the requested false-positive rate. Do this for each bloom filter. |
Fields
|
Instances
Show BloomFilterAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> BloomFilterAlloc -> ShowS # show :: BloomFilterAlloc -> String # showList :: [BloomFilterAlloc] -> ShowS # | |
NFData BloomFilterAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: BloomFilterAlloc -> () # | |
Eq BloomFilterAlloc Source # | |
Defined in Database.LSMTree.Internal.Config Methods (==) :: BloomFilterAlloc -> BloomFilterAlloc -> Bool # (/=) :: BloomFilterAlloc -> BloomFilterAlloc -> Bool # | |
DecodeVersioned BloomFilterAlloc Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s BloomFilterAlloc Source # | |
Encode BloomFilterAlloc Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: BloomFilterAlloc -> Encoding Source # |
Fence pointer index
data FencePointerIndexType Source #
Configure the type of fence pointer index.
Constructors
CompactIndex | Use a compact fence pointer index. Compact indexes are designed to work with keys that are large (for example, 32 bytes long) cryptographic hashes. When using a compact index, it is vital that the
Use |
OrdinaryIndex | Use an ordinary fence pointer index Ordinary indexes do not have any constraints on keys other than that their serialised forms may not be 64 KiB or more in size. |
Instances
Show FencePointerIndexType Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> FencePointerIndexType -> ShowS # show :: FencePointerIndexType -> String # showList :: [FencePointerIndexType] -> ShowS # | |
NFData FencePointerIndexType Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: FencePointerIndexType -> () # | |
Eq FencePointerIndexType Source # | |
Defined in Database.LSMTree.Internal.Config Methods (==) :: FencePointerIndexType -> FencePointerIndexType -> Bool # (/=) :: FencePointerIndexType -> FencePointerIndexType -> Bool # | |
DecodeVersioned FencePointerIndexType Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s FencePointerIndexType Source # | |
Encode FencePointerIndexType Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods |
Disk cache policy
data DiskCachePolicy Source #
The policy for caching data from disk in memory (using the OS page cache).
Caching data in memory can improve performance if the access pattern has good access locality or if the overall data size fits within memory. On the other hand, caching is determental to performance and wastes memory if the access pattern has poor spatial or temporal locality.
This implementation is designed to have good performance using a cacheless policy, where main memory is used only to cache Bloom filters and indexes, but none of the key/value data itself. Nevertheless, some use cases will be faster if some or all of the key/value data is also cached in memory. This implementation does not do any custom caching of key/value data, relying simply on the OS page cache. Thus caching is done in units of 4kb disk pages (as opposed to individual key/value pairs for example).
Constructors
DiskCacheAll | Use the OS page cache to cache any/all key/value data in the table. Use this policy if the expected access pattern for the table has a good spatial or temporal locality. |
DiskCacheLevelsAtOrBelow !Int | Use the OS page cache to cache data in all LSMT levels at or below a given level number. For example, use 1 to cache the first level. (The write buffer is considered to be level 0.) Use this policy if the expected access pattern for the table has good temporal locality for recently inserted keys. |
DiskCacheNone | Do not cache any key/value data in any level (except the write buffer). Use this policy if expected access pattern for the table has poor spatial or temporal locality, such as uniform random access. |
Instances
Show DiskCachePolicy Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> DiskCachePolicy -> ShowS # show :: DiskCachePolicy -> String # showList :: [DiskCachePolicy] -> ShowS # | |
NFData DiskCachePolicy Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: DiskCachePolicy -> () # | |
Eq DiskCachePolicy Source # | |
Defined in Database.LSMTree.Internal.Config Methods (==) :: DiskCachePolicy -> DiskCachePolicy -> Bool # (/=) :: DiskCachePolicy -> DiskCachePolicy -> Bool # | |
DecodeVersioned DiskCachePolicy Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s DiskCachePolicy Source # | |
Encode DiskCachePolicy Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: DiskCachePolicy -> Encoding Source # |
diskCachePolicyForLevel :: DiskCachePolicy -> RunLevelNo -> RunDataCaching Source #
Interpret the DiskCachePolicy
for a level: should we cache data in runs
at this level.
Merge schedule
data MergeSchedule Source #
A configuration option that determines how merges are stepped to completion. This does not affect the amount of work that is done by merges, only how the work is spread out over time.
Constructors
OneShot | Complete merges immediately when started. The |
Incremental | Schedule merges for incremental construction, and step the merge when updates are performed on a table. The |
Instances
Show MergeSchedule Source # | |
Defined in Database.LSMTree.Internal.Config Methods showsPrec :: Int -> MergeSchedule -> ShowS # show :: MergeSchedule -> String # showList :: [MergeSchedule] -> ShowS # | |
NFData MergeSchedule Source # | |
Defined in Database.LSMTree.Internal.Config Methods rnf :: MergeSchedule -> () # | |
Eq MergeSchedule Source # | |
Defined in Database.LSMTree.Internal.Config Methods (==) :: MergeSchedule -> MergeSchedule -> Bool # (/=) :: MergeSchedule -> MergeSchedule -> Bool # | |
DecodeVersioned MergeSchedule Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods decodeVersioned :: SnapshotVersion -> Decoder s MergeSchedule Source # | |
Encode MergeSchedule Source # | |
Defined in Database.LSMTree.Internal.Snapshot.Codec Methods encode :: MergeSchedule -> Encoding Source # |
defaultMergeSchedule :: MergeSchedule Source #
The default MergeSchedule
.
>>>
defaultMergeSchedule
Incremental