Safe Haskell | None |
---|---|
Language | Haskell2010 |
Typed and untyped RON tools
Synopsis
- class (Eq a, Monoid a) => Reducible a where
- reducibleOpType :: UUID
- stateFromChunk :: [Op] -> a
- stateToChunk :: a -> StateChunk
- applyPatches :: a -> Unapplied -> (a, Unapplied)
- reduceUnappliedPatches :: Unapplied -> Unapplied
- class Replicated a where
- encoding :: Encoding a
- class ReplicatedAsObject a where
- objectOpType :: UUID
- newObject :: ReplicaClock m => a -> m (Object a)
- getObject :: Object a -> Either String a
- class ReplicatedAsPayload a where
- fromRon :: Replicated a => [Atom] -> StateFrame -> Either String a
- mkStateChunk :: [Op] -> StateChunk
- newRon :: (Replicated a, ReplicaClock m) => a -> WriterT StateFrame m [Atom]
- objectEncoding :: ReplicatedAsObject a => Encoding a
- payloadEncoding :: ReplicatedAsPayload a => Encoding a
- reduceObject :: Object a -> Object a -> Either String (Object a)
- reduceStateFrame :: StateFrame -> StateFrame -> Either String StateFrame
- reduceWireFrame :: WireFrame -> WireFrame
Documentation
class (Eq a, Monoid a) => Reducible a where Source #
Untyped-reducible types. Untyped means if this type is a container then the types of data contained in it is not considered.
reducibleOpType :: UUID Source #
UUID of the type
stateFromChunk :: [Op] -> a Source #
Load a state from a state chunk
stateToChunk :: a -> StateChunk Source #
Store a state to a state chunk
applyPatches :: a -> Unapplied -> (a, Unapplied) Source #
Merge a state with patches and raw ops
reduceUnappliedPatches :: Unapplied -> Unapplied Source #
Merge patches and raw ops into bigger patches or throw obsolete ops
Instances
class Replicated a where Source #
Base class for typed encoding
encoding :: Encoding a Source #
Instances SHOULD implement encoding
either as objectEncoding
or as
payloadEncoding
Instances
Replicated Bool Source # | |
Defined in RON.Data.Internal | |
Replicated Char Source # | |
Defined in RON.Data.Internal | |
Replicated Int64 Source # | |
Defined in RON.Data.Internal | |
Replicated Text Source # | |
Defined in RON.Data.Internal | |
Replicated Day Source # | |
Defined in RON.Data.Time | |
Replicated UUID Source # | |
Defined in RON.Data.Internal | |
Replicated VersionVector Source # | |
Defined in RON.Data.VersionVector encoding :: Encoding VersionVector Source # | |
Replicated a => Replicated (Maybe a) Source # | |
Defined in RON.Data.Internal | |
Replicated a => Replicated (RGA a) Source # | |
Defined in RON.Data.RGA | |
ReplicatedAsObject a => Replicated (ObjectORSet a) Source # | |
Defined in RON.Data.ORSet encoding :: Encoding (ObjectORSet a) Source # | |
ReplicatedAsPayload a => Replicated (ORSet a) Source # | |
Defined in RON.Data.ORSet |
class ReplicatedAsObject a where Source #
Instances of this class are encoded as objects. An enclosing object's payload will be filled with this object's id.
objectOpType :: UUID Source #
UUID of the type
newObject :: ReplicaClock m => a -> m (Object a) Source #
Encode data
getObject :: Object a -> Either String a Source #
Decode data
Instances
ReplicatedAsObject VersionVector Source # | |
Defined in RON.Data.VersionVector objectOpType :: UUID Source # newObject :: ReplicaClock m => VersionVector -> m (Object VersionVector) Source # getObject :: Object VersionVector -> Either String VersionVector Source # | |
Replicated a => ReplicatedAsObject (RGA a) Source # | |
ReplicatedAsObject a => ReplicatedAsObject (ObjectORSet a) Source # | |
Defined in RON.Data.ORSet objectOpType :: UUID Source # newObject :: ReplicaClock m => ObjectORSet a -> m (Object (ObjectORSet a)) Source # getObject :: Object (ObjectORSet a) -> Either String (ObjectORSet a) Source # | |
ReplicatedAsPayload a => ReplicatedAsObject (ORSet a) Source # | |
class ReplicatedAsPayload a where Source #
Instances of this class are encoded as payload only.
toPayload :: a -> [Atom] Source #
Encode data
fromPayload :: [Atom] -> Either String a Source #
Decode data
fromRon :: Replicated a => [Atom] -> StateFrame -> Either String a Source #
Decode typed data from a payload. The implementation may use other objects in the frame to resolve references.
mkStateChunk :: [Op] -> StateChunk Source #
newRon :: (Replicated a, ReplicaClock m) => a -> WriterT StateFrame m [Atom] Source #
Encode typed data to a payload with possible addition objects
objectEncoding :: ReplicatedAsObject a => Encoding a Source #
Standard implementation of Replicated
for ReplicatedAsObject
types.
payloadEncoding :: ReplicatedAsPayload a => Encoding a Source #
Standard implementation of Replicated
for ReplicatedAsPayload
types.
reduceObject :: Object a -> Object a -> Either String (Object a) Source #
Reduce object with frame from another version of the same object.
reduceWireFrame :: WireFrame -> WireFrame Source #