kernmantle-caching-0.1.0.0: Cache parts of a Kernmantle pipeline via cas-store
Safe HaskellNone
LanguageHaskell2010

Control.Kernmantle.Caching

Synopsis

Documentation

data ContentStore #

A hash addressed store on the file system.

class Monad m => ContentHashable (m :: Type -> Type) a #

Instances

Instances details
ContentHashable IO FileContent 
Instance details

Defined in Data.CAS.ContentHashable

ContentHashable IO ExternallyAssuredFile 
Instance details

Defined in Data.CAS.ContentHashable

ContentHashable IO ExternallyAssuredDirectory 
Instance details

Defined in Data.CAS.ContentHashable

ContentHashable IO Alias 
Instance details

Defined in Data.CAS.ContentStore

ContentHashable IO SomeHashable Source # 
Instance details

Defined in Control.Kernmantle.Caching

Monad m => ContentHashable m ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Caching

Monad m => ContentHashable m SplitId Source # 
Instance details

Defined in Control.Kernmantle.Caching

Monad m => ContentHashable m Word 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Item 
Instance details

Defined in Data.CAS.ContentStore

Monad m => ContentHashable m Word8 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Word64 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Word32 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Word16 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Value 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m UTCTime 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Text 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Text 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Scientific 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Natural 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Key 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Integer 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Int8 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Int64 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Int32 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Int16 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Int 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Float 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Fingerprint 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Double 
Instance details

Defined in Data.CAS.ContentHashable

MonadIO m => ContentHashable m DirectoryContent 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Char 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m ByteString 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m ByteString 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m Bool 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m () 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable a, ContentHashable m a) => ContentHashable m [a] 
Instance details

Defined in Data.CAS.ContentHashable

(ContentHashable m n, Typeable n) => ContentHashable m (Ratio n) 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m (Content Dir) 
Instance details

Defined in Data.CAS.ContentStore

Monad m => ContentHashable m (Content File) 
Instance details

Defined in Data.CAS.ContentStore

(Typeable a, ContentHashable m a) => ContentHashable m (Vector a) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable a, Storable a, ContentHashable m a) => ContentHashable m (Vector a) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable a, Unbox a, ContentHashable m a) => ContentHashable m (Vector a) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable a, ContentHashable m a) => ContentHashable m (NonEmpty a) 
Instance details

Defined in Data.CAS.ContentHashable

ContentHashable m a => ContentHashable m (Maybe a) 
Instance details

Defined in Data.CAS.ContentHashable

Monad m => ContentHashable m (KeyMap Value) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable v, ContentHashable m v) => ContentHashable m (HashSet v) 
Instance details

Defined in Data.CAS.ContentHashable

(ContentHashable m a, ContentHashable m b) => ContentHashable m (a, b) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b) -> m (Context SHA256) #

contentHash :: (a, b) -> m ContentHash #

(Monad m, Typeable b, Typeable t) => ContentHashable m (Path b t) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable k, Typeable v, ContentHashable m k, ContentHashable m v) => ContentHashable m (Map k v) 
Instance details

Defined in Data.CAS.ContentHashable

(Typeable k, Typeable v, ContentHashable m k, ContentHashable m v) => ContentHashable m (HashMap k v) 
Instance details

Defined in Data.CAS.ContentHashable

(ContentHashable m a, ContentHashable m b) => ContentHashable m (Either a b) 
Instance details

Defined in Data.CAS.ContentHashable

(ContentHashable m a, ContentHashable m b, ContentHashable m c) => ContentHashable m (a, b, c) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b, c) -> m (Context SHA256) #

contentHash :: (a, b, c) -> m ContentHash #

(ContentHashable m a, ContentHashable m b, ContentHashable m c, ContentHashable m d) => ContentHashable m (a, b, c, d) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b, c, d) -> m (Context SHA256) #

contentHash :: (a, b, c, d) -> m ContentHash #

(ContentHashable m a, ContentHashable m b, ContentHashable m c, ContentHashable m d, ContentHashable m e) => ContentHashable m (a, b, c, d, e) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b, c, d, e) -> m (Context SHA256) #

contentHash :: (a, b, c, d, e) -> m ContentHash #

(Monad m, ContentHashable m a, ContentHashable m b, ContentHashable m c, ContentHashable m d, ContentHashable m e, ContentHashable m f) => ContentHashable m (a, b, c, d, e, f) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b, c, d, e, f) -> m (Context SHA256) #

contentHash :: (a, b, c, d, e, f) -> m ContentHash #

