mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
update some naming conventions
This commit is contained in:
@@ -5,7 +5,7 @@ export type Env = SharedHonoEnv & {
|
||||
// Per-player presence (the room instance they're currently in). Written by
|
||||
// matchmake/goto, read by the heartbeat, cleared on login — mirrors the
|
||||
// reference server's HeartbeatDB.
|
||||
MATCH_PRESENCE: KVNamespace
|
||||
RECFLARE_MATCH_PRESENCE: KVNamespace
|
||||
// Shared rooms DB (owned by the `rooms` worker). Read-only here to resolve a
|
||||
// room's real scene/subroom when matchmaking into it.
|
||||
DB: D1Database
|
||||
|
||||
@@ -98,14 +98,14 @@ const presenceKey = (id: number) => `presence:${id}`
|
||||
|
||||
/** Persist the player's presence (room instance + status), refreshing the TTL. */
|
||||
async function setPresence(c: Context<App>, id: number, presence: Presence): Promise<void> {
|
||||
await c.env.MATCH_PRESENCE.put(presenceKey(id), JSON.stringify(presence), {
|
||||
await c.env.RECFLARE_MATCH_PRESENCE.put(presenceKey(id), JSON.stringify(presence), {
|
||||
expirationTtl: PRESENCE_TTL,
|
||||
})
|
||||
}
|
||||
|
||||
/** Read the player's stored presence, or null when they aren't in a room. */
|
||||
async function getPresence(c: Context<App>, id: number): Promise<Presence | null> {
|
||||
return c.env.MATCH_PRESENCE.get<Presence>(presenceKey(id), 'json')
|
||||
return c.env.RECFLARE_MATCH_PRESENCE.get<Presence>(presenceKey(id), 'json')
|
||||
}
|
||||
|
||||
/** Store the room instance the player just matchmade into, preserving status. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Read helpers for the shared `rec-rooms` D1 database. The schema, migrations,
|
||||
* Read helpers for the shared `recflare` D1 database. The schema, migrations,
|
||||
* and seed are owned by the `rooms` worker (apps/rooms/src/rooms-db.ts +
|
||||
* migrations); this worker binds the same database read-only to resolve a room's
|
||||
* real scene/subroom when building a matchmake instance. Keep these queries in
|
||||
|
||||
@@ -12,7 +12,7 @@ declare module 'cloudflare:test' {
|
||||
|
||||
const ORIGIN = 'https://example.com'
|
||||
|
||||
// Matchmaking into a room resolves its real scene from the shared rec-rooms D1.
|
||||
// Matchmaking into a room resolves its real scene from the shared recflare D1.
|
||||
// Seed the schema + a couple of rooms (matching the rooms worker's migration).
|
||||
const RECCENTER_SCENE = 'cbad71af-0831-44d8-b8ef-69edafa841f6'
|
||||
const TEST_ROOMS = [
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
"compatibility_date": "2025-09-20",
|
||||
"compatibility_flags": ["nodejs_compat"],
|
||||
// Per-player presence store (room instance the player is currently in).
|
||||
// Create with `wrangler kv namespace create MATCH_PRESENCE` and set the id.
|
||||
// Create with `wrangler kv namespace create RECFLARE_MATCH_PRESENCE` and set the id.
|
||||
"kv_namespaces": [
|
||||
{
|
||||
"binding": "MATCH_PRESENCE",
|
||||
"binding": "RECFLARE_MATCH_PRESENCE",
|
||||
"id": "9f53f04b7dd244658d59f515a14748b6"
|
||||
}
|
||||
],
|
||||
// Shared rooms DB (created + migrated by the `rooms` worker; bound read-only here).
|
||||
// Shared `recflare` DB (bound read-only here). The "local" placeholder is replaced
|
||||
// with the real id from RECFLARE_D1 (see .env) at deploy time.
|
||||
"d1_databases": [
|
||||
{
|
||||
"binding": "DB",
|
||||
"database_name": "rec-rooms",
|
||||
"database_id": "d44083e1-5bfe-4467-aa9a-f13c5c2496d5"
|
||||
"database_name": "recflare",
|
||||
"database_id": "local"
|
||||
}
|
||||
],
|
||||
"logpush": false,
|
||||
|
||||
Reference in New Issue
Block a user