Phase 1: chunk store, tile rendering pipeline, and Leaflet viewer
api: WS gateway with token auth (Postgres-backed servers table, seeded via `bun run seed`), column-granularity chunk store (hand-written SQL migrations, no drizzle-kit CLI — its config loader needs esbuild, which doesn't install cleanly here), dirty-chunk Redis stream producer with per-flush dedup, and a tile-serving route. worker: consumes the dirty-chunk stream via a proper consumer group, rasterizes each chunk's columns into a single-resolution top-down PNG (static pre-Flattening block-id palette), uploads to MinIO, and upserts the tile pointer. frontend: barebones Leaflet 2D viewer (CRS.Simple, one native zoom level) wired to /api/servers and /api/tiles. Object storage: tiles live in a dedicated `mcmapper-tiles` bucket on the existing shared MinIO instance (devstack-minio on octo-winsrv) instead of a per-stack container, via a scoped access key limited to that one bucket — see README's "Object storage" section. MINIO_SECRET_KEY is real and is deliberately not committed; docker-compose layers an untracked .env over .env.example for it. Full pipeline verified end-to-end against live containers: WS auth -> Postgres upsert -> deduped Redis dirty-chunk event -> worker rasterize -> MinIO upload -> tile fetch through the api route, including from the actual mod-side WS client (see MCMapper-Mod's matching commit).
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
CREATE TABLE IF NOT EXISTS "servers" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"token" text NOT NULL UNIQUE,
|
||||
"auth_mode" text NOT NULL DEFAULT 'offline',
|
||||
"created_at" timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "chunk_columns" (
|
||||
"server_id" uuid NOT NULL REFERENCES "servers"("id") ON DELETE CASCADE,
|
||||
"dimension" integer NOT NULL,
|
||||
"x" integer NOT NULL,
|
||||
"z" integer NOT NULL,
|
||||
"block_id" integer NOT NULL,
|
||||
"block_meta" integer NOT NULL,
|
||||
"height" smallint NOT NULL,
|
||||
"updated_at" timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY ("server_id", "dimension", "x", "z")
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "tile_pointers" (
|
||||
"server_id" uuid NOT NULL REFERENCES "servers"("id") ON DELETE CASCADE,
|
||||
"dimension" integer NOT NULL,
|
||||
"zoom" integer NOT NULL DEFAULT 0,
|
||||
"tile_x" integer NOT NULL,
|
||||
"tile_z" integer NOT NULL,
|
||||
"storage_key" text NOT NULL,
|
||||
"content_hash" text NOT NULL,
|
||||
"rendered_at" timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY ("server_id", "dimension", "zoom", "tile_x", "tile_z")
|
||||
);
|
||||
|
||||
-- Chunk-granularity lookup: a live delta touches individual columns, but the worker re-renders
|
||||
-- a whole chunk's 16x16 columns at once, keyed by floor(x/16), floor(z/16).
|
||||
CREATE INDEX IF NOT EXISTS "chunk_columns_chunk_idx" ON "chunk_columns" (
|
||||
"server_id", "dimension", (floor("x" / 16.0)), (floor("z" / 16.0))
|
||||
);
|
||||
Reference in New Issue
Block a user