summaryrefslogtreecommitdiff
path: root/src/Erebos/Storage/Internal.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-06-14 15:22:03 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-06-14 15:46:30 +0200
commita8b7cde0814481647d4d2b2aa2ee93a3b04a3251 (patch)
treee184123ed73e118e395f1b76b9a6429778c57083 /src/Erebos/Storage/Internal.hs
parent2e7a2aad5680eeabe2694de3b6637e4c8ce9a16c (diff)
Drop partial version of Stored typeHEADmaster
Diffstat (limited to 'src/Erebos/Storage/Internal.hs')
-rw-r--r--src/Erebos/Storage/Internal.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Erebos/Storage/Internal.hs b/src/Erebos/Storage/Internal.hs
index 303beb3..db211bb 100644
--- a/src/Erebos/Storage/Internal.hs
+++ b/src/Erebos/Storage/Internal.hs
@@ -20,7 +20,7 @@ module Erebos.Storage.Internal (
Generation(..),
HeadID(..), HeadTypeID(..),
- Stored'(..), storedStorage,
+ Stored(..), storedStorage,
) where
import Control.Arrow
@@ -37,6 +37,7 @@ import Data.ByteArray qualified as BA
import Data.ByteString (ByteString)
import Data.ByteString.Char8 qualified as BC
import Data.ByteString.Lazy qualified as BL
+import Data.Function
import Data.HashTable.IO qualified as HT
import Data.Hashable
import Data.Kind
@@ -239,17 +240,20 @@ newtype HeadID = HeadID UUID
newtype HeadTypeID = HeadTypeID UUID
deriving (Eq, Ord)
-data Stored' c a = Stored (Ref' c) a
+data Stored a = Stored
+ { storedRef' :: Ref
+ , storedObject' :: a
+ }
deriving (Show)
-instance Eq (Stored' c a) where
- Stored r1 _ == Stored r2 _ = refDigest r1 == refDigest r2
+instance Eq (Stored a) where
+ (==) = (==) `on` (refDigest . storedRef')
-instance Ord (Stored' c a) where
- compare (Stored r1 _) (Stored r2 _) = compare (refDigest r1) (refDigest r2)
+instance Ord (Stored a) where
+ compare = compare `on` (refDigest . storedRef')
-storedStorage :: Stored' c a -> Storage' c
-storedStorage (Stored (Ref st _) _) = st
+storedStorage :: Stored a -> Storage
+storedStorage = refStorage . storedRef'
type Complete = Identity