cas-store-1.1.1: A content-addressed storage
Safe HaskellNone
LanguageHaskell2010

Data.CAS.RemoteCache

Description

This module defines the remote caching mechanism of funflow which is used to keep several funflow stores (possibly on different machines) in sync.

Synopsis

Documentation

class Monad m => Cacher m a where Source #

A simple mechanism for remote-caching.

Provides a way to push a path to the cache and pull it back.

No assumption is made on the availability of a store path. In particular, pushing a path to the cache doesn't mean that we can pull it back.

Methods

push Source #

Arguments

:: a 
-> ContentHash

Primary key: hash of the content

-> Maybe ContentHash

Secondary key: hash of the dependencies

-> Path Abs Dir

Path to the content

-> m PushResult 

pull :: a -> ContentHash -> Path Abs Dir -> m (PullResult ()) Source #

Instances

Instances details
Monad m => Cacher m NoCache Source # 
Instance details

Defined in Data.CAS.RemoteCache

Cacher m a => Cacher m (Maybe a) Source #

If a is a Cacher then 'Maybe a' is a cacher such that 'Just x' behavies like x and Nothing doesn't cache anything

Instance details

Defined in Data.CAS.RemoteCache

data PullResult a Source #

The result of a tentative pull from the remote cache

Constructors

PullOK a 
NotInCache 
PullError String 

Instances

Instances details
Eq a => Eq (PullResult a) Source # 
Instance details

Defined in Data.CAS.RemoteCache

Methods

(==) :: PullResult a -> PullResult a -> Bool #

(/=) :: PullResult a -> PullResult a -> Bool #

Ord a => Ord (PullResult a) Source # 
Instance details

Defined in Data.CAS.RemoteCache

Show a => Show (PullResult a) Source # 
Instance details

Defined in Data.CAS.RemoteCache

data PushResult Source #

The result of a tentative push to the remote cache

Constructors

PushOK 
PushError String 

data NoCache Source #

A dummy remote cache implementation which does nothing

Constructors

NoCache 

Instances

Instances details
Monad m => Cacher m NoCache Source # 
Instance details

Defined in Data.CAS.RemoteCache

memoryCache :: MonadIO m => m MemoryCache Source #

pushAsArchive Source #

Arguments

:: MonadIO m 
=> (ContentHash -> ContentHash -> m (Either String ()))

How to create the aliases

-> (ContentHash -> ByteString -> m PushResult)

How to push the content

-> ContentHash

Primary key

-> Maybe ContentHash

Secondary key

-> Path Abs Dir 
-> m PushResult 

Push the path as an archive to the remote cache