Copyright | (c) 2015 Călin Ardelean |
---|---|
License | MIT |
Maintainer | Călin Ardelean <calinucs@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions | MultiWayIf |
Unique DocumentKey
allocation functions.
Since we use IntMap
s for our indexes, a (faster) auto-incremented key
will be exhausted on 32 bit machines before we reach a maxBound
number
of documents, because deleted keys cannot be reused.
This module should be imported qualified.
Documentation
reserve :: DocumentKey -> IdSupply -> IdSupply Source
Removes a key from the supply. Used during log loading.
alloc :: IdSupply -> (DocumentKey, IdSupply) Source
Allocates a fresh key from the supply.
Favours smallest numbers. For instance, after a document is deleted and
garbage collected, the DocumentKey
of that document typically becomes
the smallest, and thus the first available.
For this reason, IdSupply
will normally be small and efficient.