MaterializedSnapshot

data class MaterializedSnapshot<S : Any>(val contextName: String, val aggregateName: String, val tenantId: String, val ownerId: String = OwnerId.DEFAULT_OWNER_ID, val spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, val aggregateId: String, val version: Int, val eventId: String, val firstOperator: String, val operator: String, val firstEventTime: Long, val eventTime: Long, val state: S, val snapshotTime: Long, val tags: AbacTags = EMPTY_ABAC_TAGS, val deleted: Boolean) : IMaterializedSnapshot<MaterializedSnapshot<S>, S> , NamedAggregate, TenantId, OwnerId, SpaceIdCapable, Version, EventIdCapable, FirstOperatorCapable, OperatorCapable, FirstEventTimeCapable, EventTimeCapable, SnapshotTimeCapable, AbacTaggable, DeletedCapable

Data class representing a complete materialized snapshot of an aggregate's state.

This class contains all the information about an aggregate's state at a specific point in time, including metadata about the aggregate, versioning information, event tracking, and the actual state data. It implements multiple interfaces to provide comprehensive access to all snapshot properties.

Type Parameters

S

The type of the state data.

Constructors

Link copied to clipboard
constructor(contextName: String, aggregateName: String, tenantId: String, ownerId: String = OwnerId.DEFAULT_OWNER_ID, spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, aggregateId: String, version: Int, eventId: String, firstOperator: String, operator: String, firstEventTime: Long, eventTime: Long, state: S, snapshotTime: Long, tags: AbacTags = EMPTY_ABAC_TAGS, deleted: Boolean)

Properties

Link copied to clipboard

The unique identifier of this aggregate instance.

Link copied to clipboard
open override val aggregateName: String

The name of the aggregate.

Link copied to clipboard
open override val contextName: String

The name of the context this aggregate belongs to.

Link copied to clipboard
open override val deleted: Boolean

Whether this aggregate has been marked as deleted.

Link copied to clipboard
open override val eventId: String

The identifier of the last event that led to this snapshot.

Link copied to clipboard
open override val eventTime: Long

The timestamp of the last event for this aggregate.

Link copied to clipboard
open override val firstEventTime: Long

The timestamp of the first event for this aggregate.

Link copied to clipboard
open override val firstOperator: String

The identifier of the first operator who performed an operation on this aggregate.

Link copied to clipboard

Whether the entity has been initialized.

Link copied to clipboard

Whether the entity is at its initial version.

Link copied to clipboard
open override val operator: String

The identifier of the last operator who performed an operation on this aggregate.

Link copied to clipboard
open override val ownerId: String

The identifier of the owner of this aggregate. Defaults to the default owner ID.

Link copied to clipboard
open override val snapshotTime: Long

The timestamp when this snapshot was created.

Link copied to clipboard
open override val spaceId: SpaceId

The identifier of the space containing this aggregate.

Link copied to clipboard
open override val state: S

The actual state data of the aggregate.

Link copied to clipboard
open override val tags: AbacTags

The ABAC tags associated with the snapshot.

Link copied to clipboard
open override val tenantId: String

The identifier of the tenant that owns this aggregate.

Link copied to clipboard
open override val version: Int

The version number of this snapshot.

Functions

Link copied to clipboard

Checks if two aggregates belong to the same context and have the same aggregate name.

Link copied to clipboard

Checks if this entity belongs to the same bounded context as another entity.

Link copied to clipboard
Link copied to clipboard
fun <S : Any, D : Any> MaterializedSnapshot<S>.toSmall(materialize: (S) -> D): SmallMaterializedSnapshot<D>

Converts a materialized snapshot into a simplified snapshot form. This function is used to transform a full snapshot into a simplified snapshot with transformed state.

Link copied to clipboard
open override fun withState(state: S): MaterializedSnapshot<S>

Creates a new MaterializedSnapshot with the specified state.