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. -- with an object storage service.
, MinioErr(..) , MinioErr(..)
, MErrV(..) , MErrV(..)
, MError(..)
-- * Data Types -- * Data Types
---------------- ----------------
@ -24,23 +25,25 @@ module Network.Minio
, Object , Object
, BucketInfo(..) , BucketInfo(..)
, UploadId , UploadId
, ObjectData(..)
-- * Bucket and Object Operations -- * Bucket Operations
--------------------------------- ----------------------
, getService , getService
, getLocation , getLocation
, fGetObject
, fPutObject
, putObjectFromSource
, ObjectData(..)
, getObject
, putObject
, listObjects , listObjects
, listIncompleteUploads , listIncompleteUploads
, listIncompleteParts , listIncompleteParts
-- * Object Operations
----------------------
, fGetObject
, fPutObject
, putObjectFromSource
, getObject
) where ) where
{- {-
@ -63,7 +66,7 @@ import Network.Minio.S3API
-- and then moved to the given path. -- and then moved to the given path.
fGetObject :: Bucket -> Object -> FilePath -> Minio () fGetObject :: Bucket -> Object -> FilePath -> Minio ()
fGetObject bucket object fp = do fGetObject bucket object fp = do
(_, src) <- getObject bucket object [] [] src <- getObject bucket object
src C.$$+- CB.sinkFileCautious fp src C.$$+- CB.sinkFileCautious fp
-- | Upload the given file to the given object. -- | Upload the given file to the given object.
@ -80,3 +83,7 @@ putObjectFromSource :: Bucket -> Object -> C.Producer Minio ByteString
-> Maybe Int64 -> Minio () -> Maybe Int64 -> Minio ()
putObjectFromSource bucket object src sizeMay = void $ putObject bucket object $ putObjectFromSource bucket object src sizeMay = void $ putObject bucket object $
ODStream src sizeMay 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.Sign.V4
import Network.Minio.Utils 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 :: ByteString -> HT.Header
sha256Header = ("x-amz-content-sha256", ) sha256Header = ("x-amz-content-sha256", )

View File

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