Safe Haskell | None |
---|---|
Language | Haskell2010 |
RON Storage details. Use of this module only to implement a backend.
Synopsis
- class (ReplicatedAsObject a, Typeable a) => Collection a where
- collectionName :: CollectionName
- fallbackParse :: MonadE m => UUID -> ByteStringL -> m (ObjectFrame a)
- type CollectionName = FilePath
- newtype DocId a = DocId RawDocId
- data Document a = Document {}
- type DocVersion = FilePath
- newtype IsTouched = IsTouched Bool
- class (ReplicaClock m, MonadE m) => MonadStorage m where
- getCollections :: m [CollectionName]
- getDocuments :: Collection a => m [DocId a]
- getDocumentVersions :: Collection a => DocId a -> m [DocVersion]
- saveVersionContent :: Collection a => DocId a -> DocVersion -> ByteStringL -> m ()
- loadVersionContent :: Collection a => DocId a -> DocVersion -> m ByteStringL
- deleteVersion :: Collection a => DocId a -> DocVersion -> m ()
- changeDocId :: Collection a => DocId a -> DocId a -> m ()
- type RawDocId = FilePath
- createVersion :: forall a m. (Collection a, MonadStorage m) => Maybe (DocId a, Document a) -> ObjectFrame a -> m ()
- decodeDocId :: DocId a -> Maybe (Bool, UUID)
- readVersion :: MonadStorage m => Collection a => DocId a -> DocVersion -> m (ObjectFrame a, IsTouched)
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 (ObjectFrame a) Source #
Called when RON parser fails.
type CollectionName = FilePath Source #
Collection (directory name)
Result of DB reading, loaded document with information about its versions
type DocVersion = FilePath Source #
Document version identifier (file name)
A thing (e.g. document) was fixed during loading. It it was fixed during loading it must be saved to the storage.
class (ReplicaClock m, MonadE m) => MonadStorage m where Source #
Storage backend interface
getCollections :: m [CollectionName] Source #
getDocuments :: Collection a => m [DocId a] Source #
Must return []
for non-existent collection
getDocumentVersions :: Collection a => DocId a -> m [DocVersion] Source #
Must return []
for non-existent document
saveVersionContent :: Collection a => DocId a -> DocVersion -> ByteStringL -> m () Source #
Must create collection and document if not exist
loadVersionContent :: Collection a => DocId a -> DocVersion -> m ByteStringL Source #
deleteVersion :: Collection a => DocId a -> DocVersion -> m () Source #
changeDocId :: Collection a => DocId a -> DocId a -> m () Source #
Instances
MonadStorage Storage Source # | |
Defined in RON.Storage.FS 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 # |
type RawDocId = FilePath Source #
Document identifier (directory name), should be a RON-Base32-encoded RON-UUID.
:: (Collection a, MonadStorage m) | |
=> Maybe (DocId a, Document a) | |
-> ObjectFrame a | |
-> m () |
Create new version of an object/document. If the document doesn't exist yet, it will be created.
Try decode UUID from a file name
readVersion :: MonadStorage m => Collection a => DocId a -> DocVersion -> m (ObjectFrame a, IsTouched) Source #
Load document version as an object