megastore 0.1.1.1 → 0.1.1.2
raw patch · 4 files changed
+15/−68 lines, 4 filesdep −megastoredep ~ghc
Dependencies removed: megastore
Dependency ranges changed: ghc
Files
- README.md +1/−1
- app/Main.hs +0/−22
- megastore.cabal +4/−31
- src/MegaStore.hs +10/−14
README.md view
@@ -1,3 +1,3 @@ # MegaStore A Haskell Filetype and Data Structure for super -efficient storage of big image sets as one file +efficient storage of big image sets as one file
− app/Main.hs
@@ -1,22 +0,0 @@-module Main (main) where - -import MegaStore -import Data.Text (pack) -import System.Directory (createDirectoryIfMissing) - -main :: IO () -main = do - a1 <- loadFile "./assets/s1.png" - a2 <- loadFile "./assets/s2.png" - a3 <- loadFile "./assets/s3.png" - a4 <- loadFile "./assets/s4.png" - a5 <- loadFile "./assets/s5.png" - - let testSet = MegaStore [(pack "s1", a1), (pack "s2", a2), (pack "s3", a3), (pack "s4", a4), (pack "s5", a5)] - createDirectoryIfMissing False "./test" - saveStore "./test/testSet" testSet -- keystore of images - print "Loading MegaStore testSet" - loadedContents <- loadStore "./test/testSet.megastore" - print "autoUnpack into ./test" - autoUnpack "./test" loadedContents - print "autoUnpack complete check folder"
megastore.cabal view
@@ -1,11 +1,11 @@-cabal-version: 1.12 +cabal-version: 1.12 -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack name: megastore-version: 0.1.1.1+version: 0.1.1.2 synopsis: Bulk image or strict bytestring storage description: Please see the README on GitHub at <https://github.com/MilesLitteral/megastore/tree/release#readme> category: Data Structures, Data, Image@@ -13,7 +13,7 @@ bug-reports: https://github.com/MilesLitteral/megastore/issues author: Miles J. Litteral maintainer: mandaloe2@gmail.com-copyright: 2023 Miles J. Litteral+copyright: 2026 Miles J. Litteral license: BSD3 license-file: LICENSE build-type: Simple@@ -41,36 +41,9 @@ , bytestring >0.10.0.0 && <=0.11.4.0 , containers >=0.6.4.1 && <=0.6.7 , directory >1.3.0.0 && <=1.3.8.0- , ghc >9.4.3 && <=9.4.4- , hashable >1.2.3.0 && <=1.4.2.0- , lens >5 && <=5.2- , mtl >2.2 && <=2.2.2- , random >=1.1 && <=1.2.1.1- , text >=2.0 && <=2.0.2- , text-show >=3.9.5 && <=3.10- , vector >0.12.1.2 && <=0.13.0.0- , zlib >0.6.0.0 && <=0.6.3.0- default-language: Haskell2010--executable megastore- main-is: Main.hs- other-modules:- Paths_megastore- hs-source-dirs:- app- ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N- build-depends:- JuicyPixels >3.3.4 && <=3.3.8- , adjunctions >4.2 && <=4.4.2- , base >=4.7 && <5- , binary >0.8.0.0 && <=0.8.9.1- , bytestring >0.10.0.0 && <=0.11.4.0- , containers >=0.6.4.1 && <=0.6.7- , directory >1.3.0.0 && <=1.3.8.0- , ghc >9.4.3 && <=9.4.4+ , ghc >=9.0.2 && <=9.4.2 , hashable >1.2.3.0 && <=1.4.2.0 , lens >5 && <=5.2- , megastore , mtl >2.2 && <=2.2.2 , random >=1.1 && <=1.2.1.1 , text >=2.0 && <=2.0.2
src/MegaStore.hs view
@@ -13,23 +13,19 @@ that will efficiently store all images. Here is a quick crash course: @ - a1 <- loadFile "./assets/s1.png" - a2 <- loadFile "./assets/s2.png" - a3 <- loadFile "./assets/s3.png" + a1 <- loadFile "s1.png" + a2 <- loadFile "s2.png" + a3 <- loadFile "s3.png" - let testSet = MegaStore [(pack "s1", a1), (pack "s2", a2), (pack "s3", a3)] - createDirectoryIfMissing False "./test" - saveStore "./test/testSet" testSet -- keystore of images - print "Loading MegaStore testSet" - loadedContents <- loadStore "./test/testSet.megastore" - print "autoUnpack into ./test" - autoUnpack "./test" loadedContents - print "autoUnpack complete check folder" + let testSet = KeyStore [("s1", a1), ("s2", a2), ("s3", a3)] + saveStore "./test/testSet" testSet + + loadedContents <- loadStore "./test/testSet.keystore" + autoUnpack "./results" loadedContents @ -} module MegaStore - ( - -- * Data Types #Data Type# + ( -- * Data Types #Data Type# MegaStore(..) -- * I/O Functions #Functions# , saveStore @@ -131,7 +127,7 @@ -- autoUnpack "./results" loadedContents -- @ createMegaStoreWithBulk :: [BS.ByteString] -> Text -> MegaStore -createMegaStoreWithBulk bytes nameScheme = MegaStore $ zip (map (\x -> showt $ unpack nameScheme ++ show (x :: Integer)) [0..(fromIntegral $ length bytes)]) bytes +createMegaStoreWithBulk bytes nameScheme = MegaStore $ zip (map (\x -> showt $ unpack nameScheme ++ Prelude.show (x :: Integer)) [0..(fromIntegral $ length bytes)]) bytes -- | Key can be Str here which will be hashed, either way -- it will end up as a (String, BS.ByteString)