Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hashing of S3 objects
This module allows us to fetch objects from S3, taking advantage of S3's support for CAS to avoid the need to calculate our own content hashes.
Synopsis
- data ObjectInBucket obj = ObjectInBucket {
- _oibBucket :: Bucket
- _oibObject :: obj
- oibBucket :: Functor f => (Bucket -> f Bucket) -> ObjectInBucket obj -> f (ObjectInBucket obj)
- oibObject :: Functor f => (a -> f b) -> ObjectInBucket a -> f (ObjectInBucket b)
- class ObjectReference a where
- objectReference :: a -> Object
Documentation
data ObjectInBucket obj Source #
Reference to an object in an S3 bucket
Objects can be referenced in a few ways, so this type is parametrised over the object reference. Currently, this is expected to be: - S3.Object (alias for Text) - S3.ObjectInfo
ObjectInBucket | |
|
Instances
Given Configuration => ContentHashable IO (ObjectInBucket Object) Source # | An S3 object is hashable whenever we have sufficient configuration to
access said object. To deal with this, we use reflection to reify a value
(the AWS configuration) into a class constraint.
To use this instance, you must reify the value using Since S3 is already content hashed, we do not need to actually hash the object ourselves. In fact, we avoid fetching the object, and only request the metadata including the content hash. We incorporate the bucket and name into this to give extra guarantees on uniqueness, but we may be better abolishing this to deduplicate files stored in multiple places. |
Defined in Data.CAS.ContentHashable.S3 contentHashUpdate :: Context SHA256 -> ObjectInBucket Object -> IO (Context SHA256) # | |
Monad m => ContentHashable m (ObjectInBucket ObjectInfo) Source # | When we already have |
Defined in Data.CAS.ContentHashable.S3 contentHashUpdate :: Context SHA256 -> ObjectInBucket ObjectInfo -> m (Context SHA256) # contentHash :: ObjectInBucket ObjectInfo -> m ContentHash # | |
Show obj => Show (ObjectInBucket obj) Source # | |
Defined in Data.CAS.ContentHashable.S3 showsPrec :: Int -> ObjectInBucket obj -> ShowS # show :: ObjectInBucket obj -> String # showList :: [ObjectInBucket obj] -> ShowS # | |
Generic (ObjectInBucket obj) Source # | |
Defined in Data.CAS.ContentHashable.S3 type Rep (ObjectInBucket obj) :: Type -> Type # from :: ObjectInBucket obj -> Rep (ObjectInBucket obj) x # to :: Rep (ObjectInBucket obj) x -> ObjectInBucket obj # | |
ToJSON (ObjectInBucket Object) Source # | |
Defined in Data.CAS.ContentHashable.S3 toJSON :: ObjectInBucket Object -> Value # toEncoding :: ObjectInBucket Object -> Encoding # toJSONList :: [ObjectInBucket Object] -> Value # toEncodingList :: [ObjectInBucket Object] -> Encoding # | |
FromJSON (ObjectInBucket Object) Source # | |
Defined in Data.CAS.ContentHashable.S3 parseJSON :: Value -> Parser (ObjectInBucket Object) # parseJSONList :: Value -> Parser [ObjectInBucket Object] # | |
(Given Configuration) :=> (ContentHashable IO (ObjectInBucket Object)) Source # | Reified instance of the implication to allow us to use this as a constraint. |
Defined in Data.CAS.ContentHashable.S3 | |
(Given Configuration) :=> (ContentHashable IO (ObjectInBucket ObjectInfo)) Source # | Reified instance of the implication to allow us to use this as a constraint. |
Defined in Data.CAS.ContentHashable.S3 | |
type Rep (ObjectInBucket obj) Source # | |
Defined in Data.CAS.ContentHashable.S3 type Rep (ObjectInBucket obj) = D1 (MetaData "ObjectInBucket" "Data.CAS.ContentHashable.S3" "cas-hashable-s3-1.0.0-IelSI1Dtkvv45s3Z8wgjBY" False) (C1 (MetaCons "ObjectInBucket" PrefixI True) (S1 (MetaSel (Just "_oibBucket") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bucket) :*: S1 (MetaSel (Just "_oibObject") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 obj))) |
oibBucket :: Functor f => (Bucket -> f Bucket) -> ObjectInBucket obj -> f (ObjectInBucket obj) Source #
A lens to _oibBucket
oibObject :: Functor f => (a -> f b) -> ObjectInBucket a -> f (ObjectInBucket b) Source #
A lens to _oibObject
class ObjectReference a where Source #
objectReference :: a -> Object Source #
Instances
ObjectReference Object Source # | |
Defined in Data.CAS.ContentHashable.S3 objectReference :: Object -> Object Source # | |
ObjectReference ObjectInfo Source # | |
Defined in Data.CAS.ContentHashable.S3 objectReference :: ObjectInfo -> Object Source # |