{"action":"created","comment":{"url":"https://api.github.com/repos/ambiata/mismi/pulls/comments/43458695","id":43458695,"diff_hunk":"@@ -53,57 +54,89 @@ module Mismi.S3.Commands (\n \n import           Control.Arrow ((***))\n \n-import           Control.Concurrent hiding (yield)\n-import           Control.Concurrent.MSem\n+import           Control.Concurrent (forkIO, killThread)\n+import           Control.Concurrent.Chan (Chan, newChan, readChan, writeChan)\n+import qualified Control.Concurrent.MSem as MSem\n \n-import           Control.Concurrent.Async.Lifted\n+import           Control.Concurrent.Async.Lifted (mapConcurrently)\n \n-import           Control.Lens\n-import           Control.Retry\n-import           Control.Monad.Catch\n-import           Control.Monad.Trans.Class\n-import           Control.Monad.Trans.Either\n-import           Control.Monad.Trans.Resource\n+import           Control.Lens ((&), (.~), (^.), to)\n+import           Control.Retry ()\n+import           Control.Monad.Catch (throwM, catch, catchAll)\n+import           Control.Monad.Trans.Class (lift)\n+import           Control.Monad.Trans.Resource (ResourceT, runResourceT)\n import           Control.Monad.Reader (ask)\n-import           Control.Monad.IO.Class\n+import           Control.Monad.IO.Class (liftIO)\n \n import qualified Data.ByteString as BS\n-import           Data.Conduit\n+import           Data.Conduit (Conduit, Source, ResumableSource)\n+import           Data.Conduit ((=$=), ($$), ($$+-))\n+import           Data.Conduit (awaitForever)\n+import           Data.Conduit.Binary (sinkFile, sinkLbs)\n import qualified Data.Conduit.List as DC\n-import           Data.Conduit.Binary\n \n import qualified Data.List.NonEmpty as NEL\n+import           Data.Text (Text)\n import qualified Data.Text as T\n import qualified Data.Text.Encoding as T\n import qualified Data.Text.Lazy as TL\n import qualified Data.Text.Lazy.Encoding as TL\n-import           Data.Time.Clock\n+import           Data.Time.Clock (UTCTime, NominalDiffTime, getCurrentTime, addUTCTime)\n \n import           Mismi.Control\n import qualified Mismi.Control as A\n-import           Mismi.S3.Amazonka (send, paginate, Env )\n+import           Mismi.S3.Amazonka (Env, send, paginate)\n import           Mismi.S3.Data\n import           Mismi.S3.Internal\n import qualified Mismi.S3.Patch.Network as N\n import qualified Mismi.S3.Patch.PutObjectACL as P\n \n-import           Network.AWS.S3 hiding (headObject, Bucket, bucket, listObjects)\n+import           Network.AWS.Data.Body (RqBody (..), RsBody (..), toBody)\n+import           Network.AWS.Data.Body (ChunkedBody (..), ChunkSize (..))\n+import           Network.AWS.Data.Text (toText)\n+import           Network.AWS.S3 (BucketName (..))\n+import           Network.AWS.S3 (ETag)\n+import           Network.AWS.S3 (GetObjectResponse, gorsBody)\n+import           Network.AWS.S3 (HeadObjectResponse, horsContentLength)\n+import           Network.AWS.S3 (ListObjects, loPrefix, loDelimiter, loMarker)\n+import           Network.AWS.S3 (ListObjectsResponse, lorsContents, lorsCommonPrefixes)\n+import           Network.AWS.S3 (lorsIsTruncated, lorsNextMarker)\n+import           Network.AWS.S3 (MetadataDirective (..))\n+import           Network.AWS.S3 (MultipartUpload, muKey, muUploadId, muInitiated)\n+import           Network.AWS.S3 (Object, oKey)\n+import           Network.AWS.S3 (ObjectKey (..))\n+import           Network.AWS.S3 (Part)\n+import           Network.AWS.S3 (ServerSideEncryption (..))\n+import           Network.AWS.S3 (cMultipartUpload)\n+import           Network.AWS.S3 (cmuParts, cmuServerSideEncryption)\n+import           Network.AWS.S3 (cmursUploadId)\n+import           Network.AWS.S3 (coMetadataDirective, coServerSideEncryption)\n+import           Network.AWS.S3 (cpPrefix)\n+import           Network.AWS.S3 (goRange)\n+import           Network.AWS.S3 (lmursUploads)\n+import           Network.AWS.S3 (lprsParts)\n+import           Network.AWS.S3 (poServerSideEncryption)\n+import           Network.AWS.S3 (uprsETag)\n+import           Network.AWS.S3 (createMultipartUpload, abortMultipartUpload, listMultipartUploads)\n+import           Network.AWS.S3 (completeMultipartUpload, completedMultipartUpload, completedPart)\n+import           Network.AWS.S3 (uploadPart)\n+import           Network.AWS.S3 (getObject, putObject, copyObject, deleteObject)\n import qualified Network.AWS.S3 as AWS\n-import           Network.AWS.Data.Body\n-import           Network.AWS.Data.Text\n \n import           P\n import           Prelude (($!))\n \n-import           System.IO\n-import           System.Directory\n-import           System.FilePath hiding ((</>))\n-import           System.Posix.IO\n+import           System.IO (IO, IOMode (..), SeekMode (..))\n+import           System.IO (hFileSize, hSetFileSize, withFile)\n+import           System.Directory (createDirectoryIfMissing, doesFileExist)\n+import           System.FilePath (FilePath, dropFileName)\n+import           System.Posix.IO (OpenMode(..), openFd, closeFd, fdSeek, defaultFileFlags)\n import qualified \"unix-bytestring\" System.Posix.IO.ByteString as UBS","path":"mismi-s3/src/Mismi/S3/Commands.hs","position":113,"original_position":114,"commit_id":"3e982c7dc583371ca60c55a637d8aa9170e6df88","original_commit_id":"23bd26b2a773bc241ba27ceaecc9267e58c0de38","user":{"login":"jystic","id":134805,"avatar_url":"https://avatars.githubusercontent.com/u/134805?v=3","gravatar_id":"","url":"https://api.github.com/users/jystic","html_url":"https://github.com/jystic","followers_url":"https://api.github.com/users/jystic/followers","following_url":"https://api.github.com/users/jystic/following{/other_user}","gists_url":"https://api.github.com/users/jystic/gists{/gist_id}","starred_url":"https://api.github.com/users/jystic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jystic/subscriptions","organizations_url":"https://api.github.com/users/jystic/orgs","repos_url":"https://api.github.com/users/jystic/repos","events_url":"https://api.github.com/users/jystic/events{/privacy}","received_events_url":"https://api.github.com/users/jystic/received_events","type":"User","site_admin":false},"body":"Ignore me, I see that it is a `String` for some reason :/","created_at":"2015-10-29T23:46:36Z","updated_at":"2015-10-29T23:46:36Z","html_url":"https://github.com/ambiata/mismi/pull/239#discussion_r43458695","pull_request_url":"https://api.github.com/repos/ambiata/mismi/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/comments/43458695"},"html":{"href":"https://github.com/ambiata/mismi/pull/239#discussion_r43458695"},"pull_request":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/239"}}},"pull_request":{"url":"https://api.github.com/repos/ambiata/mismi/pulls/239","id":49104584,"html_url":"https://github.com/ambiata/mismi/pull/239","diff_url":"https://github.com/ambiata/mismi/pull/239.diff","patch_url":"https://github.com/ambiata/mismi/pull/239.patch","issue_url":"https://api.github.com/repos/ambiata/mismi/issues/239","number":239,"state":"open","locked":false,"title":"Move from either -> x-eithert","user":{"login":"jystic","id":134805,"avatar_url":"https://avatars.githubusercontent.com/u/134805?v=3","gravatar_id":"","url":"https://api.github.com/users/jystic","html_url":"https://github.com/jystic","followers_url":"https://api.github.com/users/jystic/followers","following_url":"https://api.github.com/users/jystic/following{/other_user}","gists_url":"https://api.github.com/users/jystic/gists{/gist_id}","starred_url":"https://api.github.com/users/jystic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jystic/subscriptions","organizations_url":"https://api.github.com/users/jystic/orgs","repos_url":"https://api.github.com/users/jystic/repos","events_url":"https://api.github.com/users/jystic/events{/privacy}","received_events_url":"https://api.github.com/users/jystic/received_events","type":"User","site_admin":false},"body":"Not sure if this is good to go yet, just wanted to use the build bots for sandboxing","created_at":"2015-10-29T06:56:48Z","updated_at":"2015-10-29T23:46:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd920a2653954f7b3731819667767956fe9b90fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ambiata/mismi/pulls/239/commits","review_comments_url":"https://api.github.com/repos/ambiata/mismi/pulls/239/comments","review_comment_url":"https://api.github.com/repos/ambiata/mismi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ambiata/mismi/issues/239/comments","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/3e982c7dc583371ca60c55a637d8aa9170e6df88","head":{"label":"ambiata:topic/eithert","ref":"topic/eithert","sha":"3e982c7dc583371ca60c55a637d8aa9170e6df88","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":30991371,"name":"mismi","full_name":"ambiata/mismi","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/mismi","description":"Haskell library for AWS","fork":false,"url":"https://api.github.com/repos/ambiata/mismi","forks_url":"https://api.github.com/repos/ambiata/mismi/forks","keys_url":"https://api.github.com/repos/ambiata/mismi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/mismi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/mismi/teams","hooks_url":"https://api.github.com/repos/ambiata/mismi/hooks","issue_events_url":"https://api.github.com/repos/ambiata/mismi/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/mismi/events","assignees_url":"https://api.github.com/repos/ambiata/mismi/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/mismi/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/mismi/tags","blobs_url":"https://api.github.com/repos/ambiata/mismi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/mismi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/mismi/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/mismi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/mismi/languages","stargazers_url":"https://api.github.com/repos/ambiata/mismi/stargazers","contributors_url":"https://api.github.com/repos/ambiata/mismi/contributors","subscribers_url":"https://api.github.com/repos/ambiata/mismi/subscribers","subscription_url":"https://api.github.com/repos/ambiata/mismi/subscription","commits_url":"https://api.github.com/repos/ambiata/mismi/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/mismi/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/mismi/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/mismi/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambiata/mismi/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/mismi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/mismi/merges","archive_url":"https://api.github.com/repos/ambiata/mismi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/mismi/downloads","issues_url":"https://api.github.com/repos/ambiata/mismi/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/mismi/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/mismi/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/mismi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/mismi/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/mismi/releases{/id}","created_at":"2015-02-18T22:50:24Z","updated_at":"2015-09-01T04:12:03Z","pushed_at":"2015-10-29T23:40:26Z","git_url":"git://github.com/ambiata/mismi.git","ssh_url":"git@github.com:ambiata/mismi.git","clone_url":"https://github.com/ambiata/mismi.git","svn_url":"https://github.com/ambiata/mismi","homepage":null,"size":3616,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":36,"forks":0,"open_issues":36,"watchers":0,"default_branch":"master"}},"base":{"label":"ambiata:master","ref":"master","sha":"69401e72fd1f70a54a9f68aa04e3c68738ff7a15","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":30991371,"name":"mismi","full_name":"ambiata/mismi","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/mismi","description":"Haskell library for AWS","fork":false,"url":"https://api.github.com/repos/ambiata/mismi","forks_url":"https://api.github.com/repos/ambiata/mismi/forks","keys_url":"https://api.github.com/repos/ambiata/mismi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/mismi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/mismi/teams","hooks_url":"https://api.github.com/repos/ambiata/mismi/hooks","issue_events_url":"https://api.github.com/repos/ambiata/mismi/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/mismi/events","assignees_url":"https://api.github.com/repos/ambiata/mismi/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/mismi/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/mismi/tags","blobs_url":"https://api.github.com/repos/ambiata/mismi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/mismi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/mismi/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/mismi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/mismi/languages","stargazers_url":"https://api.github.com/repos/ambiata/mismi/stargazers","contributors_url":"https://api.github.com/repos/ambiata/mismi/contributors","subscribers_url":"https://api.github.com/repos/ambiata/mismi/subscribers","subscription_url":"https://api.github.com/repos/ambiata/mismi/subscription","commits_url":"https://api.github.com/repos/ambiata/mismi/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/mismi/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/mismi/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/mismi/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambiata/mismi/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/mismi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/mismi/merges","archive_url":"https://api.github.com/repos/ambiata/mismi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/mismi/downloads","issues_url":"https://api.github.com/repos/ambiata/mismi/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/mismi/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/mismi/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/mismi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/mismi/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/mismi/releases{/id}","created_at":"2015-02-18T22:50:24Z","updated_at":"2015-09-01T04:12:03Z","pushed_at":"2015-10-29T23:40:26Z","git_url":"git://github.com/ambiata/mismi.git","ssh_url":"git@github.com:ambiata/mismi.git","clone_url":"https://github.com/ambiata/mismi.git","svn_url":"https://github.com/ambiata/mismi","homepage":null,"size":3616,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":36,"forks":0,"open_issues":36,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/239"},"html":{"href":"https://github.com/ambiata/mismi/pull/239"},"issue":{"href":"https://api.github.com/repos/ambiata/mismi/issues/239"},"comments":{"href":"https://api.github.com/repos/ambiata/mismi/issues/239/comments"},"review_comments":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/239/comments"},"review_comment":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/239/commits"},"statuses":{"href":"https://api.github.com/repos/ambiata/mismi/statuses/3e982c7dc583371ca60c55a637d8aa9170e6df88"}}}}