durability 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -12
- package/dist/{durability-alarms.d.ts → alarms/index.d.ts} +13 -5
- package/dist/{durability-alarms.js → alarms/index.js} +69 -55
- package/dist/alarms/migrations.d.ts +9 -0
- package/dist/alarms/migrations.js +133 -0
- package/dist/experimental.d.ts +10 -10
- package/dist/experimental.js +7 -7
- package/dist/{fanout.d.ts → fanout/index.d.ts} +13 -6
- package/dist/{fanout.js → fanout/index.js} +54 -46
- package/dist/fanout/migrations.d.ts +9 -0
- package/dist/fanout/migrations.js +181 -0
- package/dist/{stored-message.d.ts → fanout/stored-message.d.ts} +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.js +13 -8
- package/dist/{log.d.ts → log/index.d.ts} +15 -3
- package/dist/{log.js → log/index.js} +152 -124
- package/dist/log/migrations.d.ts +18 -0
- package/dist/log/migrations.js +297 -0
- package/dist/{memoize.d.ts → memoize/index.d.ts} +1 -1
- package/dist/{memoize.js → memoize/index.js} +14 -11
- package/dist/memoize/migrations.d.ts +10 -0
- package/dist/memoize/migrations.js +21 -0
- package/dist/migrations.d.ts +0 -111
- package/dist/migrations.js +0 -612
- package/dist/{durability.d.ts → operations/index.d.ts} +13 -5
- package/dist/{durability.js → operations/index.js} +59 -47
- package/dist/operations/migrations.d.ts +10 -0
- package/dist/operations/migrations.js +150 -0
- package/dist/{outbox.d.ts → outbox/index.d.ts} +4 -4
- package/dist/{outbox.js → outbox/index.js} +16 -60
- package/dist/outbox/migrations.d.ts +9 -0
- package/dist/outbox/migrations.js +43 -0
- package/dist/{routing-client.js → routing/client.js} +1 -1
- package/dist/{routing.d.ts → routing/index.d.ts} +3 -3
- package/dist/{routing.js → routing/index.js} +3 -3
- package/dist/{load.d.ts → routing/load.d.ts} +1 -1
- package/dist/{schedule.d.ts → schedule/index.d.ts} +16 -8
- package/dist/{schedule.js → schedule/index.js} +65 -49
- package/dist/schedule/migrations.d.ts +9 -0
- package/dist/schedule/migrations.js +118 -0
- package/dist/{scheduler.d.ts → scheduler/index.d.ts} +75 -25
- package/dist/{scheduler.js → scheduler/index.js} +300 -63
- package/dist/{semaphore-client.d.ts → semaphore/client.d.ts} +1 -1
- package/dist/{semaphore-client.js → semaphore/client.js} +2 -2
- package/dist/{semaphore.d.ts → semaphore/index.d.ts} +10 -10
- package/dist/{semaphore.js → semaphore/index.js} +7 -7
- package/dist/{semaphore-leases.d.ts → semaphore/leases.d.ts} +17 -6
- package/dist/{semaphore-leases.js → semaphore/leases.js} +28 -12
- package/dist/semaphore/migrations.d.ts +18 -0
- package/dist/semaphore/migrations.js +444 -0
- package/dist/{semaphore-protocol.d.ts → semaphore/protocol.d.ts} +16 -8
- package/dist/{semaphore-protocol.js → semaphore/protocol.js} +37 -14
- package/dist/{semaphore-queue-store.d.ts → semaphore/queue-store.d.ts} +12 -6
- package/dist/{semaphore-queue-store.js → semaphore/queue-store.js} +69 -61
- package/dist/{semaphore-queue.d.ts → semaphore/queue.d.ts} +15 -5
- package/dist/{semaphore-queue.js → semaphore/queue.js} +105 -46
- package/dist/{semaphore-server.d.ts → semaphore/server.d.ts} +12 -4
- package/dist/{semaphore-server.js → semaphore/server.js} +51 -24
- package/dist/{semaphore-store.d.ts → semaphore/store.d.ts} +8 -3
- package/dist/{semaphore-store.js → semaphore/store.js} +35 -33
- package/dist/{client.d.ts → socket/client.d.ts} +3 -3
- package/dist/{client.js → socket/client.js} +4 -4
- package/dist/{socket.d.ts → socket/index.d.ts} +15 -4
- package/dist/{socket.js → socket/index.js} +66 -20
- package/dist/socket/migrations.d.ts +9 -0
- package/dist/socket/migrations.js +57 -0
- package/dist/{socket-protocol.d.ts → socket/protocol.d.ts} +1 -1
- package/dist/storage.d.ts +4 -0
- package/dist/storage.js +13 -6
- package/dist/{topology-client.d.ts → topology/client.d.ts} +2 -2
- package/dist/{topology-client.js → topology/client.js} +3 -3
- package/dist/{topology.d.ts → topology/index.d.ts} +17 -7
- package/dist/{topology.js → topology/index.js} +92 -58
- package/dist/topology/migrations.d.ts +10 -0
- package/dist/topology/migrations.js +138 -0
- package/dist/{tracker.d.ts → tracker/index.d.ts} +3 -3
- package/dist/{tracker.js → tracker/index.js} +2 -2
- package/package.json +11 -11
- /package/dist/{stored-message.js → fanout/stored-message.js} +0 -0
- /package/dist/{routing-client.d.ts → routing/client.d.ts} +0 -0
- /package/dist/{load.js → routing/load.js} +0 -0
- /package/dist/{socket-protocol.js → socket/protocol.js} +0 -0
- /package/dist/{topology-snapshot.d.ts → topology/snapshot.d.ts} +0 -0
- /package/dist/{topology-snapshot.js → topology/snapshot.js} +0 -0
- /package/dist/{tracked-source.d.ts → tracker/source.d.ts} +0 -0
- /package/dist/{tracked-source.js → tracker/source.js} +0 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordered SQLite migrations for fanout manifests and deliveries. Applied
|
|
3
|
+
* automatically on construction.
|
|
4
|
+
*/
|
|
5
|
+
export const durabilityFanoutMigrations = [
|
|
6
|
+
{
|
|
7
|
+
name: 'durability_0005_create_fanout',
|
|
8
|
+
up: `
|
|
9
|
+
CREATE TABLE IF NOT EXISTS durability_fanout_messages (
|
|
10
|
+
key TEXT PRIMARY KEY,
|
|
11
|
+
id TEXT NOT NULL,
|
|
12
|
+
payload TEXT NOT NULL,
|
|
13
|
+
targets TEXT NOT NULL,
|
|
14
|
+
remaining INTEGER NOT NULL,
|
|
15
|
+
seq INTEGER NOT NULL,
|
|
16
|
+
created_at INTEGER NOT NULL,
|
|
17
|
+
generation_id TEXT NOT NULL
|
|
18
|
+
);
|
|
19
|
+
CREATE TABLE IF NOT EXISTS durability_fanout_deliveries (
|
|
20
|
+
id TEXT PRIMARY KEY,
|
|
21
|
+
message_key TEXT NOT NULL,
|
|
22
|
+
target_id TEXT NOT NULL,
|
|
23
|
+
seq INTEGER NOT NULL,
|
|
24
|
+
status TEXT NOT NULL CHECK (status IN ('pending')),
|
|
25
|
+
phase TEXT NOT NULL CHECK (phase IN ('delivery', 'dead_letter')),
|
|
26
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
27
|
+
next_attempt_at INTEGER NOT NULL,
|
|
28
|
+
last_error TEXT,
|
|
29
|
+
last_error_name TEXT,
|
|
30
|
+
created_at INTEGER NOT NULL,
|
|
31
|
+
generation_id TEXT NOT NULL,
|
|
32
|
+
dead_lettered_at INTEGER,
|
|
33
|
+
dead_letter_reason TEXT CHECK (dead_letter_reason IN ('explicit', 'exhausted'))
|
|
34
|
+
);
|
|
35
|
+
CREATE INDEX IF NOT EXISTS durability_fanout_deliveries_due_idx
|
|
36
|
+
ON durability_fanout_deliveries
|
|
37
|
+
(target_id, phase, status, attempt, seq, next_attempt_at);
|
|
38
|
+
CREATE INDEX IF NOT EXISTS durability_fanout_deliveries_pending_idx
|
|
39
|
+
ON durability_fanout_deliveries (phase, status, next_attempt_at);
|
|
40
|
+
CREATE INDEX IF NOT EXISTS durability_fanout_deliveries_created_idx
|
|
41
|
+
ON durability_fanout_deliveries (created_at);
|
|
42
|
+
CREATE TABLE IF NOT EXISTS durability_fanout_seq (
|
|
43
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
44
|
+
next_seq INTEGER NOT NULL
|
|
45
|
+
);
|
|
46
|
+
INSERT OR IGNORE INTO durability_fanout_seq (id, next_seq) VALUES (1, 0);
|
|
47
|
+
`,
|
|
48
|
+
down: `
|
|
49
|
+
DROP INDEX IF EXISTS durability_fanout_deliveries_due_idx;
|
|
50
|
+
DROP INDEX IF EXISTS durability_fanout_deliveries_pending_idx;
|
|
51
|
+
DROP INDEX IF EXISTS durability_fanout_deliveries_created_idx;
|
|
52
|
+
DROP TABLE IF EXISTS durability_fanout_deliveries;
|
|
53
|
+
DROP TABLE IF EXISTS durability_fanout_messages;
|
|
54
|
+
DROP TABLE IF EXISTS durability_fanout_seq;
|
|
55
|
+
`,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'durability_0017_fanout_channels',
|
|
59
|
+
up: `
|
|
60
|
+
ALTER TABLE durability_fanout_messages
|
|
61
|
+
RENAME TO durability_fanout_messages_before_channels;
|
|
62
|
+
CREATE TABLE durability_fanout_messages (
|
|
63
|
+
key TEXT NOT NULL,
|
|
64
|
+
id TEXT NOT NULL,
|
|
65
|
+
payload TEXT NOT NULL,
|
|
66
|
+
targets TEXT NOT NULL,
|
|
67
|
+
remaining INTEGER NOT NULL,
|
|
68
|
+
seq INTEGER NOT NULL,
|
|
69
|
+
created_at INTEGER NOT NULL,
|
|
70
|
+
generation_id TEXT NOT NULL,
|
|
71
|
+
channel TEXT NOT NULL DEFAULT 'default',
|
|
72
|
+
PRIMARY KEY (channel, key)
|
|
73
|
+
);
|
|
74
|
+
INSERT INTO durability_fanout_messages
|
|
75
|
+
(key, id, payload, targets, remaining, seq, created_at,
|
|
76
|
+
generation_id, channel)
|
|
77
|
+
SELECT key, id, payload, targets, remaining, seq, created_at,
|
|
78
|
+
generation_id, 'default'
|
|
79
|
+
FROM durability_fanout_messages_before_channels;
|
|
80
|
+
DROP TABLE durability_fanout_messages_before_channels;
|
|
81
|
+
|
|
82
|
+
ALTER TABLE durability_fanout_deliveries
|
|
83
|
+
RENAME TO durability_fanout_deliveries_before_channels;
|
|
84
|
+
CREATE TABLE durability_fanout_deliveries (
|
|
85
|
+
id TEXT NOT NULL,
|
|
86
|
+
message_key TEXT NOT NULL,
|
|
87
|
+
target_id TEXT NOT NULL,
|
|
88
|
+
seq INTEGER NOT NULL,
|
|
89
|
+
status TEXT NOT NULL CHECK (status IN ('pending')),
|
|
90
|
+
phase TEXT NOT NULL CHECK (phase IN ('delivery', 'dead_letter')),
|
|
91
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
92
|
+
next_attempt_at INTEGER NOT NULL,
|
|
93
|
+
last_error TEXT,
|
|
94
|
+
last_error_name TEXT,
|
|
95
|
+
created_at INTEGER NOT NULL,
|
|
96
|
+
generation_id TEXT NOT NULL,
|
|
97
|
+
dead_lettered_at INTEGER,
|
|
98
|
+
dead_letter_reason TEXT CHECK (dead_letter_reason IN ('explicit', 'exhausted')),
|
|
99
|
+
channel TEXT NOT NULL DEFAULT 'default',
|
|
100
|
+
PRIMARY KEY (channel, id)
|
|
101
|
+
);
|
|
102
|
+
INSERT INTO durability_fanout_deliveries
|
|
103
|
+
(id, message_key, target_id, seq, status, phase, attempt,
|
|
104
|
+
next_attempt_at, last_error, last_error_name, created_at,
|
|
105
|
+
generation_id, dead_lettered_at, dead_letter_reason, channel)
|
|
106
|
+
SELECT id, message_key, target_id, seq, status, phase, attempt,
|
|
107
|
+
next_attempt_at, last_error, last_error_name, created_at,
|
|
108
|
+
generation_id, dead_lettered_at, dead_letter_reason, 'default'
|
|
109
|
+
FROM durability_fanout_deliveries_before_channels;
|
|
110
|
+
DROP TABLE durability_fanout_deliveries_before_channels;
|
|
111
|
+
CREATE INDEX durability_fanout_deliveries_due_idx
|
|
112
|
+
ON durability_fanout_deliveries
|
|
113
|
+
(channel, target_id, phase, status, attempt, seq, next_attempt_at);
|
|
114
|
+
CREATE INDEX durability_fanout_deliveries_pending_idx
|
|
115
|
+
ON durability_fanout_deliveries (phase, status, next_attempt_at);
|
|
116
|
+
CREATE INDEX durability_fanout_deliveries_created_idx
|
|
117
|
+
ON durability_fanout_deliveries (created_at);
|
|
118
|
+
CREATE INDEX durability_fanout_deliveries_channel_pending_idx
|
|
119
|
+
ON durability_fanout_deliveries (channel, status, next_attempt_at);
|
|
120
|
+
`,
|
|
121
|
+
down: `
|
|
122
|
+
CREATE TABLE durability_fanout_channel_guard (
|
|
123
|
+
channel TEXT CONSTRAINT cannot_downgrade_nondefault_channels CHECK (channel = 'default')
|
|
124
|
+
);
|
|
125
|
+
INSERT INTO durability_fanout_channel_guard
|
|
126
|
+
SELECT DISTINCT channel FROM durability_fanout_messages
|
|
127
|
+
UNION SELECT DISTINCT channel FROM durability_fanout_deliveries;
|
|
128
|
+
DROP TABLE durability_fanout_channel_guard;
|
|
129
|
+
|
|
130
|
+
ALTER TABLE durability_fanout_messages
|
|
131
|
+
RENAME TO durability_fanout_messages_with_channels;
|
|
132
|
+
CREATE TABLE durability_fanout_messages (
|
|
133
|
+
key TEXT PRIMARY KEY,
|
|
134
|
+
id TEXT NOT NULL,
|
|
135
|
+
payload TEXT NOT NULL,
|
|
136
|
+
targets TEXT NOT NULL,
|
|
137
|
+
remaining INTEGER NOT NULL,
|
|
138
|
+
seq INTEGER NOT NULL,
|
|
139
|
+
created_at INTEGER NOT NULL,
|
|
140
|
+
generation_id TEXT NOT NULL
|
|
141
|
+
);
|
|
142
|
+
INSERT INTO durability_fanout_messages
|
|
143
|
+
SELECT key, id, payload, targets, remaining, seq, created_at,
|
|
144
|
+
generation_id
|
|
145
|
+
FROM durability_fanout_messages_with_channels;
|
|
146
|
+
DROP TABLE durability_fanout_messages_with_channels;
|
|
147
|
+
|
|
148
|
+
ALTER TABLE durability_fanout_deliveries
|
|
149
|
+
RENAME TO durability_fanout_deliveries_with_channels;
|
|
150
|
+
CREATE TABLE durability_fanout_deliveries (
|
|
151
|
+
id TEXT PRIMARY KEY,
|
|
152
|
+
message_key TEXT NOT NULL,
|
|
153
|
+
target_id TEXT NOT NULL,
|
|
154
|
+
seq INTEGER NOT NULL,
|
|
155
|
+
status TEXT NOT NULL CHECK (status IN ('pending')),
|
|
156
|
+
phase TEXT NOT NULL CHECK (phase IN ('delivery', 'dead_letter')),
|
|
157
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
158
|
+
next_attempt_at INTEGER NOT NULL,
|
|
159
|
+
last_error TEXT,
|
|
160
|
+
last_error_name TEXT,
|
|
161
|
+
created_at INTEGER NOT NULL,
|
|
162
|
+
generation_id TEXT NOT NULL,
|
|
163
|
+
dead_lettered_at INTEGER,
|
|
164
|
+
dead_letter_reason TEXT CHECK (dead_letter_reason IN ('explicit', 'exhausted'))
|
|
165
|
+
);
|
|
166
|
+
INSERT INTO durability_fanout_deliveries
|
|
167
|
+
SELECT id, message_key, target_id, seq, status, phase, attempt,
|
|
168
|
+
next_attempt_at, last_error, last_error_name, created_at,
|
|
169
|
+
generation_id, dead_lettered_at, dead_letter_reason
|
|
170
|
+
FROM durability_fanout_deliveries_with_channels;
|
|
171
|
+
DROP TABLE durability_fanout_deliveries_with_channels;
|
|
172
|
+
CREATE INDEX durability_fanout_deliveries_due_idx
|
|
173
|
+
ON durability_fanout_deliveries
|
|
174
|
+
(target_id, phase, status, attempt, seq, next_attempt_at);
|
|
175
|
+
CREATE INDEX durability_fanout_deliveries_pending_idx
|
|
176
|
+
ON durability_fanout_deliveries (phase, status, next_attempt_at);
|
|
177
|
+
CREATE INDEX durability_fanout_deliveries_created_idx
|
|
178
|
+
ON durability_fanout_deliveries (created_at);
|
|
179
|
+
`,
|
|
180
|
+
},
|
|
181
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
export { Durability, type DurabilityConfig, type DurabilityConstructor, type DurabilityOptions, type DurableCall, type DurableHandler, type DurableOperation, type DurableOperationResult, type DurabilityOperationEvent, type HandlerMap, } from './
|
|
2
|
-
export { DurabilityAlarms, type DurabilityAlarmsConfig, type DurabilityAlarmsConstructor, type DurabilityAlarmsOptions, type DurabilityAlarmEvent, type DurableAlarmHandler, type DurableAlarmInfo, type DurableNamedAlarm, } from './
|
|
3
|
-
export { maxMemoBytes, maxMemosPerRecord, type DurableMemoize, } from './memoize.js';
|
|
4
|
-
export { DurabilityFanout, type DurabilityFanoutConfig, type DurabilityFanoutEvent, type DurabilityFanoutMessage, type FanoutInput, type FanoutTarget, type FanoutEnqueueOptions, } from './fanout.js';
|
|
5
|
-
export { DurabilityLog, maxLogBytes, type DurabilityLogConfig, type LogAppendInput, type LogColdStorage, type LogLease, type LogLeaseOptions, type LogPage, type LogReadOptions, type LogRecord, type LogRetention, type LogSegment, type LogBounds, } from './log.js';
|
|
6
|
-
export { RoutingLoad, type EnqueueResult, type LoadSnapshot, type ProcessingLoad, } from './load.js';
|
|
7
|
-
export type { MessageWrite, StoredMessage } from './stored-message.js';
|
|
8
|
-
export { DurabilityScheduler, type AlarmRetryInfo, type DurabilityContext, type DurabilitySchedulerConfig, type DurabilitySchedulerOptions, type SchedulerAttachment, } from './scheduler.js';
|
|
1
|
+
export { Durability, type DurabilityConfig, type DurabilityConstructor, type DurabilityOptions, type DurableCall, type DurableHandler, type DurableOperation, type DurableOperationResult, type DurabilityOperationEvent, type HandlerMap, } from './operations/index.js';
|
|
2
|
+
export { DurabilityAlarms, type DurabilityAlarmsConfig, type DurabilityAlarmsConstructor, type DurabilityAlarmsOptions, type DurabilityAlarmEvent, type DurableAlarmHandler, type DurableAlarmInfo, type DurableNamedAlarm, } from './alarms/index.js';
|
|
3
|
+
export { maxMemoBytes, maxMemosPerRecord, type DurableMemoize, } from './memoize/index.js';
|
|
4
|
+
export { DurabilityFanout, type DurabilityFanoutConfig, type DurabilityFanoutEvent, type DurabilityFanoutMessage, type FanoutInput, type FanoutTarget, type FanoutEnqueueOptions, } from './fanout/index.js';
|
|
5
|
+
export { DurabilityLog, maxLogBytes, type DurabilityLogConfig, type LogAppendInput, type LogColdStorage, type LogLease, type LogLeaseOptions, type LogPage, type LogReadOptions, type LogRecord, type LogRetention, type LogSegment, type LogBounds, } from './log/index.js';
|
|
6
|
+
export { RoutingLoad, type EnqueueResult, type LoadSnapshot, type ProcessingLoad, } from './routing/load.js';
|
|
7
|
+
export type { MessageWrite, StoredMessage } from './fanout/stored-message.js';
|
|
8
|
+
export { DurabilityScheduler, type AlarmRetryInfo, type DurabilityContext, type DurabilitySchedulerConfig, type DurabilitySchedulerOptions, type SchedulerAttachment, } from './scheduler/index.js';
|
|
9
9
|
export { DuplicateDurableCallError, DuplicateDurablePayloadError, DurableAlarmTimeoutError, DurableAttemptsExhaustedError, DurableAttemptTimeoutError, DurableResultSerializationError, DurableRetryPolicyError, DurableMemoLimitError, DurableMemoSerializationError, NonRetryableError, FanoutTimeoutError, FanoutSettlementError, FanoutEnqueueError, LogAppendError, LogLeaseError, LogTruncatedError, RoutingError, } from './errors.js';
|
|
10
10
|
export type { DurabilityLifecycleEvent, LifecycleHook } from './lifecycle.js';
|
|
11
|
-
export { durabilityNamedAlarmMigrations
|
|
11
|
+
export { durabilityNamedAlarmMigrations } from './alarms/migrations.js';
|
|
12
|
+
export { durabilityOperationMigrations } from './operations/migrations.js';
|
|
13
|
+
export { durabilityFanoutMigrations } from './fanout/migrations.js';
|
|
14
|
+
export { durabilityLogLeaseMigrations, durabilityLogMigrations, } from './log/migrations.js';
|
|
15
|
+
export { durabilityMemoMigrations } from './memoize/migrations.js';
|
|
16
|
+
export { migrate, type DurabilityMigrationResult, type MigrateOptions, type MigrationCapability, } from './migrations.js';
|
|
12
17
|
export type { DurableMigrations } from '@durability/storage';
|
|
13
18
|
export type { DurabilityAlarmMethodOptions, DurabilityMethodOptions, DurabilityRetryOptions, } from './policy.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
export { Durability, } from './
|
|
2
|
-
export { DurabilityAlarms, } from './
|
|
3
|
-
export { maxMemoBytes, maxMemosPerRecord, } from './memoize.js';
|
|
4
|
-
export { DurabilityFanout, } from './fanout.js';
|
|
5
|
-
export { DurabilityLog, maxLogBytes, } from './log.js';
|
|
6
|
-
export { RoutingLoad, } from './load.js';
|
|
7
|
-
export { DurabilityScheduler, } from './scheduler.js';
|
|
1
|
+
export { Durability, } from './operations/index.js';
|
|
2
|
+
export { DurabilityAlarms, } from './alarms/index.js';
|
|
3
|
+
export { maxMemoBytes, maxMemosPerRecord, } from './memoize/index.js';
|
|
4
|
+
export { DurabilityFanout, } from './fanout/index.js';
|
|
5
|
+
export { DurabilityLog, maxLogBytes, } from './log/index.js';
|
|
6
|
+
export { RoutingLoad, } from './routing/load.js';
|
|
7
|
+
export { DurabilityScheduler, } from './scheduler/index.js';
|
|
8
8
|
export { DuplicateDurableCallError, DuplicateDurablePayloadError, DurableAlarmTimeoutError, DurableAttemptsExhaustedError, DurableAttemptTimeoutError, DurableResultSerializationError, DurableRetryPolicyError, DurableMemoLimitError, DurableMemoSerializationError, NonRetryableError, FanoutTimeoutError, FanoutSettlementError, FanoutEnqueueError, LogAppendError, LogLeaseError, LogTruncatedError, RoutingError, } from './errors.js';
|
|
9
|
-
export { durabilityNamedAlarmMigrations
|
|
9
|
+
export { durabilityNamedAlarmMigrations } from './alarms/migrations.js';
|
|
10
|
+
export { durabilityOperationMigrations } from './operations/migrations.js';
|
|
11
|
+
export { durabilityFanoutMigrations } from './fanout/migrations.js';
|
|
12
|
+
export { durabilityLogLeaseMigrations, durabilityLogMigrations, } from './log/migrations.js';
|
|
13
|
+
export { durabilityMemoMigrations } from './memoize/migrations.js';
|
|
14
|
+
export { migrate, } from './migrations.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '
|
|
3
|
-
import { type SchedulerAttachment } from '
|
|
2
|
+
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '../routing/load.js';
|
|
3
|
+
import { type SchedulerAttachment } from '../scheduler/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* One in-flight or settled range of offsets held by a consumer. A range is
|
|
6
6
|
* redelivered under a fresh `batch_id`, so an ack from a previous holder is
|
|
@@ -60,6 +60,12 @@ export type LogReadOptions = {
|
|
|
60
60
|
};
|
|
61
61
|
/** One contiguous run of records leaving the object, oldest first. */
|
|
62
62
|
export type LogSegment<Body = unknown> = {
|
|
63
|
+
/**
|
|
64
|
+
* The log always supplies its channel. Optional for legacy callers that
|
|
65
|
+
* construct segments themselves; omitted means `default`. Shared external
|
|
66
|
+
* storage must include the channel in the location it writes to.
|
|
67
|
+
*/
|
|
68
|
+
channel?: string;
|
|
63
69
|
firstOffset: number;
|
|
64
70
|
lastOffset: number;
|
|
65
71
|
records: LogRecord<Body>[];
|
|
@@ -109,6 +115,12 @@ export type LogRetention = {
|
|
|
109
115
|
maxBytes?: number;
|
|
110
116
|
};
|
|
111
117
|
export type DurabilityLogConfig<Body = unknown> = SchedulerAttachment & {
|
|
118
|
+
/**
|
|
119
|
+
* Partitions records, offsets, cursors, cold segments, and leases, so
|
|
120
|
+
* several logs share one object without seeing each other. Defaults to
|
|
121
|
+
* `default`; one instance per channel may attach to a scheduler.
|
|
122
|
+
*/
|
|
123
|
+
channel?: string;
|
|
112
124
|
/** Without retention the log grows until the object's storage limit. */
|
|
113
125
|
retention?: LogRetention;
|
|
114
126
|
cold?: LogColdStorage<Body>;
|
|
@@ -135,7 +147,7 @@ export declare const maxLogBytes = 1073741824;
|
|
|
135
147
|
export declare class DurabilityLog<Body = unknown> {
|
|
136
148
|
#private;
|
|
137
149
|
constructor(config: DurabilityLogConfig<Body>);
|
|
138
|
-
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("
|
|
150
|
+
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("../migrations.js").DurabilityMigrationResult;
|
|
139
151
|
/**
|
|
140
152
|
* Appends the batch atomically. Definite input rejections return
|
|
141
153
|
* success:false; storage and commit uncertainty throws, so a caller never
|