mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Merge branch 'dev' into onboarding-auth-page-preview-interactivity-fix
This commit is contained in:
commit
b40271e50d
@ -579,6 +579,7 @@ function createTablesStateFromMigrations(migrations: readonly BulldozerDatabaseM
|
||||
}
|
||||
|
||||
export type BulldozerDatabase = {
|
||||
getDebugInfo(): any,
|
||||
listTables(): BulldozerDatabaseTableDescriptor[],
|
||||
debugPiledriverSnapshot?(): Promise<PiledriverDatabaseDebugSnapshot>,
|
||||
debugLowLevelSnapshot?(): Promise<LowLevelDatabaseDebugSnapshot>,
|
||||
@ -641,6 +642,18 @@ export function declareBulldozerDatabase(piledriverDatabase: PiledriverDatabase,
|
||||
};
|
||||
|
||||
return {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "bulldozer",
|
||||
constructorArguments: { piledriverDatabase, options },
|
||||
piledriverDatabase,
|
||||
rootKey,
|
||||
getRoot,
|
||||
setRoot,
|
||||
tablesState,
|
||||
currentOperation,
|
||||
};
|
||||
},
|
||||
listTables: () => Object.entries(tablesState.tables).map(([tableId, tableState]) => ({
|
||||
tableId,
|
||||
inputTableIds: { ...tableState.inputTableIds },
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
export type DatabaseSeq = (readonly (string | number)[] & { __brand: "hexclave-low-level-kv-store-seq" });
|
||||
|
||||
export type Database = {
|
||||
getDebugInfo(): any,
|
||||
/**
|
||||
* Returns a promise that resolves once it is guaranteed that queries made from this database client will see the
|
||||
* given seq.
|
||||
|
||||
@ -127,8 +127,15 @@ export function declareInMemoryLowLevelDatabase(dbId: string): LowLevelDatabase
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "in-memory",
|
||||
constructorArguments: { dbId },
|
||||
inMemoryLowLevelKvStores,
|
||||
debugEntriesByStoreId,
|
||||
};
|
||||
},
|
||||
declareKvDump(dumpId) {
|
||||
return declareInMemoryLowLevelKvStoreOrDump("dump", JSON.stringify([dbId, dumpId]));
|
||||
},
|
||||
|
||||
@ -38,6 +38,16 @@ function createSlowSetDatabase() {
|
||||
},
|
||||
};
|
||||
const db: LowLevelDatabase = {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "slow-set-test",
|
||||
releaseSets,
|
||||
setCallCount,
|
||||
committed,
|
||||
seqToPromise,
|
||||
initialSeq,
|
||||
};
|
||||
},
|
||||
declareKvStore: () => store,
|
||||
declareKvDump: () => {
|
||||
throw new Error("not implemented");
|
||||
|
||||
@ -243,6 +243,23 @@ export function declareInstantAvailabilityLowLevelDatabase(wrapped: LowLevelData
|
||||
};
|
||||
|
||||
return {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "instant-availability",
|
||||
constructorArguments: { wrapped, options },
|
||||
wrapped,
|
||||
dbId,
|
||||
maxPendingSeqRecords,
|
||||
initialSeq,
|
||||
seqRecords,
|
||||
createdSeqRecords,
|
||||
underlyingAvailableSeqRecords,
|
||||
pendingSeqRecords,
|
||||
currentWriteGateOperation,
|
||||
pendingSeqRecordsChanged,
|
||||
cacheMaps,
|
||||
};
|
||||
},
|
||||
declareKvStore(id) {
|
||||
return declareStoreOrDump(wrapped.declareKvStore(id) as LowLevelKvStore & LowLevelKvDump);
|
||||
},
|
||||
|
||||
@ -243,6 +243,21 @@ export function declareLmdbLowLevelDatabase(options: { path: string, dbId?: stri
|
||||
};
|
||||
|
||||
return {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "lmdb",
|
||||
constructorArguments: options,
|
||||
dbId,
|
||||
simulateReadMissDelayMs,
|
||||
root,
|
||||
meta,
|
||||
currentVersion,
|
||||
debugEntriesByStoreId,
|
||||
seqToAvailability,
|
||||
seqToDurability,
|
||||
initialSeq,
|
||||
};
|
||||
},
|
||||
declareKvDump(dumpId) {
|
||||
return declareLmdbLowLevelKvStoreOrDump("dump", dumpId);
|
||||
},
|
||||
|
||||
@ -287,6 +287,20 @@ export function declarePiledriverDatabase(lowLevelDb: LowLevelDatabase, options:
|
||||
};
|
||||
|
||||
return {
|
||||
getDebugInfo() {
|
||||
return {
|
||||
backend: "piledriver",
|
||||
constructorArguments: { lowLevelDb, options },
|
||||
lowLevelDb,
|
||||
rootStore,
|
||||
heapDump,
|
||||
heapObjectsByObject,
|
||||
heapObjectsByHeapKeyBase64,
|
||||
heapObjectsByHeapKeyFinalizer,
|
||||
heapKeysAndSeqByHeapObjects,
|
||||
heapReadCacheDisabled: options.disableHeapReadCache === true,
|
||||
};
|
||||
},
|
||||
async getRootObject(key): Promise<{ object: PiledriverObject, seq: DatabaseSeq }> {
|
||||
return await traceSpan("bulldozer-js.piledriver.getRootObject", async () => {
|
||||
const { buffer, seq: rootSeq } = await rootStore.get(key);
|
||||
|
||||
@ -76,8 +76,9 @@ const bulldozerDb = declareBulldozerDatabase(
|
||||
}),
|
||||
{ migrations: schema.migrations },
|
||||
);
|
||||
await traceSpan("bulldozer-js.applyRemainingMigrations", async () => await bulldozerDb.applyRemainingMigrations());
|
||||
(globalThis as any).bulldozerDb = bulldozerDb;
|
||||
console.log(`Stored bulldozerDb in globalThis for pid ${process.pid}. Run \`kill -USR1 ${process.pid} && node inspect 127.0.0.1:9229\` and then \`exec("globalThis.bulldozerDb")\` to inspect it.`);
|
||||
await traceSpan("bulldozer-js.applyRemainingMigrations", async () => await bulldozerDb.applyRemainingMigrations());
|
||||
|
||||
function jsonResponse(body: unknown, init?: ResponseInit) {
|
||||
return new Response(JSON.stringify(body), {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user