Version

interface Version

Represents an entity that maintains version information for optimistic concurrency control and state tracking.

This interface provides a standardized way to handle versioning across different domain objects, ensuring that changes can be tracked and conflicts can be detected when multiple operations attempt to modify the same entity simultaneously.

The version starts at UNINITIALIZED_VERSION for new entities and increments with each modification. The first meaningful version after initialization is INITIAL_VERSION.

Author

ahoo wang

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A computed property that indicates whether the entity has been initialized. Returns true if the version is greater than UNINITIALIZED_VERSION. This property is ignored during JSON serialization.

Link copied to clipboard

A computed property that indicates whether the entity is at its initial version. Returns true if the version equals INITIAL_VERSION. This property is ignored during JSON serialization.

Link copied to clipboard
abstract val version: Int

The current version number of the entity as an integer. Versions are monotonically increasing and start from 1 for initialized entities. A version of 0 indicates an uninitialized state.