VerifiedPubSub.Transformers.DefinePayloadSchemas (VerifiedPubSub v0.1.0)

Copy Markdown View Source

Defines __verified_pubsub_fields__/2 on the manifest, with one clause for each event.

Each clause takes a topic and an event, and returns the fields that the manifest declares for that event. A clause leaves out the __spark_metadata__ of each field. That metadata holds source annotations, which only add size to the compiled manifest.

Tradeoffs

The manifest holds the fields, and each broadcast calls a clause to read them. This gives up a little speed: a copy of the fields at each call site is a little faster. But a module that Mix does not compile again after a change to the manifest keeps an old copy. Each copy also makes its call site larger. A clause that returns a literal list is fast enough to run on each broadcast.

Summary

Functions

after_compile?()

Callback implementation for Spark.Dsl.Transformer.after_compile?/0.

before?(_)

Callback implementation for Spark.Dsl.Transformer.before?/1.