Skip to content

Commit

Permalink
Remove resolve parameter from createSnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
wenkokke committed Dec 10, 2024
1 parent 623417b commit c7d5451
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/Database/LSMTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,18 @@ retrieveBlobs (Internal.Session' (sesh :: Internal.Session m h)) refs =
-------------------------------------------------------------------------------}

{-# SPECIALISE createSnapshot ::
ResolveValue v
=> Common.SnapshotLabel
Common.SnapshotLabel
-> SnapshotName
-> Table IO k v b
-> IO () #-}
createSnapshot :: forall m k v b.
( IOLike m
, ResolveValue v
)
IOLike m
=> Common.SnapshotLabel
-> SnapshotName
-> Table m k v b
-> m ()
createSnapshot label snap (Internal.Table' t) =
void $ Internal.createSnapshot (resolve (Proxy @v)) snap label Internal.SnapFullTable t
void $ Internal.createSnapshot snap label Internal.SnapFullTable t

{-# SPECIALISE openSnapshot ::
ResolveValue v
Expand Down
10 changes: 3 additions & 7 deletions src/Database/LSMTree/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ import Database.LSMTree.Internal.Snapshot.Codec
import Database.LSMTree.Internal.UniqCounter
import qualified Database.LSMTree.Internal.WriteBuffer as WB
import qualified Database.LSMTree.Internal.WriteBufferBlobs as WBB
import qualified Database.LSMTree.Internal.WriteBufferWriter as WBW
import qualified System.FS.API as FS
import System.FS.API (FsError, FsErrorPath (..), FsPath, HasFS)
import qualified System.FS.BlockIO.API as FS
import System.FS.BlockIO.API (HasBlockIO)
import Database.LSMTree.Internal.WriteBufferReader (readWriteBuffer)

{-------------------------------------------------------------------------------
Existentials
Expand Down Expand Up @@ -1069,22 +1067,20 @@ readCursorWhile resolve keyIsWanted n Cursor {..} fromEntry = do
-------------------------------------------------------------------------------}

{-# SPECIALISE createSnapshot ::
ResolveSerialisedValue
-> SnapshotName
SnapshotName
-> SnapshotLabel
-> SnapshotTableType
-> Table IO h
-> IO () #-}
-- | See 'Database.LSMTree.Normal.createSnapshot''.
createSnapshot ::
(MonadMask m, MonadMVar m, MonadST m, MonadSTM m)
=> ResolveSerialisedValue
-> SnapshotName
=> SnapshotName
-> SnapshotLabel
-> SnapshotTableType
-> Table m h
-> m ()
createSnapshot resolve snap label tableType t = do
createSnapshot snap label tableType t = do
traceWith (tableTracer t) $ TraceSnapshot snap
withOpenTable t $ \thEnv ->
withTempRegistry $ \reg -> do -- TODO: use the temp registry for all side effects
Expand Down
9 changes: 3 additions & 6 deletions src/Database/LSMTree/Monoidal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,7 @@ mupserts t = updates t . fmap (second Mupsert)
-------------------------------------------------------------------------------}

{-# SPECIALISE createSnapshot ::
ResolveValue v
=> Common.SnapshotLabel
Common.SnapshotLabel
-> SnapshotName
-> Table IO k v
-> IO () #-}
Expand All @@ -545,15 +544,13 @@ mupserts t = updates t . fmap (second Mupsert)
-- the snapshot names are distinct (otherwise this would be a race).
--
createSnapshot :: forall m k v.
( IOLike m
, ResolveValue v
)
IOLike m
=> Common.SnapshotLabel
-> SnapshotName
-> Table m k v
-> m ()
createSnapshot label snap (Internal.MonoidalTable t) =
Internal.createSnapshot (resolve @v Proxy) snap label Internal.SnapMonoidalTable t
Internal.createSnapshot snap label Internal.SnapMonoidalTable t

{-# SPECIALISE openSnapshot ::
ResolveValue v
Expand Down
2 changes: 1 addition & 1 deletion src/Database/LSMTree/Normal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ createSnapshot :: forall m k v b.
-> Table m k v b
-> m ()
createSnapshot label snap (Internal.NormalTable t) =
Internal.createSnapshot const snap label Internal.SnapNormalTable t
Internal.createSnapshot snap label Internal.SnapNormalTable t

{-# SPECIALISE openSnapshot ::
Session IO
Expand Down

0 comments on commit c7d5451

Please sign in to comment.