summaryrefslogtreecommitdiff
path: root/src/Erebos/Object
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-02-09 09:48:34 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-02-09 20:53:59 +0100
commit3ab6a143f95dad46cee526b709a2687bb28e985b (patch)
tree0fc3bb709ee9fbdf24d291cd4d68d0578ce06c80 /src/Erebos/Object
parentf6051eb3ebe2c50cdcde44abf6d071f0b5bdbb8f (diff)
Export accessor to storage backend objectHEADmaster
Diffstat (limited to 'src/Erebos/Object')
-rw-r--r--src/Erebos/Object/Internal.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Erebos/Object/Internal.hs b/src/Erebos/Object/Internal.hs
index 1e65321..45fd924 100644
--- a/src/Erebos/Object/Internal.hs
+++ b/src/Erebos/Object/Internal.hs
@@ -47,6 +47,8 @@ module Erebos.Object.Internal (
) where
import Control.Applicative
+import Control.DeepSeq
+import Control.Exception
import Control.Monad
import Control.Monad.Except
import Control.Monad.Reader
@@ -201,6 +203,12 @@ storeObject = unsafeStoreObject
storeRawBytes :: PartialStorage -> BL.ByteString -> IO PartialRef
storeRawBytes = unsafeStoreRawBytes
+unsafeStoreRawBytes :: Storage' c -> BL.ByteString -> IO (Ref' c)
+unsafeStoreRawBytes st@Storage {..} raw = do
+ dgst <- evaluate $ force $ hashToRefDigest raw
+ backendStoreBytes stBackend dgst raw
+ return $ Ref st dgst
+
serializeRecItem :: ByteString -> RecItem' c -> [ByteString]
serializeRecItem name (RecEmpty) = [name, BC.pack ":e", BC.singleton ' ', BC.singleton '\n']
serializeRecItem name (RecInt x) = [name, BC.pack ":i", BC.singleton ' ', BC.pack (show x), BC.singleton '\n']