packages feed

lmdb-simple 0.3.1.0 → 0.4.0.0

raw patch · 7 files changed

+36/−16 lines, 7 filesdep ~serialisePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: serialise

API changes (from Hackage documentation)

+ Database.LMDB.Simple: readOnlyEnvironment :: Environment ReadWrite -> Environment ReadOnly

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright Robert Leslie (c) 2017+Copyright Robert Leslie (c) 2017-2018  All rights reserved. 
README.md view
@@ -8,8 +8,8 @@   [LMDB]: https://symas.com/lightning-memory-mapped-database/  LMDB is a high-performance [ACID][]-compliant no-maintenance read-optimized-key-value store. Any Haskell value with a [`Serialise`][Serialise] instance-can be stored in an LMDB database, or used as a key to index one.+key-value store. Any Haskell type with a [`Serialise`][Serialise] instance can+be stored in an LMDB database, or used as a key to index one.    [ACID]: https://en.wikipedia.org/wiki/ACID   [Serialise]: https://hackage.haskell.org/package/serialise/docs/Codec-Serialise-Tutorial.html#g:3
lmdb-simple.cabal view
@@ -1,6 +1,6 @@  name:                lmdb-simple-version:             0.3.1.0+version:             0.4.0.0  synopsis:            Simple API for LMDB @@ -15,7 +15,7 @@  author:              Rob Leslie maintainer:          rob@mars.org-copyright:           © 2017 Robert Leslie+copyright:           © 2017–2018 Robert Leslie  stability:           experimental category:            Database@@ -43,12 +43,11 @@   build-depends:       base >= 4.7 && < 5                      , bytestring >= 0.10 && < 0.11                      , lmdb >= 0.2 && < 0.3-                     , serialise >= 0.1 && < 0.2+                     , serialise >= 0.2 && < 0.3   ghc-options:         -Wall -Wno-name-shadowing -Wno-unused-do-bind   default-language:    Haskell2010   default-extensions:  Trustworthy   other-extensions:    ConstraintKinds-                       KindSignatures                        TypeFamilies  test-suite sample
src/Database/LMDB/Simple.hs view
@@ -4,7 +4,7 @@ {-| Module      : Database.LMDB.Simple Description : Simple Haskell API for LMDB-Copyright   : © 2017 Robert Leslie+Copyright   : © 2017–2018 Robert Leslie License     : BSD3 Maintainer  : rob@mars.org Stability   : experimental@@ -52,6 +52,7 @@   , openEnvironment   , openReadWriteEnvironment   , openReadOnlyEnvironment+  , readOnlyEnvironment   , clearStaleReaders      -- * Transactions@@ -94,6 +95,10 @@   , void   ) +import Data.Coerce+  ( coerce+  )+ import Database.LMDB.Raw   ( LMDB_Error (LMDB_Error, e_code)   , MDB_EnvFlag (MDB_NOSUBDIR, MDB_RDONLY)@@ -211,6 +216,15 @@ openReadOnlyEnvironment :: FilePath -> Limits -> IO (Environment ReadOnly) openReadOnlyEnvironment = openEnvironment +-- | For an LMDB environment opened in 'ReadWrite' mode, return the same+-- environment restricted to 'ReadOnly' mode. This can be used to prevent+-- modification of the environment for a subset of an application while+-- retaining the ability to perform modifications in another subset.+--+-- @since 0.4.0.0+readOnlyEnvironment :: Environment ReadWrite -> Environment ReadOnly+readOnlyEnvironment = coerce+ -- | Check for stale entries in the reader lock table, and return the number -- of entries cleared. clearStaleReaders :: Environment mode -> IO Int@@ -284,7 +298,7 @@           (\e -> let _ = e :: AbortedTransaction in Nothing) Just <$> try io  -- | Explicitly abort the current transaction, nullifying its effects on the--- LMDB environment. No further actions will be performed within the current+-- LMDB environment. No further actions will be performed within the -- transaction. -- -- In a nested transaction, this causes the child transaction to return
src/Database/LMDB/Simple/Internal.hs view
@@ -1,5 +1,4 @@ -{-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-}  module Database.LMDB.Simple.Internal
stack.yaml view
@@ -15,7 +15,7 @@ # resolver: #  name: custom-snapshot #  location: "./custom-snapshot.yaml"-resolver: lts-9.0+resolver: lts-11.1  # User packages to be built. # Various formats can be used as shown in the example below.@@ -40,13 +40,11 @@ # Dependency packages to be pulled from upstream that are not in the resolver # (e.g., acme-missiles-0.3) extra-deps:-- cborg-0.1.1.0-- serialise-0.1.0.0+- cborg-0.2.0.0+- serialise-0.2.0.0  # Override default flag values for local packages and extra-deps-flags:-  serialise:-    newtime15: true+flags: {}  # Extra package databases containing global packages extra-package-dbs: []
test/Database/LMDB/SimpleSpec.hs view
@@ -27,6 +27,16 @@       transaction env (put db 50 Nothing >> (,) <$> get db 50 <*> size db)       `shouldReturn` (Nothing, 99) +    it "correctly serializes non-surrogate chars" $ \(env, db) ->+      let nonSurrogates = [minBound..'\xD7FF'] ++ ['\xE000'..maxBound] in+        transaction env (put db 0 (Just nonSurrogates) >> get db 0)+        `shouldReturn` Just nonSurrogates++    it "correctly serializes surrogate chars" $ \(env, db) ->+      let surrogates = ['\xD800'..'\xDFFF'] in+        transaction env (put db 0 (Just surrogates) >> get db 0)+        `shouldReturn` Just surrogates+   describe "transactions" $ do     it "aborts" $ \(env, db) ->       ( do transaction env $ put db 0 Nothing