Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines the remote caching mechanism of funflow which is used to keep several funflow stores (possibly on different machines) in sync.
Synopsis
- class Monad m => Cacher m a where
- push :: a -> ContentHash -> Maybe ContentHash -> Path Abs Dir -> m PushResult
- pull :: a -> ContentHash -> Path Abs Dir -> m (PullResult ())
- data PullResult a
- = PullOK a
- | NotInCache
- | PullError String
- data PushResult
- data AliasResult
- data NoCache = NoCache
- memoryCache :: MonadIO m => m MemoryCache
- pullAsArchive :: MonadIO m => (ContentHash -> m (PullResult ByteString)) -> ContentHash -> Path Abs Dir -> m (PullResult ())
- pushAsArchive :: MonadIO m => (ContentHash -> ContentHash -> m (Either String ())) -> (ContentHash -> ByteString -> m PushResult) -> ContentHash -> Maybe ContentHash -> Path Abs Dir -> m PushResult
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.
:: 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
Monad m => Cacher m NoCache Source # | |
Defined in Data.CAS.RemoteCache push :: NoCache -> ContentHash -> Maybe ContentHash -> Path Abs Dir -> m PushResult Source # pull :: NoCache -> ContentHash -> Path Abs Dir -> m (PullResult ()) Source # | |
Cacher m a => Cacher m (Maybe a) Source # | If |
Defined in Data.CAS.RemoteCache push :: Maybe a -> ContentHash -> Maybe ContentHash -> Path Abs Dir -> m PushResult Source # pull :: Maybe a -> ContentHash -> Path Abs Dir -> m (PullResult ()) Source # |
data PullResult a Source #
The result of a tentative pull from the remote cache
Instances
Eq a => Eq (PullResult a) Source # | |
Defined in Data.CAS.RemoteCache (==) :: PullResult a -> PullResult a -> Bool # (/=) :: PullResult a -> PullResult a -> Bool # | |
Ord a => Ord (PullResult a) Source # | |
Defined in Data.CAS.RemoteCache compare :: PullResult a -> PullResult a -> Ordering # (<) :: PullResult a -> PullResult a -> Bool # (<=) :: PullResult a -> PullResult a -> Bool # (>) :: PullResult a -> PullResult a -> Bool # (>=) :: PullResult a -> PullResult a -> Bool # max :: PullResult a -> PullResult a -> PullResult a # min :: PullResult a -> PullResult a -> PullResult a # | |
Show a => Show (PullResult a) Source # | |
Defined in Data.CAS.RemoteCache showsPrec :: Int -> PullResult a -> ShowS # show :: PullResult a -> String # showList :: [PullResult a] -> ShowS # |
data PushResult Source #
The result of a tentative push to the remote cache
Instances
Eq PushResult Source # | |
Defined in Data.CAS.RemoteCache (==) :: PushResult -> PushResult -> Bool # (/=) :: PushResult -> PushResult -> Bool # | |
Ord PushResult Source # | |
Defined in Data.CAS.RemoteCache compare :: PushResult -> PushResult -> Ordering # (<) :: PushResult -> PushResult -> Bool # (<=) :: PushResult -> PushResult -> Bool # (>) :: PushResult -> PushResult -> Bool # (>=) :: PushResult -> PushResult -> Bool # max :: PushResult -> PushResult -> PushResult # min :: PushResult -> PushResult -> PushResult # | |
Show PushResult Source # | |
Defined in Data.CAS.RemoteCache showsPrec :: Int -> PushResult -> ShowS # show :: PushResult -> String # showList :: [PushResult] -> ShowS # |
A dummy remote cache implementation which does nothing
Instances
Monad m => Cacher m NoCache Source # | |
Defined in Data.CAS.RemoteCache push :: NoCache -> ContentHash -> Maybe ContentHash -> Path Abs Dir -> m PushResult Source # pull :: NoCache -> ContentHash -> Path Abs Dir -> m (PullResult ()) Source # |
memoryCache :: MonadIO m => m MemoryCache Source #
pullAsArchive :: MonadIO m => (ContentHash -> m (PullResult ByteString)) -> ContentHash -> Path Abs Dir -> m (PullResult ()) Source #
:: 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