Interface TotpStore

All Known Implementing Classes:
InMemoryTotpStore

@ThreadSafe @CheckReturnValue public interface TotpStore
Application-owned, authoritative TOTP storage. Implementations coordinate every node, read a complete immutable snapshot and atomically compare every version, absence and active recovery epoch before applying all mutations or none. A separately performed epoch or time lookup is insufficient. A confirmed commit is durable across restart. InMemoryTotpStore is an explicitly selected volatile demonstration backend, never an automatic fallback.

Both record kinds are permanent. No backend TTL, eviction or automatic deletion is allowed, including after factor removal. Capacity refusal changes nothing. Unknown acknowledgement after a possible mutation is UNKNOWN, never CONFLICT or UNAVAILABLE. Only definite CONFLICT permits bounded recalculation. Honor positive remaining caller-thread budgets and preserve interruption.

Namespace activation metadata is application-owned. INITIALIZE_NAMESPACE atomically inserts its root and changes NEW to ACTIVATED once. Updates require ACTIVATED and a present root; a missing root in an activated epoch is unavailability, never permission to initialize again. Recovery provisioning fences all old writers before a fresh, never-reused epoch is initialized.

Since:
1.0.0
  • Method Details

    • read

      Reads exactly the requested nonempty bounded scope at one authoritative snapshot point, checking the active epoch and operational admission in the same transaction. The entries and fresh admitted time or time-only unavailability form one coherent observation. Explicitly represent every absence; no cleanup, quota update or floor write belongs to a read.
      Parameters:
      keys - one namespace and recovery epoch, at most 16 addresses
      remainingBudget - remaining positive operation budget
      Returns:
      a complete snapshot, fenced epoch or unavailable read
      Since:
      1.0.0
    • compareAndCommit

      Atomically compares current admission, epoch and all snapshot predicates, then validates fresh store-authoritative time after every wait, including for condition-only writes.
      Parameters:
      write - the exact predicates and complete change set
      remainingBudget - remaining positive operation budget
      Returns:
      the factual contextual receipt, with required validation timing for COMMITTED
      Since:
      1.0.0