BunSqlDeliveryTrackingStore
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:34
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BunSqlDeliveryTrackingStore(
options?):BunSqlDeliveryTrackingStore
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:40
Parameters
Section titled “Parameters”options?
Section titled “options?”BunSqlDeliveryTrackingStoreOptions = {}
Returns
Section titled “Returns”BunSqlDeliveryTrackingStore
Methods
Section titled “Methods”close()
Section titled “close()”close():
Promise<void>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:150
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”countBy()
Section titled “countBy()”countBy(
filter,groupBy):Promise<DeliveryTrackingCountByRow[]>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:136
Parameters
Section titled “Parameters”filter
Section titled “filter”groupBy
Section titled “groupBy”readonly DeliveryTrackingCountByField[]
Returns
Section titled “Returns”Promise<DeliveryTrackingCountByRow[]>
Implementation of
Section titled “Implementation of”countRecords()
Section titled “countRecords()”countRecords(
filter):Promise<number>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:132
Parameters
Section titled “Parameters”filter
Section titled “filter”Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”DeliveryTrackingStore.countRecords
get(
messageId):Promise<TrackingRecord|undefined>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:94
Parameters
Section titled “Parameters”messageId
Section titled “messageId”string
Returns
Section titled “Returns”Promise<TrackingRecord | undefined>
Implementation of
Section titled “Implementation of”init()
Section titled “init()”init():
Promise<void>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:86
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”leaseDue()
Section titled “leaseDue()”leaseDue(
now,limit,leaseUntil):Promise<TrackingRecord[] |undefined>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:102
Like listDue, but also leases the records it returns: in the same
atomic step their nextCheckAt moves to leaseUntil, so other pollers
of the store skip them until the poll stores their next check or the
lease runs out. It resolves undefined when this store cannot lease
atomically. DeliveryTrackingService leases only with a store that has
both this and patchLeased, and otherwise uses listDue.
Parameters
Section titled “Parameters”Date
number
leaseUntil
Section titled “leaseUntil”Date
Returns
Section titled “Returns”Promise<TrackingRecord[] | undefined>
Implementation of
Section titled “Implementation of”DeliveryTrackingStore.leaseDue
listDue()
Section titled “listDue()”listDue(
now,limit):Promise<TrackingRecord[]>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:98
Parameters
Section titled “Parameters”Date
number
Returns
Section titled “Returns”Promise<TrackingRecord[]>
Implementation of
Section titled “Implementation of”listRecords()
Section titled “listRecords()”listRecords(
options):Promise<TrackingRecord[]>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:126
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<TrackingRecord[]>
Implementation of
Section titled “Implementation of”DeliveryTrackingStore.listRecords
patch()
Section titled “patch()”patch(
messageId,patch):Promise<void>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:143
Parameters
Section titled “Parameters”messageId
Section titled “messageId”string
Partial<TrackingRecord>
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”patchLeased()
Section titled “patchLeased()”patchLeased(
messageId,leaseUntil,patch):Promise<boolean>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:110
Applies patch only while the record is still leased until leaseUntil
(its nextCheckAt equals it), and resolves whether it did. The check
and the write are one atomic step, as in leaseDue. A poll stores its
results this way, so one that ran past its lease cannot overwrite what
another poll stored since.
Parameters
Section titled “Parameters”messageId
Section titled “messageId”string
leaseUntil
Section titled “leaseUntil”Date
Partial<TrackingRecord>
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”DeliveryTrackingStore.patchLeased
releaseLeases()
Section titled “releaseLeases()”releaseLeases(
messageIds,leaseUntil,nextCheckAt):Promise<void>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:118
Hands back leases a poll did not finish: moves nextCheckAt to the
given time on those records whose nextCheckAt is still leaseUntil.
A record another poll has leased since is left alone. Without it,
DeliveryTrackingService lets such leases run out.
Parameters
Section titled “Parameters”messageIds
Section titled “messageIds”readonly string[]
leaseUntil
Section titled “leaseUntil”Date
nextCheckAt
Section titled “nextCheckAt”Date
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”DeliveryTrackingStore.releaseLeases
upsert()
Section titled “upsert()”upsert(
record):Promise<void>
Defined in: packages/messaging/src/delivery-tracking/stores/bun-sql.store.ts:90
Parameters
Section titled “Parameters”record
Section titled “record”Returns
Section titled “Returns”Promise<void>