summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Provider.hs
blob: 64b378626c1cdf03f2f8582c3ca29addfea62ad4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--------------------------------------------------------------------------------
-- | This module provides an wrapper API around the file system which does some
-- caching.
module Hakyll.Core.Provider
    ( -- * Constructing resource providers
      Provider
    , newProvider

      -- * Querying resource properties
    , resourceList
    , resourceExists
    , resourceModified
    , resourceModificationTime

      -- * Access to raw resource content
    , resourceString
    , resourceLBS

      -- * Access to metadata and body content
    , resourceMetadata
    , resourceBody
    ) where


--------------------------------------------------------------------------------
import           Hakyll.Core.Identifier
import           Hakyll.Core.Metadata
import           Hakyll.Core.Provider.Internal
import qualified Hakyll.Core.Provider.MetadataCache as Internal
import           Hakyll.Core.Provider.Modified


--------------------------------------------------------------------------------
-- | Wrapper to ensure metadata cache is invalidated if necessary
resourceMetadata :: Provider -> Identifier -> IO Metadata
resourceMetadata rp r = do
    _ <- resourceModified rp r
    Internal.resourceMetadata rp r


--------------------------------------------------------------------------------
-- | Wrapper to ensure metadata cache is invalidated if necessary
resourceBody :: Provider -> Identifier -> IO String
resourceBody rp r = do
    _ <- resourceModified rp r
    Internal.resourceBody rp r