cas-hashable-s3-1.0.1: ContentHashable instances for S3 objects
Safe HaskellNone
LanguageHaskell2010

Data.CAS.ContentHashable.S3

Description

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

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

Constructors

ObjectInBucket 

Fields

Instances

Instances details
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 give: cfg <- Aws.baseConfiguration give cfg $ contentHash s3object

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.

Instance details

Defined in Data.CAS.ContentHashable.S3

Monad m => ContentHashable m (ObjectInBucket ObjectInfo) Source #

When we already have ObjectInfo (because we have, for example, queried the bucket), we can calculate the ContentHash directly without recourse do S3, because we already know the S3 hash.

Instance details

Defined in Data.CAS.ContentHashable.S3

Show obj => Show (ObjectInBucket obj) Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

Generic (ObjectInBucket obj) Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

Associated Types

type Rep (ObjectInBucket obj) :: Type -> Type #

Methods

from :: ObjectInBucket obj -> Rep (ObjectInBucket obj) x #

to :: Rep (ObjectInBucket obj) x -> ObjectInBucket obj #

ToJSON (ObjectInBucket Object) Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

FromJSON (ObjectInBucket Object) Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

(Given Configuration) :=> (ContentHashable IO (ObjectInBucket Object)) Source #

Reified instance of the implication to allow us to use this as a constraint.

Instance details

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.

Instance details

Defined in Data.CAS.ContentHashable.S3

type Rep (ObjectInBucket obj) Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

type Rep (ObjectInBucket obj) = D1 ('MetaData "ObjectInBucket" "Data.CAS.ContentHashable.S3" "cas-hashable-s3-1.0.1-IFcDelPLk2B4xLFrCBafJr" '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 #

Instances

Instances details
ObjectReference Object Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3

ObjectReference ObjectInfo Source # 
Instance details

Defined in Data.CAS.ContentHashable.S3