summaryrefslogtreecommitdiff
path: root/src/Storage.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-08-27 17:21:50 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-08-30 20:53:55 +0200
commit4c2e86ddd75f0e655fcb21aa8597dc71ce5330be (patch)
tree19af5664452cfd4a76f5fb2a5f3c2c999a30fe13 /src/Storage.hs
parentb2278c50bfce8d8c6f80d04822ecedf42081659d (diff)
Call refStorage only internally in Storage modules
Diffstat (limited to 'src/Storage.hs')
-rw-r--r--src/Storage.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Storage.hs b/src/Storage.hs
index 47477df..93a34c5 100644
--- a/src/Storage.hs
+++ b/src/Storage.hs
@@ -4,7 +4,7 @@ module Storage (
deriveEphemeralStorage, derivePartialStorage,
Ref, PartialRef, RefDigest,
- refStorage, refDigest,
+ refDigest,
readRef, showRef, showRefDigest,
refDigestFromByteString, hashToRefDigest,
copyRef, partialRef, partialRefFromDigest,
@@ -18,7 +18,7 @@ module Storage (
Head, HeadType(..),
HeadTypeID, mkHeadTypeID,
- headId, headRef, headObject, headStoredObject,
+ headId, headStorage, headRef, headObject, headStoredObject,
loadHeads, loadHead, reloadHead,
storeHead, replaceHead, updateHead, updateHead_,
@@ -359,6 +359,9 @@ type Head = Head' Complete
headId :: Head a -> HeadID
headId (Head uuid _) = uuid
+headStorage :: Head a -> Storage
+headStorage = refStorage . headRef
+
headRef :: Head a -> Ref
headRef (Head _ sx) = storedRef sx
@@ -431,7 +434,7 @@ storeHead st obj = liftIO $ do
replaceHead :: forall a m. (HeadType a, MonadIO m) => Head a -> Stored a -> m (Either (Maybe (Head a)) (Head a))
replaceHead prev@(Head hid pobj) stored = liftIO $ do
- let st = storedStorage pobj
+ let st = headStorage prev
tid = headTypeID @a Proxy
case stBacking st of
StorageDir { dirPath = spath } -> do