BackupToS3

This commit is contained in:
Michael Snoyman 2014-05-19 20:26:45 +03:00
parent 621bbff4bc
commit e33356107b
2 changed files with 11 additions and 2 deletions

View File

@ -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
-}

View File

@ -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)