StateJson

An aggregate's state as JSON, as Wow writes and reads it (mapper, from WowJson's configuration), and the fingerprint of that JSON's shape (fingerprint): what a snapshot carries (me.ahoo.wow.spi.snapshot.SnapshotRecord, me.ahoo.wow.spi.state.PublishedState) and the Manifest records for a state, so a snapshot written under another shape is replayed from the log instead of read back. The kernel's event codec and the Manifest's generator both take them from here, so the two always agree.

Properties

Link copied to clipboard
val mapper: JsonMapper

The mapper of a state's JSON: WowJson's, which reads a val with no setter into its field as 9.x's JSON did, with the settings a state's round trip needs besides. A getter of its own (val items: List<Item> get() = lines) is not read: a getter that computes an immutable collection of an event or a state reads back, and a state that keeps a collection behind such a getter does not, so its snapshot is refused and its log replayed.

Functions

Link copied to clipboard
fun fingerprint(stateType: Class<*>, mapper: JsonMapper = this.mapper): String

Identifies the shape of stateType's JSON as mapper serializes it: the SHA-256 hash of a structural description built from what Jackson's format visitor reports, that is from the serializers the mapper would use, after naming strategies, ignored properties and the Kotlin module apply (shape):

Link copied to clipboard
fun shape(stateType: Class<*>, mapper: JsonMapper = this.mapper): String

The description fingerprint hashes.