KandraTimestamp

Utilities for generating explicit write timestamps in microseconds.

Use KandraTimestamp when processing events out of order — passing an explicit timestamp ensures last-event-wins conflict resolution instead of last-server-write-wins.

// Idempotent webhook handler — use event timestamp, not server time
walletRepo.save(wallet, timestampMicros = KandraTimestamp.fromInstant(event.occurredAt))

Functions

Link copied to clipboard
fun fromInstant(instant: Instant): Long

Converts an Instant to microseconds for use as a write timestamp.

Link copied to clipboard
fun now(): Long

Current time in microseconds (Scylla's write timestamp unit).