v0.18.0
go-ipld-prime's release policy says that:
even numbers should be easy upgrades; odd numbers may change things
So, as an even number, this v0.18.0 release should be a smooth ride for upgraders from v0.17.0. We have 3 major feature additions, all focused on Bindnode.
🔦 Highlights
- Bindnode: Custom Go type converters - Bindnode performs bidirectional mapping of Go types to the IPLD Data Model, and in doing so, it assumes a straightforward mapping of values to their encoded forms. But there are common cases where a Go type doesn't have a straightforward path to serialization, either because the encoded form needs a custom layout, or because bindnode doesn't have enough information to infer a serialization pattern. Custom Go type converters for bindnode allow a user to supply a pair of converter functions for a Go type that dictate how to map that type to an IPLD Data Model kind. See the bindnode documentation for more information.
- Bindnode: Type registry - Setting up Go type mappings with Bindnode involves some boilerplate. A basic type registry is now available that takes some of this boilerplate away; giving you a single place to register, and perform conversions to and from Go types, Data Model (
Node
) forms or directly through serialization. See the bindnode/registry documentation for more information. - Bindnode: Full
uint64
support - theuint64
support introduced in go-ipld-prime@v0.17.0 has been wired into Bindnode. The Data Model (Node
) forms expose integers asint64
values, which is lossy for unsigned 64-bit integers. Bindnode Go types usinguint64
values are now lossless in round-trips through serialization to codecs that support the full range (DAG-CBOR most notably).
You can see all of these new features in action using Filecoin Go types, allowing a mapping between Go types, Data Model (Node
) forms, and their DAG-CBOR serialized forms with data-transfer vouchers. These features also allow us to interact with the original Go types, without modification, including big.Int
serialization to Bytes
, Filecoin Signature
serialization to a byte-prefix discriminated Bytes
and more. Since the Go types are unchanged, they can also simultaneously support cbor-gen serialization, allowing an easier migration path.