Details
-
Task
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
3
-
Language 2016-03-09, Language 2016-03-23, Language 2016-04-06, Language 2016-04-20, Language 2016-05-04
Description
The goal of the PCore serialization feature is to provide consistent serialization between two parties that may have completely different implementation.
- The implementation objects being used to represent runtime values that are to be part of a serialization should be free from serialization concern. (e.g. we want to avoid having to have to_yaml, to_this, to_that as methods on runtime objects.
- Everything that is part of a serialization muse be modeled by a PCore model. It is the PCore model that controls how the values of a runtime objects should be serialized.
- The serialization APIs should be agnostic towards the resulting serialization "on the wire format"; e.g. if it is binary or textual, if it is optimized/tabulated or if it is human readable / understandable.
- The API should allow 3d party serialization formats to be defined (i.e. this should be an open ended design). It does not have to specify how such formats are discovered, but the API itself should be open.
- When two parties communicate indirectly e.g. via a persisted file, the file must contain an envelope that makes it possible to discover how it should be deserialized. When two parties communicate directly they can agree on a format up front.
- The serialization should be agnostic towards the implementation used at either end of a transfer; no runtime implementation specific information should be embedded in the serialization (i.e. no instances of Ruby/C++/Java classes). A mapping via a PCore model is always required. For puppet type system built in data types (e.g. Integer), each side is expected to have a base implementation that deals with this mapping, either via a PCore type mapping and use of generic objects, or by binding it in that that languages runtime in a hard coded fashion.
- each serialization must (either via envelope or protocol negotiation) establish the identifier of the PCore model to use for serialization. That model in turn needs to reference any auxiliary PCore models that it relies on. It is then up to each side to use a binding of the PCore references to something that works in the respective side's implementation. (e.g. In Ruby a Locator in an AST is a Puppet::Pops::Model::Locator, in C++ it may have a completely different class name).