feat: enforce tiered storage reservations
This commit is contained in:
@@ -79,6 +79,10 @@ CREATE TABLE commands (
|
||||
retention_status INTEGER NOT NULL DEFAULT 1 CHECK(retention_status BETWEEN 1 AND 3),
|
||||
last_event_seq INTEGER NOT NULL DEFAULT 0 CHECK(last_event_seq >= 0),
|
||||
retained_compressed_bytes INTEGER NOT NULL DEFAULT 0 CHECK(retained_compressed_bytes >= 0),
|
||||
output_charged_bytes INTEGER NOT NULL DEFAULT 0 CHECK(output_charged_bytes >= 0),
|
||||
charged_bytes INTEGER NOT NULL DEFAULT 0 CHECK(charged_bytes >= 0),
|
||||
closeout_remaining_bytes INTEGER NOT NULL DEFAULT 65536 CHECK(closeout_remaining_bytes >= 0),
|
||||
charge_version INTEGER NOT NULL DEFAULT 1 CHECK(charge_version = 1),
|
||||
output_truncated INTEGER NOT NULL DEFAULT 0 CHECK(output_truncated IN (0,1)),
|
||||
output_incomplete INTEGER NOT NULL DEFAULT 0 CHECK(output_incomplete IN (0,1)),
|
||||
immutable_request_sha256 BLOB NOT NULL CHECK(length(immutable_request_sha256) = 32),
|
||||
@@ -171,4 +175,9 @@ CREATE TABLE storage_incidents (
|
||||
CHECK((state = 1 AND resolved_at IS NULL) OR (state IN (2,3) AND resolved_at IS NOT NULL))
|
||||
) STRICT;
|
||||
CREATE UNIQUE INDEX one_open_incident_per_scope_kind ON storage_incidents(scope, scope_key, kind) WHERE state = 1;
|
||||
CREATE TABLE storage_counters (
|
||||
singleton INTEGER PRIMARY KEY CHECK(singleton = 1), command_charged_bytes INTEGER NOT NULL CHECK(command_charged_bytes >= 0),
|
||||
charge_version INTEGER NOT NULL CHECK(charge_version = 1)
|
||||
) STRICT;
|
||||
INSERT INTO storage_counters(singleton, command_charged_bytes, charge_version) VALUES (1, 0, 1);
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user