packages feed

acid-state 0.11.0 → 0.11.1

raw patch · 2 files changed

+27/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

acid-state.cabal view
@@ -1,5 +1,5 @@ Name:                acid-state-Version:             0.11.0+Version:             0.11.1 Synopsis:            Add ACID guarantees to any serializable Haskell data structure. Description:         Use regular Haskell data structures as your database and get stronger ACID guarantees than most RDBMS offer. Homepage:            http://acid-state.seize.it/
src/Data/Acid/Archive.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DoAndIfThenElse #-} {- Format:  |content length| crc16   | content |@@ -70,7 +71,31 @@ readEntry     = do contentLength <- getWord64le          contentChecksum <-getWord16le-         content <- getLazyByteString (fromIntegral contentLength)+         content <- getLazyByteString_fast (fromIntegral contentLength)          if crc16 content /= contentChecksum            then fail "Invalid hash"            else return content++-- | Read a lazy bytestring WITHOUT any copying or concatenation.+getLazyByteString_fast :: Int -> Get Lazy.ByteString+getLazyByteString_fast = worker 0 []+  where+    worker counter acc n = do+      rem <- remaining+      if n > rem then do+         chunk <- getBytes rem+         _ <- ensure 1+         worker (counter + rem) (chunk:acc) (n-rem)+      else do+         chunk <- getBytes n+         return $ Lazy.fromChunks (reverse $ chunk:acc)++++++++++