(Monad m, ContentHashable m a, ContentHashable m b, ContentHashable m c, ContentHashable m d, ContentHashable m e, ContentHashable m f, ContentHashable m g) => ContentHashable m (a, b, c, d, e, f, g) 
Instance details

Defined in Data.CAS.ContentHashable

Methods

contentHashUpdate :: Context SHA256 -> (a, b, c, d, e, f, g) -> m (Context SHA256) #

contentHash :: (a, b, c, d, e, f, g) -> m ContentHash #

type PureHashable = ContentHashable Identity Source #

A value directly hashable

type IOHashable = ContentHashable IO Source #

A value hashable via some IO action

class ProvidesCaching eff where Source #

A class to cache part of the pipeline

Methods

usingStore :: (ContentHashable IO a, Store b) => eff a b -> eff a b Source #

Instances

Instances details
ProvidesCaching eff => ProvidesCaching (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => AutoIdent eff a b -> AutoIdent eff a b Source #

(Functor f, ProvidesCaching eff) => ProvidesCaching (f ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => (f ~> eff) a b -> (f ~> eff) a b Source #

(MonadIO m, MonadUnliftIO m, MonadMask m, Cacher m remoteCacher, HasKleisli m eff) => ProvidesCaching (Reader (StoreWithId remoteCacher) ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => (Reader (StoreWithId remoteCacher) ~> eff) a b -> (Reader (StoreWithId remoteCacher) ~> eff) a b Source #

(Arrow eff, ProvidesCaching eff) => ProvidesCaching (Writer CachingContext ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

ProvidesCaching core => ProvidesCaching (Rope r m core) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => Rope r m core a b -> Rope r m core a b Source #

class ProvidesCaching eff => ProvidesPosCaching eff where Source #

A class to cache part of the pipeline where the hash can depend on the position of the task in the pipeline

Methods

usingStore' :: (ContentHashable IO a, Store b) => eff a b -> eff a b Source #

Instances

Instances details
(Arrow eff, ProvidesCaching eff) => ProvidesPosCaching (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore' :: (ContentHashable IO a, Store b) => AutoIdent eff a b -> AutoIdent eff a b Source #

(Functor f, ProvidesPosCaching eff) => ProvidesPosCaching (f ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore' :: (ContentHashable IO a, Store b) => (f ~> eff) a b -> (f ~> eff) a b Source #

(Arrow eff, ProvidesPosCaching eff) => ProvidesPosCaching (Writer CachingContext ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

ProvidesPosCaching core => ProvidesPosCaching (Rope r m core) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore' :: (ContentHashable IO a, Store b) => Rope r m core a b -> Rope r m core a b Source #

newtype AutoIdent (arr :: Type -> Type -> Type) a b #

An arrow transformer that can automatically determine an identifier from its position in a pipeline. It is isomorphic to a Reader ArrowIdent ~> arr, but we need a different Arrow instance than what Cayley provides.

Constructors

AutoIdent (ArrowIdent -> arr a b) 

Instances

Instances details
HasAutoIdent eff (AutoIdent eff) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftAutoIdent :: (ArrowIdent -> eff a b) -> AutoIdent eff a b #

SieveTrans f eff => SieveTrans f (AutoIdent eff) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftSieve :: (a -> f b) -> AutoIdent eff a b #

mapSieve :: ((a -> f b) -> a' -> f b') -> AutoIdent eff a b -> AutoIdent eff a' b' #

Arrow eff => Arrow (AutoIdent eff) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

arr :: (b -> c) -> AutoIdent eff b c #

first :: AutoIdent eff b c -> AutoIdent eff (b, d) (c, d) #

second :: AutoIdent eff b c -> AutoIdent eff (d, b) (d, c) #

(***) :: AutoIdent eff b c -> AutoIdent eff b' c' -> AutoIdent eff (b, b') (c, c') #

(&&&) :: AutoIdent eff b c -> AutoIdent eff b c' -> AutoIdent eff b (c, c') #

ArrowZero arr => ArrowZero (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

zeroArrow :: AutoIdent arr b c #

ArrowPlus eff => ArrowPlus (AutoIdent eff) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

(<+>) :: AutoIdent eff b c -> AutoIdent eff b c -> AutoIdent eff b c #

ArrowChoice eff => ArrowChoice (AutoIdent eff) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

left :: AutoIdent eff b c -> AutoIdent eff (Either b d) (Either c d) #

right :: AutoIdent eff b c -> AutoIdent eff (Either d b) (Either d c) #

(+++) :: AutoIdent eff b c -> AutoIdent eff b' c' -> AutoIdent eff (Either b b') (Either c c') #

(|||) :: AutoIdent eff b d -> AutoIdent eff c d -> AutoIdent eff (Either b c) d #

ArrowLoop arr => ArrowLoop (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

loop :: AutoIdent arr (b, d) (c, d) -> AutoIdent arr b c #

Profunctor arr => Profunctor (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

dimap :: (a -> b) -> (c -> d) -> AutoIdent arr b c -> AutoIdent arr a d #

lmap :: (a -> b) -> AutoIdent arr b c -> AutoIdent arr a c #

rmap :: (b -> c) -> AutoIdent arr a b -> AutoIdent arr a c #

(#.) :: forall a b c q. Coercible c b => q b c -> AutoIdent arr a b -> AutoIdent arr a c #

(.#) :: forall a b c q. Coercible b a => AutoIdent arr b c -> q a b -> AutoIdent arr a c #

Costrong arr => Costrong (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

unfirst :: AutoIdent arr (a, d) (b, d) -> AutoIdent arr a b #

unsecond :: AutoIdent arr (d, a) (d, b) -> AutoIdent arr a b #

Strong arr => Strong (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

first' :: AutoIdent arr a b -> AutoIdent arr (a, c) (b, c) #

second' :: AutoIdent arr a b -> AutoIdent arr (c, a) (c, b) #

Cochoice arr => Cochoice (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

unleft :: AutoIdent arr (Either a d) (Either b d) -> AutoIdent arr a b #

unright :: AutoIdent arr (Either d a) (Either d b) -> AutoIdent arr a b #

Choice arr => Choice (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

left' :: AutoIdent arr a b -> AutoIdent arr (Either a c) (Either b c) #

right' :: AutoIdent arr a b -> AutoIdent arr (Either c a) (Either c b) #

Mapping arr => Mapping (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

map' :: Functor f => AutoIdent arr a b -> AutoIdent arr (f a) (f b) #

roam :: ((a -> b) -> s -> t) -> AutoIdent arr a b -> AutoIdent arr s t #

Traversing arr => Traversing (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

traverse' :: Traversable f => AutoIdent arr a b -> AutoIdent arr (f a) (f b) #

wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> AutoIdent arr a b -> AutoIdent arr s t #

Closed arr => Closed (AutoIdent arr) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

closed :: AutoIdent arr a b -> AutoIdent arr (x -> a) (x -> b) #

(Arrow eff, ProvidesCaching eff) => ProvidesPosCaching (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore' :: (ContentHashable IO a, Store b) => AutoIdent eff a b -> AutoIdent eff a b Source #

ProvidesCaching eff => ProvidesCaching (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => AutoIdent eff a b -> AutoIdent eff a b Source #

Category eff => Category (AutoIdent eff :: Type -> Type -> Type) 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

id :: forall (a :: k). AutoIdent eff a a #

(.) :: forall (b :: k) (c :: k) (a :: k). AutoIdent eff b c -> AutoIdent eff a b -> AutoIdent eff a c #

data StoreWithId remoteCacher Source #

Bundles together a store with an identifier for the whole pipeline. If identifier is Nothing, no caching will be performed.

Constructors

StoreWithId ContentStore remoteCacher (Maybe Int) 

Instances

Instances details
(MonadIO m, MonadUnliftIO m, MonadMask m, Cacher m remoteCacher, HasKleisli m eff) => ProvidesCaching (Reader (StoreWithId remoteCacher) ~> eff) Source # 
Instance details

Defined in Control.Kernmantle.Caching

Methods

usingStore :: (ContentHashable IO a, Store b) => (Reader (StoreWithId remoteCacher) ~> eff) a b -> (Reader (StoreWithId remoteCacher) ~> eff) a b Source #

withStore :: (MonadIO m, MonadMask m) => Path Abs Dir -> (ContentStore -> m a) -> m a #

Open the store under the given root and perform the given action. Closes the store once the action is complete

See also: open

caching :: (Arrow core, ProvidesCaching core, ContentHashable IO ident, ContentHashable IO a, Store b) => ident -> Rope r mantle core a b -> Rope r mantle core a b Source #

Any rope whose core provides caching can run cached tasks. The task is identified by an explicit identifier

caching' :: (ProvidesPosCaching core, ContentHashable IO a, Show a, Store b) => Rope r mantle core a b -> Rope r mantle core a b Source #

Any rope whose core provides caching can run cached tasks. The task is identified by its position in the pipeline

Orphan instances