| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RON.Storage.FS
Description
A real-world file storage.
Typical usage:
import RON.Storage.FS as Storage
main = do
let dataDir = "./data/"
h <- Storage.newHandle dataDir
runStorage h $ do
obj <- newObjectState Note{active = True, text = "Write an example"}
createDocument obj
Synopsis
- module RON.Storage
- data Handle
- newHandle :: FilePath -> IO Handle
- newHandleWithReplicaId :: FilePath -> Word64 -> IO Handle
- data Storage a
- runStorage :: Handle -> Storage a -> IO a
- type StopListening = IO ()
- subscribe :: Handle -> IO (TChan (CollectionName, RawDocId))
Documentation
module RON.Storage
Handle
newHandle :: FilePath -> IO Handle Source #
Create new storage handle. Uses MAC address for replica id or generates a random one.
Storage
Environment is the dataDir
Instances
| Monad Storage Source # | |
| Functor Storage Source # | |
| Applicative Storage Source # | |
| MonadIO Storage Source # | |
Defined in RON.Storage.FS | |
| ReplicaClock Storage Source # | |
| MonadStorage Storage Source # | |
Defined in RON.Storage.FS 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 -> ByteStringL -> Storage () Source # loadVersionContent :: Collection a => DocId a -> DocVersion -> Storage ByteStringL Source # deleteVersion :: Collection a => DocId a -> DocVersion -> Storage () Source # changeDocId :: Collection a => DocId a -> DocId a -> Storage () Source # | |
| MonadError Error Storage Source # | |
Defined in RON.Storage.FS Methods throwError :: Error -> Storage a # catchError :: Storage a -> (Error -> Storage a) -> Storage a # | |
Listening to changes
type StopListening = IO () #
An action that cancels a watching/listening job