From 3ab6a143f95dad46cee526b709a2687bb28e985b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 9 Feb 2026 09:48:34 +0100 Subject: Export accessor to storage backend object --- src/Erebos/Object/Internal.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Erebos/Object/Internal.hs') 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'] -- cgit v1.2.3