Improve some haddock; improve getObject interface.

This commit is contained in:
Aditya Manthramurthy 2017-02-10 16:28:34 +05:30
parent 75743ab946
commit 3c92dc92c6
3 changed files with 22 additions and 28 deletions

View File

@ -16,6 +16,7 @@ module Network.Minio
-- with an object storage service.
, MinioErr(..)
, MErrV(..)
, MError(..)
-- * Data Types
----------------
@ -24,23 +25,25 @@ module Network.Minio
, Object
, BucketInfo(..)
, UploadId
, ObjectData(..)
-- * Bucket and Object Operations
---------------------------------
-- * Bucket Operations
----------------------
, getService
, getLocation
, fGetObject
, fPutObject
, putObjectFromSource
, ObjectData(..)
, getObject
, putObject
, listObjects
, listIncompleteUploads
, listIncompleteParts
-- * Object Operations
----------------------
, fGetObject
, fPutObject
, putObjectFromSource
, getObject
) where
{-
@ -63,7 +66,7 @@ import Network.Minio.S3API
-- and then moved to the given path.
fGetObject :: Bucket -> Object -> FilePath -> Minio ()
fGetObject bucket object fp = do
(_, src) <- getObject bucket object [] []
src <- getObject bucket object
src C.$$+- CB.sinkFileCautious fp
-- | Upload the given file to the given object.
@ -80,3 +83,7 @@ putObjectFromSource :: Bucket -> Object -> C.Producer Minio ByteString
-> Maybe Int64 -> Minio ()
putObjectFromSource bucket object src sizeMay = void $ putObject bucket object $
ODStream src sizeMay
-- | Get an object from the object store as a resumable source (conduit).
getObject :: Bucket -> Object -> Minio (C.ResumableSource Minio ByteString)
getObject bucket object = snd <$> getObject' bucket object [] []

View File

@ -20,19 +20,6 @@ import Network.Minio.Data.Crypto
import Network.Minio.Sign.V4
import Network.Minio.Utils
-- runRequestDebug r mgr = do
-- print $ "runRequestDebug"
-- print $ NC.method r
-- print $ NC.secure r
-- print $ NC.host r
-- print $ NC.port r
-- print $ NC.path r
-- print $ NC.queryString r
-- print $ NC.requestHeaders r
-- -- print $ NC.requestBody r
-- NC.httpLbs r mgr
-- sha256Header :: :: HT.HeaderName
sha256Header :: ByteString -> HT.Header
sha256Header = ("x-amz-content-sha256", )

View File

@ -12,7 +12,7 @@ module Network.Minio.S3API
-- * Retrieving objects
-----------------------
, getObject
, getObject'
-- * Creating buckets and objects
---------------------------------
@ -65,9 +65,9 @@ getLocation bucket = do
-- | GET an object from the service and return the response headers
-- and a conduit source for the object content
getObject :: Bucket -> Object -> HT.Query -> [HT.Header]
-> Minio ([HT.Header], C.ResumableSource Minio ByteString)
getObject bucket object queryParams headers = do
getObject' :: Bucket -> Object -> HT.Query -> [HT.Header]
-> Minio ([HT.Header], C.ResumableSource Minio ByteString)
getObject' bucket object queryParams headers = do
resp <- mkStreamRequest reqInfo
return $ (NC.responseHeaders resp, NC.responseBody resp)
where