Safe Haskell | None |
---|---|
Language | Haskell2010 |
Conversion between UStore
in Haskell and Michelson representation.
Synopsis
- type UStoreContent = [(ByteString, ByteString)]
- class (Generic template, GUStoreConversible (Rep template)) => UStoreConversible template
- mkUStore :: UStoreConversible template => template -> UStore template
- ustoreDecompose :: forall template. UStoreConversible template => UStore template -> Either Text (UStoreContent, template)
- ustoreDecomposeFull :: forall template. UStoreConversible template => UStore template -> Either Text template
- fillUStore :: UStoreConversible template => template -> UStoreMigration () template
- migrateFillUStore :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> Lambda (MUStore oldTempl newTempl diff touched) (MUStore oldTempl newTempl newDiff newTouched)
- fillUStoreMigrationBlock :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> MigrationBlocks oldTempl newTempl diff touched newDiff newTouched
Documentation
type UStoreContent = [(ByteString, ByteString)] Source #
UStore
content represented as key-value pairs.
class (Generic template, GUStoreConversible (Rep template)) => UStoreConversible template Source #
Given template can be converted to UStore
value.
Instances
(Generic template, GUStoreConversible (Rep template)) => UStoreConversible template Source # | |
Defined in Lorentz.UStore.Haskell |
mkUStore :: UStoreConversible template => template -> UStore template Source #
Make UStore
from separate big_map
s and fields.
ustoreDecompose :: forall template. UStoreConversible template => UStore template -> Either Text (UStoreContent, template) Source #
Decompose UStore
into separate big_map
s and fields.
Since this function needs to UNPACK
content of UStore
to actual
keys and values, you have to provide UnpackEnv
.
Along with resulting value, you get a list of UStore
entries which
were not recognized as belonging to any submap or field according to
UStore
's template - this should be empty unless UStore
invariants
were violated.
ustoreDecomposeFull :: forall template. UStoreConversible template => UStore template -> Either Text template Source #
Like ustoreDecompose
, but requires all entries from UStore
to be
recognized.
fillUStore :: UStoreConversible template => template -> UStoreMigration () template Source #
Make migration script which initializes UStore
from scratch.
migrateFillUStore :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> Lambda (MUStore oldTempl newTempl diff touched) (MUStore oldTempl newTempl newDiff newTouched) Source #
Fill UStore
with entries from the given template as part of simple
migration.
Sometimes you already have some fields initialized and fillUStore
does not
suit, then in case if your UStore template is a nested structure you can use
sub-templates to initialize the corresponding parts of UStore.
For batched migrations see fillUStoreMigrationBlock
.
fillUStoreMigrationBlock :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> MigrationBlocks oldTempl newTempl diff touched newDiff newTouched Source #
Version of migrateFillUStore
for batched migrations.
Each field write will be placed to a separate batch.