module Hakyll.Core.Provider
(
Internal.Provider
, newProvider
, Internal.resourceList
, Internal.resourceExists
, Internal.resourceFilePath
, Internal.resourceModified
, Internal.resourceModificationTime
, Internal.resourceString
, Internal.resourceLBS
, Internal.resourceMetadata
, Internal.resourceBody
) where
import qualified Hakyll.Core.Provider.Internal as Internal
import qualified Hakyll.Core.Provider.MetadataCache as Internal
import Hakyll.Core.Store (Store)
newProvider :: Store
-> (FilePath -> IO Bool)
-> FilePath
-> IO Internal.Provider
newProvider :: Store -> (FilePath -> IO Bool) -> FilePath -> IO Provider
newProvider Store
store FilePath -> IO Bool
ignore FilePath
directory = do
Provider
p <- Store -> (FilePath -> IO Bool) -> FilePath -> IO Provider
Internal.newProvider Store
store FilePath -> IO Bool
ignore FilePath
directory
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Provider -> Identifier -> IO ()
Internal.resourceInvalidateMetadataCache Provider
p) forall a b. (a -> b) -> a -> b
$
forall a. (a -> Bool) -> [a] -> [a]
filter (Provider -> Identifier -> Bool
Internal.resourceModified Provider
p) forall a b. (a -> b) -> a -> b
$ Provider -> [Identifier]
Internal.resourceList Provider
p
forall (m :: * -> *) a. Monad m => a -> m a
return Provider
p