ron-storage-0.11: RON Storage

Safe HaskellNone
LanguageHaskell2010

RON.Storage.Backend

Description

RON Storage details. Use of this module only to implement a backend.

Synopsis

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.

Minimal complete definition

collectionName

Methods

collectionName :: CollectionName Source #

fallbackParse :: MonadE m => UUID -> ByteStringL -> m (ObjectFrame a) Source #

Called when RON parser fails.

type CollectionName = FilePath Source #

Collection (directory name)

newtype DocId a Source #

Constructors

DocId RawDocId 
Instances
Eq (DocId a) Source # 
Instance details

Defined in RON.Storage.Backend

Methods

(==) :: DocId a -> DocId a -> Bool #

(/=) :: DocId a -> DocId a -> Bool #

Ord (DocId a) Source # 
Instance details

Defined in RON.Storage.Backend

Methods

compare :: DocId a -> DocId a -> Ordering #

(<) :: DocId a -> DocId a -> Bool #

(<=) :: DocId a -> DocId a -> Bool #

(>) :: DocId a -> DocId a -> Bool #

(>=) :: DocId a -> DocId a -> Bool #

max :: DocId a -> DocId a -> DocId a #

min :: DocId a -> DocId a -> DocId a #

Collection a => Show (DocId a) Source # 
Instance details

Defined in RON.Storage.Backend

Methods

showsPrec :: Int -> DocId a -> ShowS #

show :: DocId a -> String #

showList :: [DocId a] -> ShowS #

Hashable (DocId a) Source # 
Instance details

Defined in RON.Storage.Backend

Methods

hashWithSalt :: Int -> DocId a -> Int #

hash :: DocId a -> Int #

data Document a Source #

Result of DB reading, loaded document with information about its versions

Instances
Show (Document a) Source # 
Instance details

Defined in RON.Storage.Backend

Methods

showsPrec :: Int -> Document a -> ShowS #

show :: Document a -> String #

showList :: [Document a] -> ShowS #

type DocVersion = FilePath Source #

Document version identifier (file name)

newtype IsTouched Source #

A thing (e.g. document) was fixed during loading. It it was fixed during loading it must be saved to the storage.

Constructors

IsTouched Bool 
Instances
Show IsTouched Source # 
Instance details

Defined in RON.Storage.Backend

class (ReplicaClock m, MonadE m) => MonadStorage m where Source #

Storage backend interface

Methods

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 #

type RawDocId = FilePath Source #

Document identifier (directory name), should be a RON-Base32-encoded RON-UUID.

createVersion Source #

Arguments

:: (Collection a, MonadStorage m) 
=> Maybe (DocId a, Document a)

Just, if document exists already; Nothing otherwise.

-> ObjectFrame a 
-> m () 

Create new version of an object/document. If the document doesn't exist yet, it will be created.

decodeDocId Source #

Arguments

:: DocId a 
-> Maybe (Bool, UUID)

Bool = is document id a valid UUID encoding

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