feat(go): implement current Node backend features

This commit is contained in:
Thomas Durieux committed 2026-11-14 14:12:47 +00:00
1 parent 566171342c
commit c201847b83
84 files changed
+8921 -384

No files matched your search

+3 -3
View File
@@ -1,7 +1,7 @@
-- Generated from src/core/blob-cache.ts by backend/contracts/blob-index.cjs.
CREATE TABLE IF NOT EXISTS aliases(key TEXT PRIMARY KEY,digest TEXT REFERENCES blobs(digest) ON DELETE CASCADE);
CREATE TABLE IF NOT EXISTS blobs(digest TEXT PRIMARY KEY,file TEXT,size INTEGER,stored INTEGER,encoding TEXT,accessed INTEGER,allocated INTEGER);
CREATE TABLE IF NOT EXISTS decisions(key TEXT PRIMARY KEY,digest TEXT,changed INTEGER,accessed INTEGER,expires INTEGER);
CREATE TABLE IF NOT EXISTS decisions(key TEXT PRIMARY KEY,digest TEXT,changed INTEGER,accessed INTEGER,expires INTEGER, isText INTEGER);
CREATE TABLE IF NOT EXISTS fills(key TEXT PRIMARY KEY,token TEXT,expires INTEGER,reserved INTEGER);
CREATE TABLE IF NOT EXISTS history(key TEXT PRIMARY KEY,seen INTEGER,evicted INTEGER);
CREATE TABLE IF NOT EXISTS maintenance(id INTEGER PRIMARY KEY,nextScan INTEGER);
@@ -24,13 +24,13 @@ CREATE TRIGGER IF NOT EXISTS summary_aliases_insert AFTER INSERT ON aliases BEGI
CREATE TRIGGER IF NOT EXISTS summary_blobs_delete AFTER DELETE ON blobs BEGIN UPDATE summary SET blobs=blobs-1,originalBytes=originalBytes-OLD.size,storedBytes=storedBytes-OLD.stored,allocatedBytes=allocatedBytes-OLD.allocated WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_blobs_insert AFTER INSERT ON blobs BEGIN UPDATE summary SET blobs=blobs+1,originalBytes=originalBytes+NEW.size,storedBytes=storedBytes+NEW.stored,allocatedBytes=allocatedBytes+NEW.allocated WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_blobs_update AFTER UPDATE OF size,stored,allocated ON blobs
BEGIN UPDATE summary SET originalBytes=originalBytes-OLD.size+NEW.size,storedBytes=storedBytes-OLD.stored+NEW.stored,allocatedBytes=allocatedBytes-OLD.allocated+NEW.allocated WHERE id=1; END;
BEGIN UPDATE summary SET originalBytes=originalBytes-OLD.size+NEW.size,storedBytes=storedBytes-OLD.stored+NEW.stored,allocatedBytes=allocatedBytes-OLD.allocated+NEW.allocated WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_decisions_delete AFTER DELETE ON decisions BEGIN UPDATE summary SET decisions=decisions-1 WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_decisions_insert AFTER INSERT ON decisions BEGIN UPDATE summary SET decisions=decisions+1 WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_fills_delete AFTER DELETE ON fills BEGIN UPDATE summary SET reservedBytes=reservedBytes-OLD.reserved WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_fills_insert AFTER INSERT ON fills BEGIN UPDATE summary SET reservedBytes=reservedBytes+NEW.reserved WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_fills_update AFTER UPDATE OF reserved ON fills
BEGIN UPDATE summary SET reservedBytes=reservedBytes-OLD.reserved+NEW.reserved WHERE id=1; END;
BEGIN UPDATE summary SET reservedBytes=reservedBytes-OLD.reserved+NEW.reserved WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_history_delete AFTER DELETE ON history BEGIN UPDATE summary SET history=history-1 WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_history_insert AFTER INSERT ON history BEGIN UPDATE summary SET history=history+1 WHERE id=1; END;
CREATE TRIGGER IF NOT EXISTS summary_readers_delete AFTER DELETE ON readers BEGIN UPDATE summary SET activeReaders=activeReaders-1 WHERE id=1; END;