Safe Haskell | None |
---|---|
Language | Haskell2010 |
RON Storage interface. For usage, see RON.Storage.FS.
Synopsis
- class (ReplicatedAsObject a, Typeable a) => Collection a where
- collectionName :: CollectionName
- fallbackParse :: MonadE m => UUID -> ByteStringL -> m (Object a)
- data CollectionDocId = Collection a => CollectionDocId (DocId a)
- type CollectionName = FilePath
- data DocId a
- createDocument :: (Collection a, MonadStorage m) => Object a -> m ()
- decodeDocId :: DocId a -> Maybe (Bool, UUID)
- docIdFromUuid :: UUID -> DocId a
- loadDocument :: (Collection a, MonadStorage m) => DocId a -> m (Document a)
- modify :: (Collection a, MonadStorage m) => DocId a -> StateT (Object a) m () -> m (Object a)
Documentation
class (ReplicatedAsObject a, Typeable a) => Collection a where Source #
A type that intended to be put in a separate collection must define a Collection instance.
collectionName :: CollectionName Source #
fallbackParse :: MonadE m => UUID -> ByteStringL -> m (Object a) Source #
Called when RON parser fails.
data CollectionDocId Source #
Collection a => CollectionDocId (DocId a) |
type CollectionName = FilePath Source #
Collection (directory name)
Document identifier (directory name), should be a RON-Base32-encoded RON-UUID.
createDocument :: (Collection a, MonadStorage m) => Object a -> m () Source #
Create document assuming it doesn't exist yet.
Try decode UUID from a file name
docIdFromUuid :: UUID -> DocId a Source #
loadDocument :: (Collection a, MonadStorage m) => DocId a -> m (Document a) Source #
Load all versions of a document
modify :: (Collection a, MonadStorage m) => DocId a -> StateT (Object a) m () -> m (Object a) Source #
Load document, apply changes and put it back to storage