Implement authorized live event replay
This commit is contained in:
parent
4c93c25692
commit
06a7ac56b7
1 changed files with 2370 additions and 364 deletions
33
crates/remora-api/migrations/0001_live_event_history.sql
Normal file
33
crates/remora-api/migrations/0001_live_event_history.sql
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
CREATE TABLE live_event_history_state (
|
||||
singleton BOOLEAN PRIMARY KEY DEFAULT TRUE CHECK (singleton),
|
||||
floor_outbox_id BIGINT NOT NULL DEFAULT 0 CHECK (floor_outbox_id >= 0),
|
||||
progress_poll_not_before TIMESTAMPTZ NOT NULL DEFAULT '-infinity'
|
||||
);
|
||||
|
||||
INSERT INTO live_event_history_state (singleton) VALUES (TRUE);
|
||||
|
||||
CREATE TABLE live_progress_event_state (
|
||||
job_id TEXT PRIMARY KEY REFERENCES jobs (job_id),
|
||||
attempt_id TEXT NOT NULL,
|
||||
fence BIGINT NOT NULL CHECK (fence BETWEEN 1 AND 9007199254740991),
|
||||
progress_present BOOLEAN NOT NULL,
|
||||
completed_bytes BIGINT,
|
||||
total_bytes BIGINT,
|
||||
completed_members BIGINT,
|
||||
total_members BIGINT,
|
||||
updated_at TIMESTAMPTZ NOT NULL,
|
||||
CONSTRAINT live_progress_event_shape_check CHECK (
|
||||
(
|
||||
progress_present
|
||||
AND completed_bytes IS NOT NULL
|
||||
AND completed_members IS NOT NULL
|
||||
)
|
||||
OR (
|
||||
NOT progress_present
|
||||
AND completed_bytes IS NULL
|
||||
AND total_bytes IS NULL
|
||||
AND completed_members IS NULL
|
||||
AND total_members IS NULL
|
||||
)
|
||||
)
|
||||
);
|
||||
Loading…
Reference in a new issue