import qualified Data.Map.Strict as Map
import Database.LSMTree.Common (Range (..),
SomeSerialisationConstraint (..))
-
import Database.LSMTree.Normal (Update (..))
+
import Database.LSMTree.Normal (LookupResult (..),
+
RangeLookupResult (..), Update (..))
import GHC.Exts (IsList (..))
{-------------------------------------------------------------------------------
Table querying and updates
-------------------------------------------------------------------------------}
-
-- | Result of a single point lookup.
-
data LookupResult k v blob =
-
| FoundWithBlob !k !v !(BlobRef blob)
-
-- Note: unfortunately we have to copy these types, as we need to implement BlobRef.
-- | Perform a batch of lookups.
-- Lookups can be performed concurrently from multiple Haskell threads.
(SomeSerialisationConstraint k, SomeSerialisationConstraint v)
-
-> [LookupResult k v blob]
+
-> [LookupResult k v (BlobRef blob)]
[ case Map.lookup (serialise k) (_values tbl) of
-
-- | A result for one point in a range lookup.
-
data RangeLookupResult k v blob =
-
| FoundInRangeWithBlob !k !v !(BlobRef blob)
-- | Perform a range lookup.
-- Range lookups can be performed concurrently from multiple Haskell threads.
rangeLookup :: forall k v blob.
(SomeSerialisationConstraint k, SomeSerialisationConstraint v)
-
-> [RangeLookupResult k v blob]
+
-> [RangeLookupResult k v (BlobRef blob)]
(v', Nothing) -> FoundInRange (deserialise k) (deserialise v')