Outbox store

Generated reference for ovok_sdk: outbox store.

  • Stable unknown
  • Release candidate not available
  • Development since 0.2.0-dev.51+80996d9

OfflineMeasurementFailure

class OfflineMeasurementFailure

Why a queued save last failed.

Constructors

OfflineMeasurementFailure.new

OfflineMeasurementFailure({
  required String name,
  String? code,
  int? status,
})

A failure named name, with the server's code and status when known.

ParameterTypeKindDefault
nameStringrequired named
codeString?named
statusint?named

OfflineMeasurementFailure.fromJson

OfflineMeasurementFailure.fromJson(JsonMap json)

Reads a failure stored by toJson.

ParameterTypeKindDefault
jsonJsonMappositional

Properties

OfflineMeasurementFailure.name

final String name

The error's type, e.g. OvokServiceException.

OfflineMeasurementFailure.code

final String? code

The condition the server named, when known.

OfflineMeasurementFailure.status

final int? status

The HTTP status, when known.

Methods

OfflineMeasurementFailure.toJson

JsonMap toJson()

The failure as stored in the queue.

Returns JsonMap.

OutboxItem

class OutboxItem extends OutboxItemSummary

One reading waiting to be sent: the bundle entries that save it, with their state.

Constructors

OutboxItem.new

OutboxItem({
  required String id,
  required String ownerKey,
  required OutboxState state,
  required int attempts,
  required int nextAttemptAt,
  required int createdAt,
  required int recordedAt,
  OfflineMeasurementFailure? lastFailure,
  required List<JsonMap> entries,
})

An item that sends entries in one FHIR transaction.

ParameterTypeKindDefault
idStringrequired named
ownerKeyStringrequired named
stateOutboxStaterequired named
attemptsintrequired named
nextAttemptAtintrequired named
createdAtintrequired named
recordedAtintrequired named
lastFailureOfflineMeasurementFailure?named
entriesList<Map<String, dynamic>>required named

Properties

OutboxItem.entries

final List<Map<String, dynamic>> entries

The bundle entries to send.

Methods

OutboxItem.copyWith

OutboxItem copyWith({
  OutboxState? state,
  int? attempts,
  int? nextAttemptAt,
  OfflineMeasurementFailure? lastFailure,
})

This item with the given fields replaced.

ParameterTypeKindDefault
stateOutboxState?named
attemptsint?named
nextAttemptAtint?named
lastFailureOfflineMeasurementFailure?named

Returns OutboxItem.

OutboxItemSummary

class OutboxItemSummary

An outbox item without its entries: what the outbox lists and counts.

Constructors

OutboxItemSummary.new

OutboxItemSummary({
  required String id,
  required String ownerKey,
  required OutboxState state,
  required int attempts,
  required int nextAttemptAt,
  required int createdAt,
  required int recordedAt,
  OfflineMeasurementFailure? lastFailure,
})

A summary of the item id that the account ownerKey queued.

ParameterTypeKindDefault
idStringrequired named
ownerKeyStringrequired named
stateOutboxStaterequired named
attemptsintrequired named
nextAttemptAtintrequired named
createdAtintrequired named
recordedAtintrequired named
lastFailureOfflineMeasurementFailure?named

Properties

OutboxItemSummary.id

final String id

Unique id: the reading's entry fullUrls, joined by |.

OutboxItemSummary.ownerKey

final String ownerKey

Account that owns the item; only that account's session sends it.

OutboxItemSummary.state

final OutboxState state

Whether the item is still being sent.

OutboxItemSummary.attempts

final int attempts

Attempts that failed.

OutboxItemSummary.nextAttemptAt

final int nextAttemptAt

Earliest time to try again, in epoch milliseconds.

OutboxItemSummary.createdAt

final int createdAt

When the item entered the outbox, in epoch milliseconds.

OutboxItemSummary.recordedAt

final int recordedAt

When the reading was taken, in epoch milliseconds; the outbox sends the newest first.

OutboxItemSummary.lastFailure

final OfflineMeasurementFailure? lastFailure

The last failure, when there was one.

OutboxState

enum OutboxState

Whether an outbox item is still being sent.

Values

OutboxState.pending

static const OutboxState pending

Waiting to be sent, now or after its backoff.

OutboxState.rejected

static const OutboxState rejected

Used up its attempts; sent again only by a flush that includes or resets it.

OutboxStore

abstract interface class OutboxStore

Where the outbox keeps its items so they survive a restart.

Every method must be atomic, so a crash leaves an item either stored or not.

Methods

OutboxStore.put

Future<void> put(OutboxItem item)

Stores item, replacing the one with the same id.

ParameterTypeKindDefault
itemOutboxItempositional

Returns Future<void>.

OutboxStore.get

Future<OutboxItem?> get(String id)

The item id, or null when there is none.

ParameterTypeKindDefault
idStringpositional

Returns Future<OutboxItem?>.

OutboxStore.remove

Future<void> remove(String id)

Deletes the item id; an unknown id is not an error.

ParameterTypeKindDefault
idStringpositional

Returns Future<void>.

OutboxStore.due

Future<List<OutboxItem>> due(
  String ownerKey,
  int now,
  int limit,
)

The owner's pending items whose nextAttemptAt is not after now, newest recordedAt first, at most limit.

ParameterTypeKindDefault
ownerKeyStringpositional
nowintpositional
limitintpositional

Returns Future<List<OutboxItem>>.

OutboxStore.summaries

Future<List<OutboxItemSummary>> summaries(String ownerKey)

Every item of the owner, in any state, without its entries.

ParameterTypeKindDefault
ownerKeyStringpositional

Returns Future<List<OutboxItemSummary>>.

OutboxStore.count

Future<int> count(String ownerKey, OutboxState state)

How many of the owner's items are in state.

ParameterTypeKindDefault
ownerKeyStringpositional
stateOutboxStatepositional

Returns Future<int>.

Last updated on

On this page