ParkedOps

What an operator does with the parked entries of a node's subscriptions: list and read them, retry or skip one, mark one recoverable or not (9.x MarkRecoverable), apply a retry spec to one (9.x ApplyRetrySpec). The host serves it over HTTP; any node of the service answers for every entry.

A subscription is named by its context and name (SubscriptionId): two contexts of one service may each have a subscription of one name, such as their wow.snapshot, and the ledger keys an entry by both, so each one's entries are its own even when the two contexts share a store, and so a ledger. An entry is the subscription's in the ledger of the context (or the topic) it reads. retry and skip act at once when this node owns the entry's partition; otherwise they leave a request on the entry (LedgerRequest), which the owner takes on its next scan of the parked entries, and answer Outcome.REQUESTED. Marking an entry and applying a spec write the ledger directly: the owner reads them on its next scan.

Types

Link copied to clipboard
Link copied to clipboard

What retry or skip came to.

Properties

Link copied to clipboard

The subscriptions whose entries this node reads, each by the log or lease group it runs in, ordered by group and name: a subscription is one by both, since each context has its own snapshot.

Link copied to clipboard

The subscriptions whose entries this node reads, in order: by context, then by name.

Functions

Link copied to clipboard
suspend fun applyRetrySpec(subscription: SubscriptionId, ref: AggregateRef, spec: ParkedRetrySpec?): ParkedView?

Applies spec to subscription's parked ref, or its subscription's spec again when null.

Link copied to clipboard
suspend fun count(subscription: ParkedSubscription, max: Int): Int

How many entries subscription has parked, up to max: counted by the ledger (FailureLedger.count), which reads none of them.

Link copied to clipboard
suspend fun get(subscription: SubscriptionId, ref: AggregateRef): ParkedView?

The entry parking ref for subscription, if any.

Link copied to clipboard
suspend fun list(subscription: SubscriptionId? = null, after: ParkedKey? = null, limit: Int = DEFAULT_LIMIT, tenantId: String? = null): ParkedPage

Up to limit entries, ordered by subscription (SubscriptionId) and then by aggregate as FailureLedger.list orders them: subscription's only when given, after after (exclusive) when given, and only tenantId's when given (a caller's own tenant, for one that may not act across tenants), which the ledger filters. Each subscription's ledgers are read once, for at most limit entries each. ParkedPage.next is where the next page starts, null when there is none.

Link copied to clipboard
suspend fun markRecoverable(subscription: SubscriptionId, ref: AggregateRef, recoverable: Recoverable): ParkedView?

Marks subscription's parked ref recoverable; null when it is not parked.

Link copied to clipboard
suspend fun owns(subscription: SubscriptionId, ref: AggregateRef): Boolean

Whether this node runs subscription's partition of ref now: it acts on the entry at once, and publishes it. False when the aggregate is not parked by it.

Link copied to clipboard
suspend fun retry(subscription: SubscriptionId, ref: AggregateRef, failedAt: Long? = null): ParkedOps.Outcome

Handles subscription's parked ref again from where it is parked, whatever its retry spec says: at once when this node owns its partition, else by a request to the owner. With failedAt, only the parking at that time (ParkedAggregate.failedAt, as the operator saw it): Outcome.STALE when the entry was parked at another. Without, the current parking: a retry only handles the parked streams again.

Link copied to clipboard
suspend fun skip(subscription: SubscriptionId, ref: AggregateRef, failedAt: Long): ParkedOps.Outcome

Resolves subscription's parked ref without handling what was parked: at once when this node owns its partition and no retry of it runs, else by a request to the owner. Only the parking at failedAt (ParkedAggregate.failedAt, as the operator saw it), which a skip must name since it discards what was parked: Outcome.STALE when the entry was parked at another time.