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 OfflineMeasurementFailureWhy 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
name | String | required named | |
code | String? | named | |
status | int? | named |
OfflineMeasurementFailure.fromJson
OfflineMeasurementFailure.fromJson(JsonMap json)Reads a failure stored by toJson.
| Parameter | Type | Kind | Default |
|---|---|---|---|
json | JsonMap | positional |
Properties
OfflineMeasurementFailure.name
final String nameThe error's type, e.g. OvokServiceException.
OfflineMeasurementFailure.code
final String? codeThe condition the server named, when known.
OfflineMeasurementFailure.status
final int? statusThe HTTP status, when known.
Methods
OfflineMeasurementFailure.toJson
JsonMap toJson()The failure as stored in the queue.
Returns JsonMap.
OutboxItem
class OutboxItem extends OutboxItemSummaryOne 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String | required named | |
ownerKey | String | required named | |
state | OutboxState | required named | |
attempts | int | required named | |
nextAttemptAt | int | required named | |
createdAt | int | required named | |
recordedAt | int | required named | |
lastFailure | OfflineMeasurementFailure? | named | |
entries | List<Map<String, dynamic>> | required named |
Properties
OutboxItem.entries
final List<Map<String, dynamic>> entriesThe bundle entries to send.
Methods
OutboxItem.copyWith
OutboxItem copyWith({
OutboxState? state,
int? attempts,
int? nextAttemptAt,
OfflineMeasurementFailure? lastFailure,
})This item with the given fields replaced.
| Parameter | Type | Kind | Default |
|---|---|---|---|
state | OutboxState? | named | |
attempts | int? | named | |
nextAttemptAt | int? | named | |
lastFailure | OfflineMeasurementFailure? | named |
Returns OutboxItem.
OutboxItemSummary
class OutboxItemSummaryAn 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String | required named | |
ownerKey | String | required named | |
state | OutboxState | required named | |
attempts | int | required named | |
nextAttemptAt | int | required named | |
createdAt | int | required named | |
recordedAt | int | required named | |
lastFailure | OfflineMeasurementFailure? | named |
Properties
OutboxItemSummary.id
final String idUnique id: the reading's entry fullUrls, joined by |.
OutboxItemSummary.ownerKey
final String ownerKeyAccount that owns the item; only that account's session sends it.
OutboxItemSummary.state
final OutboxState stateWhether the item is still being sent.
OutboxItemSummary.attempts
final int attemptsAttempts that failed.
OutboxItemSummary.nextAttemptAt
final int nextAttemptAtEarliest time to try again, in epoch milliseconds.
OutboxItemSummary.createdAt
final int createdAtWhen the item entered the outbox, in epoch milliseconds.
OutboxItemSummary.recordedAt
final int recordedAtWhen the reading was taken, in epoch milliseconds; the outbox sends the newest first.
OutboxItemSummary.lastFailure
final OfflineMeasurementFailure? lastFailureThe last failure, when there was one.
OutboxState
enum OutboxStateWhether an outbox item is still being sent.
Values
OutboxState.pending
static const OutboxState pendingWaiting to be sent, now or after its backoff.
OutboxState.rejected
static const OutboxState rejectedUsed up its attempts; sent again only by a flush that includes or resets it.
OutboxStore
abstract interface class OutboxStoreWhere 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
item | OutboxItem | positional |
Returns Future<void>.
OutboxStore.get
Future<OutboxItem?> get(String id)The item id, or null when there is none.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String | positional |
Returns Future<OutboxItem?>.
OutboxStore.remove
Future<void> remove(String id)Deletes the item id; an unknown id is not an error.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String | positional |
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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
ownerKey | String | positional | |
now | int | positional | |
limit | int | positional |
Returns Future<List<OutboxItem>>.
OutboxStore.summaries
Future<List<OutboxItemSummary>> summaries(String ownerKey)Every item of the owner, in any state, without its entries.
| Parameter | Type | Kind | Default |
|---|---|---|---|
ownerKey | String | positional |
Returns Future<List<OutboxItemSummary>>.
OutboxStore.count
Future<int> count(String ownerKey, OutboxState state)How many of the owner's items are in state.
| Parameter | Type | Kind | Default |
|---|---|---|---|
ownerKey | String | positional | |
state | OutboxState | positional |
Returns Future<int>.
Last updated on