diff --git a/Data/BlobStore.hs b/Data/BlobStore.hs index c4be8fa..b923588 100644 --- a/Data/BlobStore.hs +++ b/Data/BlobStore.hs @@ -6,6 +6,7 @@ module Data.BlobStore , storeWrite , storeRead , storeExists + , BackupToS3 (..) ) where import ClassyPrelude.Yesod @@ -97,7 +98,7 @@ cachedS3Store :: (BackupToS3 key, ToPath key) cachedS3Store cache bucket prefix = BlobStore { storeWrite' = \key -> } +-} class BackupToS3 key where shouldBackup :: key -> Bool --} diff --git a/Types.hs b/Types.hs index 37ee3c9..a853be8 100644 --- a/Types.hs +++ b/Types.hs @@ -1,7 +1,7 @@ module Types where import ClassyPrelude.Yesod -import Data.BlobStore (ToPath (..)) +import Data.BlobStore (ToPath (..), BackupToS3 (..)) import Text.Blaze (ToMarkup) import Database.Persist.Sql (PersistFieldSql (sqlType)) import qualified Data.Text as T @@ -70,6 +70,14 @@ instance ToPath StoreKey where , toPathPiece viewName , "00-index.tar.gz" ] +instance BackupToS3 StoreKey where + shouldBackup HackageCabal{} = False + shouldBackup HackageSdist{} = False + shouldBackup CabalIndex{} = True + shouldBackup CustomSdist{} = True + shouldBackup HackageViewCabal{} = False + shouldBackup HackageViewSdist{} = False + shouldBackup HackageViewIndex{} = False newtype HackageRoot = HackageRoot { unHackageRoot :: Text } deriving (Show, Read, Typeable, Eq, Ord, Hashable, PathPiece, ToMarkup)