TagInfo

zio.blocks.projection.TagInfo
final case class TagInfo(aliases: Map[String, String], allTags: Set[String], currentTags: Set[String], migration: DynamicMigration)

Which event tags exist for an event type, and how old tags map to current ones.

Event tags are stored as strings, and a renamed case leaves old events in the store under its old tag. A TagInfo records which tags are current, which are old aliases of them, and the migration that rewrites old events. An EventStore uses it to read old events as if they carried the current tag.

Build one with TagResolver rather than by hand.

Value parameters

aliases

map from an old tag to the current tag it was renamed to. Chains of renames are already followed, so every old tag maps straight to its final name

allTags

every tag that may legitimately be in the store: the current tags plus all old ones

currentTags

the tags the event type's schema produces now

migration

the migration used to transform old events

Attributes

Source
TagResolver.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def currentTagFor(oldTag: String): Option[String]

The current tag that the old tag oldTag was renamed to, if any.

The current tag that the old tag oldTag was renamed to, if any.

Attributes

Source
TagResolver.scala
def expandRequested(requested: Set[String]): Set[String]

Widens a set of tags to be read so that a rename does not hide events. Each requested tag is joined by the old tags that were renamed to it, and by the current tag it was renamed to. An empty request means all tags.

Widens a set of tags to be read so that a rename does not hide events. Each requested tag is joined by the old tags that were renamed to it, and by the current tag it was renamed to. An empty request means all tags.

For example, with UserCreated renamed to UserRegistered, asking for UserRegistered gives both names.

Attributes

Source
TagResolver.scala
def isOldTag(tag: String): Boolean

Whether tag is an old name that has been renamed.

Whether tag is an old name that has been renamed.

Attributes

Source
TagResolver.scala

Runs the migration on an old event's value, so that it can then be decoded with the current schema. Fails if the migration cannot be applied.

Runs the migration on an old event's value, so that it can then be decoded with the current schema. Fails if the migration cannot be applied.

Attributes

Source
TagResolver.scala
def normalize(tag: String): String

Returns the current tag for an old tag, and any other tag unchanged. Use it to compare tags without caring whether an event was stored before or after a rename.

Returns the current tag for an old tag, and any other tag unchanged. Use it to compare tags without caring whether an event was stored before or after a rename.

Attributes

Source
TagResolver.scala
def unknownTags(distinctDbTags: Set[String]): Set[String]

The tags in distinctDbTags that are neither current nor a known old name. Such events were probably written under a name that no migration mentions.

The tags in distinctDbTags that are neither current nor a known old name. Such events were probably written under a name that no migration mentions.

Attributes

Source
TagResolver.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala