factor out common imports
no code changes
This commit is contained in:
parent
003a604a6e
commit
8ef2095fa0
83 changed files with 264 additions and 619 deletions
|
@ -7,31 +7,21 @@
|
|||
|
||||
module Remote.S3 (remote) where
|
||||
|
||||
import Control.Exception.Extensible (IOException)
|
||||
import Network.AWS.AWSConnection
|
||||
import Network.AWS.S3Object
|
||||
import Network.AWS.S3Bucket hiding (size)
|
||||
import Network.AWS.AWSResult
|
||||
import qualified Data.ByteString.Lazy.Char8 as L
|
||||
import qualified Data.Map as M
|
||||
import Data.Maybe
|
||||
import Data.List
|
||||
import Data.Char
|
||||
import Data.String.Utils
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.State (liftIO)
|
||||
import System.Environment
|
||||
import System.Posix.Files
|
||||
import System.Posix.Env (setEnv)
|
||||
|
||||
import Types
|
||||
import AnnexCommon
|
||||
import Types.Remote
|
||||
import Types.Key
|
||||
import qualified Git
|
||||
import qualified Annex
|
||||
import UUID
|
||||
import Messages
|
||||
import Locations
|
||||
import Config
|
||||
import Remote.Helper.Special
|
||||
import Remote.Helper.Encryptable
|
||||
|
@ -123,7 +113,7 @@ s3Setup u c = handlehost $ M.lookup "host" c
|
|||
|
||||
store :: Remote Annex -> Key -> Annex Bool
|
||||
store r k = s3Action r False $ \(conn, bucket) -> do
|
||||
g <- Annex.gitRepo
|
||||
g <- gitRepo
|
||||
res <- liftIO $ storeHelper (conn, bucket) r k $ gitAnnexLocation g k
|
||||
s3Bool res
|
||||
|
||||
|
@ -132,7 +122,7 @@ storeEncrypted r (cipher, enck) k = s3Action r False $ \(conn, bucket) ->
|
|||
-- To get file size of the encrypted content, have to use a temp file.
|
||||
-- (An alternative would be chunking to to a constant size.)
|
||||
withTmp enck $ \tmp -> do
|
||||
g <- Annex.gitRepo
|
||||
g <- gitRepo
|
||||
let f = gitAnnexLocation g k
|
||||
liftIO $ withEncryptedContent cipher (L.readFile f) $ \s -> L.writeFile tmp s
|
||||
res <- liftIO $ storeHelper (conn, bucket) r enck tmp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue