diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1f2baa..f7545a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: run: | cabal configure --enable-tests --enable-benchmarks --test-show-details=direct - - uses: actions/cache@v2 + - uses: actions/cache@v3 name: Cache ~/.cabal/store and build files with: path: | @@ -86,7 +86,7 @@ jobs: enable-stack: true stack-version: latest - - uses: actions/cache@v2 + - uses: actions/cache@v3 name: Cache ~/.stack with: path: | diff --git a/haskey.cabal b/haskey.cabal index 0481f82..5996369 100644 --- a/haskey.cabal +++ b/haskey.cabal @@ -62,7 +62,7 @@ library bytestring >=0.10 && <1, containers >=0.5 && <1, directory >=1.2 && <2, - exceptions >=0.8.3 && <0.11, + exceptions >=0.8.3 && <0.12, filepath >=1.4 && <2, focus >=0.1.2 && <0.2 || >= 1.0 && < 1.1, haskey-btree >=0.3.0.0 && <0.4, @@ -71,9 +71,9 @@ library mtl >=2.1 && <3, semigroups >=0.12 && <1, stm >=2.1 && <3, - stm-containers >=0.2 && <1 || >= 1.1 && < 1.2, + stm-containers >=0.2 && <1 || >= 1.1 && < 1.3, transformers >=0.3 && <1, - unix >=2.7.1.0 && <3, + unix >=2.7.1.0 && <2.9, xxhash-ffi >=0.1.0.1 && <1, hashable @@ -122,7 +122,7 @@ test-suite haskey-integration bytestring >=0.10 && <1, containers >=0.5 && <1, directory >=1.2 && <2, - exceptions >=0.8.3 && <0.11, + exceptions >=0.8.3 && <0.12, mtl >=2.1 && <3, transformers >=0.3 && <1, temporary >=1.2 && <1.4, @@ -151,7 +151,7 @@ test-suite haskey-example async >=2.1 && <3, bytestring >=0.6 && <0.9 || >0.9 && <1, directory >=1.2 && <2, - exceptions >=0.8.3 && <0.11, + exceptions >=0.8.3 && <0.12, random >=1.1 && <2, text >=1.2 && <2 diff --git a/src-unix/FileIO.hs b/src-unix/FileIO.hs index 33bed12..618fb43 100644 --- a/src-unix/FileIO.hs +++ b/src-unix/FileIO.hs @@ -20,7 +20,6 @@ module FileIO ( import Prelude hiding (read) import qualified Prelude as P -import Control.Applicative ((<$>)) import Control.Exception (SomeException(..), throw, try) import Control.Monad (void) @@ -42,6 +41,7 @@ import System.Posix (Fd, fileSynchronise, closeFd, OpenMode(ReadWrite), + OpenFileFlags(..), exclusive, trunc, defaultFileFlags, stdFileMode) @@ -61,7 +61,7 @@ newtype FHandle = FHandle Fd -- | Open the specified file in read-write mode. openReadWrite :: FilePath -> IO FHandle openReadWrite filename = - FHandle <$> openFd filename ReadWrite (Just stdFileMode) defaultFileFlags + FHandle <$> openFd filename ReadWrite (defaultFileFlags { creat = Just stdFileMode }) -- | Write **at most** the specified amount of bytes to a handle. write :: FHandle -> Ptr Word8 -> Word64 -> IO Word64 @@ -174,7 +174,7 @@ checkBreakError e | SE.isDoesNotExistError e = return () takeLock :: FilePath -> IO PrefixLock takeLock fp = do createDirectoryIfMissing True (takeDirectory fp) - h <- openFd fp ReadWrite (Just 0o600) (defaultFileFlags {exclusive = True, trunc = True}) >>= fdToHandle + h <- openFd fp ReadWrite (defaultFileFlags {creat = Just stdFileMode, exclusive = True, trunc = True}) >>= fdToHandle pid <- getProcessID hPrint h pid >> hClose h -- Read back our own lock and make sure its still ours diff --git a/src/Database/Haskey/Store/File.hs b/src/Database/Haskey/Store/File.hs index 4ead912..944e653 100644 --- a/src/Database/Haskey/Store/File.hs +++ b/src/Database/Haskey/Store/File.hs @@ -29,7 +29,7 @@ module Database.Haskey.Store.File ( , WrongOverflowValueError(..) ) where -import Control.Applicative (Applicative, (<$>)) +import Control.Applicative (Applicative) import Control.Monad import Control.Monad.Catch import Control.Monad.IO.Class @@ -39,7 +39,6 @@ import Control.Monad.Trans.State.Strict ( StateT, evalStateT) import Data.Map (Map) import Data.Maybe (fromJust) -import Data.Monoid ((<>)) import Data.Typeable (Typeable, cast) import Data.Word (Word64) import qualified Data.ByteString.Lazy as BL @@ -49,7 +48,7 @@ import qualified FileIO as IO import System.Directory (createDirectoryIfMissing, removeFile, getDirectoryContents) import System.FilePath (takeDirectory) -import System.IO.Error (ioError, isDoesNotExistError) +import System.IO.Error (isDoesNotExistError) import Data.BTree.Impure.Internal.Structures import Data.BTree.Primitives diff --git a/src/Database/Haskey/Store/InMemory.hs b/src/Database/Haskey/Store/InMemory.hs index 990148b..479fafa 100644 --- a/src/Database/Haskey/Store/InMemory.hs +++ b/src/Database/Haskey/Store/InMemory.hs @@ -29,7 +29,7 @@ module Database.Haskey.Store.InMemory ( , WrongOverflowValueError(..) ) where -import Control.Applicative (Applicative, (<$>)) +import Control.Applicative (Applicative) import Control.Concurrent.MVar import Control.Monad import Control.Monad.Catch diff --git a/src/Database/Haskey/Store/Page.hs b/src/Database/Haskey/Store/Page.hs index 22e9c02..1e236ea 100644 --- a/src/Database/Haskey/Store/Page.hs +++ b/src/Database/Haskey/Store/Page.hs @@ -12,7 +12,6 @@ module Database.Haskey.Store.Page where import Codec.Compression.LZ4 -import Control.Applicative ((<$>)) import Control.Monad.Catch import Data.Binary (Binary(..), Put, Get) diff --git a/stack.yaml b/stack.yaml index b31b7fc..7ebf2ed 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-9.0 +resolver: lts-22.44 packages: - '.' extra-deps: @@ -10,3 +10,4 @@ extra-deps: - xxhash-ffi-0.2.0.0 flags: {} extra-package-dbs: [] +allow-newer: true diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..adbf52a --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,44 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: +- completed: + commit: 4ff3a73d8eb480902478772f1be5515967624ff6 + git: https://github.com/haskell-haskey/haskey-btree + name: haskey-btree + pantry-tree: + sha256: 498f1d5f7f2be3ab180f345f4a8647ecf04b417be62094e6dbdcfe1337890fbe + size: 3355 + version: 0.3.0.0 + original: + commit: 4ff3a73d8eb480902478772f1be5515967624ff6 + git: https://github.com/haskell-haskey/haskey-btree +- completed: + hackage: lz4-0.2.3.1@sha256:9d286f1c8e3e3aab86ebb8cd39b485af57c0a05d9da5baf921641012a3c83cf0,1821 + pantry-tree: + sha256: 3a3c17d888e05430d441ddaef9cd3e350321dd7a1c60128efed92814d8dd65e3 + size: 666 + original: + hackage: lz4-0.2.3.1 +- completed: + hackage: numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430 + pantry-tree: + sha256: c616791b08f1792fd1d4ca03c6d2c773dedb25b24b66454c97864aefd85a5d0a + size: 13751 + original: + hackage: numerals-0.4.1 +- completed: + hackage: xxhash-ffi-0.2.0.0@sha256:0b4c4fc2730dcfd5216be19a4a00bac172bcd522b18777dab23fda954feedf96,2067 + pantry-tree: + sha256: 3099ccadce40020ac34f76674427a801aad8518a2173d5ef1f444901f317e347 + size: 565 + original: + hackage: xxhash-ffi-0.2.0.0 +snapshots: +- completed: + sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9 + size: 721141 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/44.yaml + original: lts-22.44 diff --git a/tests/Integration/WriteOpenRead/Transactions.hs b/tests/Integration/WriteOpenRead/Transactions.hs index b587dcf..6fbb380 100644 --- a/tests/Integration/WriteOpenRead/Transactions.hs +++ b/tests/Integration/WriteOpenRead/Transactions.hs @@ -4,6 +4,7 @@ module Integration.WriteOpenRead.Transactions where import Test.QuickCheck import Control.Applicative ((<$>), (<*>), pure) +import Control.Monad (replicateM) import Control.Monad.State import Data.Foldable (foldlM)