Copyright | Jeremy Groven |
---|---|
License | BSD3 |
Safe Haskell | None |
Language | Haskell2010 |
- data Fragment k v
- = FragmentBranch { }
- | FragmentBottom {
- fragmentObjectID :: ObjectID
- fragmentMap :: Map k v
- toFragments :: (Ord k, Serialize k, StableKey k, Serialize v) => StableTree k v -> [Fragment k v]
- fromFragments :: (Ord k, Serialize k, StableKey k, Serialize v) => Map ObjectID (Fragment k v) -> Fragment k v -> Either Text (StableTree k v)
- fragsToMap :: Ord k => Map ObjectID (Fragment k v) -> Fragment k v -> Either Text (Map k v)
Documentation
A Fragment
is a user-visible part of a tree, i.e. a single node in the
tree that can actually be manipulated by a user. This is useful when doing
the work of persisting trees. See toFragments
and fromFragments
for functions to convert
between Fragments and Trees. see store
and
load
for functions related to storing and
retrieving Fragments.
FragmentBranch | |
| |
FragmentBottom | |
|
toFragments :: (Ord k, Serialize k, StableKey k, Serialize v) => StableTree k v -> [Fragment k v] Source
Convert a StableTree
Tree
into a list of storable Fragment
s. The
resulting list is guaranteed to be in an order where each Fragment
will be
seen after all its children.
fromFragments :: (Ord k, Serialize k, StableKey k, Serialize v) => Map ObjectID (Fragment k v) -> Fragment k v -> Either Text (StableTree k v) Source
Recover a Tree
from a single Fragment
and a map of the fragments as
returned from toFragments
. If the fragment set was already stored, it is
the caller's responsibility to load all the child fragments into a map
(probably involving finding children using the fragmentChildren field of the
Fragment type).