]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage.hs
implemented things related to attachment
[Rakka.git] / Rakka / Storage.hs
index 9ab15be2f1b88921e17810a9599a55e373d2808e..d26f713d8f88140a361c13ea98d1e95ba9d38131 100644 (file)
@@ -11,6 +11,9 @@ module Rakka.Storage
     , putPageA
     , deletePageA
 
+    , getAttachment
+    , putAttachment
+
     , getDirContents
     , getDirContentsA
 
@@ -26,6 +29,7 @@ import           Control.Monad
 import           Control.Monad.Trans
 import           Data.Maybe
 import           Network.HTTP.Lucu
+import           Rakka.Attachment
 import           Rakka.Page
 import           Rakka.Storage.Impl
 import           Rakka.Storage.Types
@@ -101,3 +105,22 @@ syncIndex :: Storage -> IO ()
 syncIndex sto
     = atomically $ writeTChan (stoIndexChan sto) SyncIndex
 
+
+getAttachment :: (Attachment a, MonadIO m) =>
+                 Storage
+              -> PageName
+              -> String
+              -> Maybe RevNum
+              -> m (Maybe a)
+getAttachment = (((liftIO .) .) .) . getAttachment' . stoRepository
+
+
+putAttachment :: (Attachment a, MonadIO m) =>
+                 Storage
+              -> Maybe String
+              -> Maybe RevNum
+              -> PageName
+              -> String
+              -> a
+              -> m StatusCode
+putAttachment = (((((liftIO .) .) .) .) .) . putAttachment' . stoRepository