| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RON.Storage.IO
Description
A real-world file storage.
Typical usage:
import RON.Storage.IO as Storage
main = do
let dataDir = "./data/"
h <- Storage.newHandle dataDir
runStorage h $ do
obj <- newObject Note{active = True, text = "Write an example"}
createDocument obj
Synopsis
- module RON.Storage
- data Handle
- newtype OnDocumentChanged = OnDocumentChanged (forall a. Collection a => DocId a -> IO ())
- newHandle :: FilePath -> IO Handle
- setOnDocumentChanged :: Handle -> OnDocumentChanged -> IO ()
- data Storage a
- runStorage :: Handle -> Storage a -> IO a
Documentation
module RON.Storage
Handle
newtype OnDocumentChanged Source #
The handler is called as onDocumentChanged docid, where
docid is the changed document id.
Constructors
| OnDocumentChanged (forall a. Collection a => DocId a -> IO ()) |
setOnDocumentChanged :: Handle -> OnDocumentChanged -> IO () Source #
Storage
Environment is the dataDir
Instances
| Monad Storage Source # | |
| Functor Storage Source # | |
| Applicative Storage Source # | |
| MonadIO Storage Source # | |
Defined in RON.Storage.IO | |
| ReplicaClock Storage Source # | |
| MonadStorage Storage Source # | |
Defined in RON.Storage.IO Methods getCollections :: Storage [CollectionName] Source # getDocuments :: Collection a => Storage [DocId a] Source # getDocumentVersions :: Collection a => DocId a -> Storage [DocVersion] Source # saveVersionContent :: Collection a => DocId a -> DocVersion -> ByteString -> Storage () Source # loadVersionContent :: Collection a => DocId a -> DocVersion -> Storage ByteString Source # deleteVersion :: Collection a => DocId a -> DocVersion -> Storage () Source # changeDocId :: Collection a => DocId a -> DocId a -> Storage () Source # | |
| MonadError String Storage Source # | |
Defined in RON.Storage.IO Methods throwError :: String -> Storage a # catchError :: Storage a -> (String -> Storage a) -> Storage a # | |