decentralised sync engine

refactor: rename persisted state

serenity 7ae7189e 7c34ea9f

Changed files
+5 -3
src
+2 -2
src/lib/setup.ts
···
-
import { channelSessions } from "@/lib/state";
import type { AtUri, Did } from "@/lib/types/atproto";
import { systemsGmstnDevelopmentChannelRecordSchema } from "@/lib/types/lexicon/systems.gmstn.development.channel";
import {
···
if (!handshakeResult.ok) continue;
const sessionInfo = handshakeResult.data;
console.log("Handshake to", shardAtUri.rKey, "complete!");
-
channelSessions.set(shardAtUri, sessionInfo);
}
};
···
+
import { handshakeTokens, shardSessions } from "@/lib/state";
import type { AtUri, Did } from "@/lib/types/atproto";
import { systemsGmstnDevelopmentChannelRecordSchema } from "@/lib/types/lexicon/systems.gmstn.development.channel";
import {
···
if (!handshakeResult.ok) continue;
const sessionInfo = handshakeResult.data;
console.log("Handshake to", shardAtUri.rKey, "complete!");
+
handshakeTokens.set(shardAtUri, sessionInfo);
}
};
+3 -1
src/lib/state.ts
···
import type { AtUri } from "@/lib/types/atproto";
import type { SessionInfo } from "@/lib/types/handshake";
export const registrationState = {
registered: false,
···
return registrationState;
};
-
export const channelSessions = new Map<AtUri, SessionInfo>();
···
import type { AtUri } from "@/lib/types/atproto";
import type { SessionInfo } from "@/lib/types/handshake";
+
import type WebSocket from "ws";
export const registrationState = {
registered: false,
···
return registrationState;
};
+
export const handshakeTokens = new Map<AtUri, SessionInfo>();
+
export const shardSessions = new Map<SessionInfo, WebSocket>();