Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type WireReducer = UUID -> NonEmpty WireChunk -> [WireChunk]
- data Reducer = Reducer {
- wireReducer :: WireReducer
- stateReducer :: StateChunk -> StateChunk -> StateChunk
- type Unapplied = ([ReducedChunk], [Op])
- class (Eq a, Monoid a) => Reducible a where
- reducibleOpType :: UUID
- stateFromChunk :: [Op] -> a
- stateToChunk :: a -> StateChunk
- applyPatches :: a -> Unapplied -> (a, Unapplied)
- reduceUnappliedPatches :: Unapplied -> Unapplied
- data ReducedChunk = ReducedChunk {}
- mkChunkVersion :: [Op] -> UUID
- mkRC :: UUID -> [Op] -> ReducedChunk
- mkStateChunk :: [Op] -> StateChunk
- data Patch a = Patch {
- patchRef :: UUID
- patchValue :: a
- patchFromRawOp :: Reducible a => Op -> Patch a
- patchFromChunk :: Reducible a => ReducedChunk -> Patch a
- patchToChunk :: Reducible a => Patch a -> ReducedChunk
- class Replicated a where
- data Encoding a = Encoding {
- encodingNewRon :: forall m. ReplicaClock m => a -> WriterT StateFrame m [Atom]
- encodingFromRon :: [Atom] -> StateFrame -> Either String a
- newRon :: (Replicated a, ReplicaClock m) => a -> WriterT StateFrame m [Atom]
- fromRon :: Replicated a => [Atom] -> StateFrame -> Either String a
- objectEncoding :: ReplicatedAsObject a => Encoding a
- payloadEncoding :: ReplicatedAsPayload a => Encoding a
- class ReplicatedAsPayload a where
- class ReplicatedAsObject a where
- objectOpType :: UUID
- newObject :: ReplicaClock m => a -> m (Object a)
- getObject :: Object a -> Either String a
- objectFromRon :: (Object a -> Either String a) -> [Atom] -> StateFrame -> Either String a
- collectFrame :: Functor m => WriterT StateFrame m UUID -> m (Object a)
- getObjectStateChunk :: forall a. ReplicatedAsObject a => Object a -> Either String StateChunk
- eqRef :: Object a -> [Atom] -> Bool
- eqPayload :: ReplicatedAsPayload a => a -> [Atom] -> Bool
- pattern None :: Atom
- pattern Some :: Atom
- pattern ATrue :: Atom
- pattern AFalse :: Atom
Documentation
type WireReducer = UUID -> NonEmpty WireChunk -> [WireChunk] Source #
Reduce all chunks of specific type and object in the frame
Reducer | |
|
type Unapplied = ([ReducedChunk], [Op]) Source #
Unapplied patches and raw ops
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
data ReducedChunk Source #
Instances
Show ReducedChunk Source # | |
Defined in RON.Data.Internal showsPrec :: Int -> ReducedChunk -> ShowS # show :: ReducedChunk -> String # showList :: [ReducedChunk] -> ShowS # |
mkChunkVersion :: [Op] -> UUID Source #
mkStateChunk :: [Op] -> StateChunk Source #
Patch | |
|
patchFromChunk :: Reducible a => ReducedChunk -> Patch a Source #
patchToChunk :: Reducible a => Patch a -> ReducedChunk Source #
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 # | |
Replicated Char Source # | |
Replicated Int64 Source # | |
Replicated Text Source # | |
Replicated Day Source # | |
Replicated UUID Source # | |
Replicated VersionVector Source # | |
Defined in RON.Data.VersionVector | |
Replicated a => Replicated (Maybe a) Source # | |
Replicated a => Replicated (RGA a) Source # | |
ReplicatedAsObject a => Replicated (ObjectORSet a) Source # | |
Defined in RON.Data.ORSet encoding :: Encoding (ObjectORSet a) Source # | |
ReplicatedAsPayload a => Replicated (ORSet a) Source # | |
Encoding | |
|
newRon :: (Replicated a, ReplicaClock m) => a -> WriterT StateFrame m [Atom] Source #
Encode typed data to a payload with possible addition objects
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.
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.
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
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 # | |
objectFromRon :: (Object a -> Either String a) -> [Atom] -> StateFrame -> Either String a Source #
collectFrame :: Functor m => WriterT StateFrame m UUID -> m (Object a) Source #
Helper to build an object frame using arbitrarily nested serializers.
getObjectStateChunk :: forall a. ReplicatedAsObject a => Object a -> Either String StateChunk Source #