From cfdbb5b70abcede5e9ed980db5dd12a6764bb3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 16 Jul 2022 17:20:29 +0200 Subject: Test: store command for arbitrary type and data --- src/Storage.hs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/Storage.hs') diff --git a/src/Storage.hs b/src/Storage.hs index cc2476f..e1bce3c 100644 --- a/src/Storage.hs +++ b/src/Storage.hs @@ -52,14 +52,12 @@ module Storage ( beginHistory, modifyHistory, ) where -import Codec.Compression.Zlib import qualified Codec.MIME.Type as MIME import qualified Codec.MIME.Parse as MIME import Control.Applicative import Control.Arrow import Control.Concurrent -import Control.DeepSeq import Control.Exception import Control.Monad import Control.Monad.Except @@ -247,16 +245,6 @@ storeObject = unsafeStoreObject storeRawBytes :: PartialStorage -> BL.ByteString -> IO PartialRef storeRawBytes = unsafeStoreRawBytes -unsafeStoreRawBytes :: Storage' c -> BL.ByteString -> IO (Ref' c) -unsafeStoreRawBytes st raw = do - let dgst = hashToRefDigest raw - case stBacking st of - StorageDir { dirPath = sdir } -> writeFileOnce (refPath sdir dgst) $ compress raw - StorageMemory { memObjs = tobjs } -> - dgst `deepseq` -- the TVar may be accessed when evaluating the data to be written - modifyMVar_ tobjs (return . M.insert dgst raw) - return $ Ref st dgst - serializeRecItem :: ByteString -> RecItem' c -> [ByteString] serializeRecItem name (RecInt x) = [name, BC.pack ":i", BC.singleton ' ', BC.pack (show x), BC.singleton '\n'] serializeRecItem name (RecNum x) = [name, BC.pack ":n", BC.singleton ' ', BC.pack (showRatio x), BC.singleton '\n'] -- cgit v1.2.3