SequentialIdentities

class SequentialIdentities(val dynamicKind: IdKind) : IIdentities

Recommended implementation of IIdentities that avoids ID collisions.

  • Dynamic IDs (next): Sequential integers that ignore the parent ID. Client IDs are even, server IDs are odd, ensuring no overlap.

  • Stable IDs (mix): Hash-based with the high bit set (0x8000000000000000) to ensure they never collide with dynamic IDs. The number of stable entities is small, so hash collisions are unlikely.

Constructors

Link copied to clipboard
constructor(dynamicKind: IdKind)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val dynamicKind: IdKind

Functions

Link copied to clipboard
open override fun mix(rdId: RdId, tail: Int): RdId

Creates a stable identifier by mixing the parent ID with an integer key.

open override fun mix(rdId: RdId, tail: Long): RdId

Creates a stable identifier by mixing the parent ID with a long key.

open override fun mix(rdId: RdId, tail: String): RdId

Creates a stable identifier by mixing the parent ID with a string key.

Link copied to clipboard
open override fun next(parent: RdId): RdId

Generates the next unique dynamic identifier for a runtime-created entity.