decentralised sync engine
1import type { AtUri } from "@/lib/types/atproto";
2import type { ShardSessionInfo } from "@/lib/types/handshake";
3import type WebSocket from "ws";
4
5export const registrationState = {
6 registered: false,
7};
8export const setRegistrationState = (newState: boolean) => {
9 console.log("setting registration state to", newState);
10 const isRegistered = newState;
11 if (isRegistered) console.log("shard was registered at", new Date());
12 registrationState.registered = newState;
13};
14export const getRegistrationState = () => {
15 return registrationState;
16};
17
18export const handshakeTokens = new Map<AtUri, ShardSessionInfo>();
19export const shardSessions = new Map<ShardSessionInfo, WebSocket>();