querysub 0.403.0 → 0.405.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursorrules +2 -0
- package/bin/audit-imports.js +4 -0
- package/bin/join.js +1 -1
- package/package.json +7 -4
- package/spec.txt +77 -0
- package/src/-a-archives/archiveCache.ts +9 -4
- package/src/-a-archives/archivesBackBlaze.ts +1039 -1039
- package/src/-a-auth/certs.ts +0 -12
- package/src/-c-identity/IdentityController.ts +12 -3
- package/src/-f-node-discovery/NodeDiscovery.ts +32 -26
- package/src/-g-core-values/NodeCapabilities.ts +12 -2
- package/src/0-path-value-core/AuthorityLookup.ts +239 -0
- package/src/0-path-value-core/LockWatcher2.ts +150 -0
- package/src/0-path-value-core/PathRouter.ts +543 -0
- package/src/0-path-value-core/PathRouterRouteOverride.ts +72 -0
- package/src/0-path-value-core/PathRouterServerAuthoritySpec.tsx +73 -0
- package/src/0-path-value-core/PathValueCommitter.ts +222 -488
- package/src/0-path-value-core/PathValueController.ts +277 -239
- package/src/0-path-value-core/PathWatcher.ts +534 -0
- package/src/0-path-value-core/ShardPrefixes.ts +31 -0
- package/src/0-path-value-core/ValidStateComputer.ts +303 -0
- package/src/0-path-value-core/archiveLocks/ArchiveLocks.ts +1 -1
- package/src/0-path-value-core/archiveLocks/ArchiveLocks2.ts +80 -44
- package/src/0-path-value-core/archiveLocks/archiveSnapshots.ts +13 -16
- package/src/0-path-value-core/auditLogs.ts +2 -0
- package/src/0-path-value-core/hackedPackedPathParentFiltering.ts +97 -0
- package/src/0-path-value-core/pathValueArchives.ts +491 -492
- package/src/0-path-value-core/pathValueCore.ts +195 -1496
- package/src/0-path-value-core/startupAuthority.ts +74 -0
- package/src/1-path-client/RemoteWatcher.ts +90 -82
- package/src/1-path-client/pathValueClientWatcher.ts +808 -815
- package/src/2-proxy/PathValueProxyWatcher.ts +10 -8
- package/src/2-proxy/archiveMoveHarness.ts +182 -214
- package/src/2-proxy/garbageCollection.ts +9 -8
- package/src/2-proxy/schema2.ts +21 -1
- package/src/3-path-functions/PathFunctionHelpers.ts +206 -180
- package/src/3-path-functions/PathFunctionRunner.ts +943 -766
- package/src/3-path-functions/PathFunctionRunnerMain.ts +5 -3
- package/src/3-path-functions/pathFunctionLoader.ts +2 -2
- package/src/3-path-functions/syncSchema.ts +596 -521
- package/src/4-deploy/deployFunctions.ts +19 -4
- package/src/4-deploy/deployGetFunctionsInner.ts +8 -2
- package/src/4-deploy/deployMain.ts +51 -68
- package/src/4-deploy/edgeClientWatcher.tsx +6 -1
- package/src/4-deploy/edgeNodes.ts +2 -2
- package/src/4-dom/qreact.tsx +2 -4
- package/src/4-dom/qreactTest.tsx +7 -13
- package/src/4-querysub/Querysub.ts +21 -8
- package/src/4-querysub/QuerysubController.ts +45 -29
- package/src/4-querysub/permissions.ts +2 -2
- package/src/4-querysub/querysubPrediction.ts +80 -70
- package/src/4-querysub/schemaHelpers.ts +5 -1
- package/src/5-diagnostics/GenericFormat.tsx +14 -9
- package/src/archiveapps/archiveGCEntry.tsx +9 -2
- package/src/archiveapps/archiveJoinEntry.ts +96 -84
- package/src/bits.ts +19 -0
- package/src/config.ts +21 -3
- package/src/config2.ts +23 -48
- package/src/deployManager/components/DeployPage.tsx +7 -3
- package/src/deployManager/machineSchema.ts +4 -1
- package/src/diagnostics/ActionsHistory.ts +3 -8
- package/src/diagnostics/AuditLogPage.tsx +2 -3
- package/src/diagnostics/FunctionCallInfo.tsx +141 -0
- package/src/diagnostics/FunctionCallInfoState.ts +162 -0
- package/src/diagnostics/MachineThreadInfo.tsx +1 -1
- package/src/diagnostics/NodeViewer.tsx +37 -48
- package/src/diagnostics/SyncTestPage.tsx +241 -0
- package/src/diagnostics/auditImportViolations.ts +185 -0
- package/src/diagnostics/listenOnDebugger.ts +3 -3
- package/src/diagnostics/logs/IndexedLogs/BufferUnitSet.ts +10 -4
- package/src/diagnostics/logs/IndexedLogs/IndexedLogs.ts +2 -2
- package/src/diagnostics/logs/IndexedLogs/LogViewer3.tsx +24 -22
- package/src/diagnostics/logs/IndexedLogs/moveIndexLogsToPublic.ts +1 -1
- package/src/diagnostics/logs/diskLogGlobalContext.ts +1 -0
- package/src/diagnostics/logs/errorNotifications2/logWatcher.ts +1 -3
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleEntryEditor.tsx +34 -16
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleEntryReadMode.tsx +4 -6
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleInstanceTableView.tsx +36 -5
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCyclePage.tsx +19 -5
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleRenderer.tsx +15 -7
- package/src/diagnostics/logs/lifeCycleAnalysis/NestedLifeCycleInfo.tsx +28 -106
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycleMatching.ts +2 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycleMisc.ts +0 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycleSearch.tsx +18 -7
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycles.tsx +3 -0
- package/src/diagnostics/managementPages.tsx +10 -3
- package/src/diagnostics/misc-pages/ArchiveViewer.tsx +20 -26
- package/src/diagnostics/misc-pages/ArchiveViewerTree.tsx +6 -4
- package/src/diagnostics/misc-pages/ComponentSyncStats.tsx +2 -2
- package/src/diagnostics/misc-pages/LocalWatchViewer.tsx +7 -9
- package/src/diagnostics/misc-pages/SnapshotViewer.tsx +23 -12
- package/src/diagnostics/misc-pages/archiveViewerShared.tsx +1 -1
- package/src/diagnostics/pathAuditer.ts +486 -0
- package/src/diagnostics/pathAuditerCallback.ts +20 -0
- package/src/diagnostics/watchdog.ts +8 -1
- package/src/library-components/URLParam.ts +1 -1
- package/src/misc/hash.ts +1 -0
- package/src/path.ts +21 -7
- package/src/server.ts +54 -47
- package/src/user-implementation/loginEmail.tsx +1 -1
- package/tempnotes.txt +65 -0
- package/test.ts +298 -97
- package/src/0-path-value-core/NodePathAuthorities.ts +0 -1057
- package/src/0-path-value-core/PathController.ts +0 -1
- package/src/5-diagnostics/diskValueAudit.ts +0 -218
- package/src/5-diagnostics/memoryValueAudit.ts +0 -438
- package/src/archiveapps/archiveMergeEntry.tsx +0 -48
- package/src/archiveapps/lockTest.ts +0 -127
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { measureWrap } from "socket-function/src/profiling/measure";
|
|
2
|
+
import { getPathDepth, getPathIndexAssert, hack_getPackedPathSuffix, hack_setPackedPathSuffix, hack_stripPackedPath } from "../path";
|
|
3
|
+
import { PathRouter } from "./PathRouter";
|
|
4
|
+
import { cache } from "socket-function/src/caching";
|
|
5
|
+
import { authorityLookup } from "./AuthorityLookup";
|
|
6
|
+
|
|
7
|
+
// NOTE: This code has been moved into PathRouter
|
|
8
|
+
// /** Returns a number between 0 (inclusive) and 1 (exclusive)
|
|
9
|
+
// * - See matchesParentRangeFilter, matchesParentRangeFilterPart, and filterChildPaths.
|
|
10
|
+
// */
|
|
11
|
+
// export function __getRoutingHash(key: string): number {
|
|
12
|
+
// // Using fastHash is about twice as fast as sha256 (although that might be due to the buffer allocation?)
|
|
13
|
+
// let hash = fastHash(key);
|
|
14
|
+
// return hash % (1000 * 1000 * 1000) / (1000 * 1000 * 1000);
|
|
15
|
+
// // let hash = sha256(key);
|
|
16
|
+
// // return getBufferFraction(Buffer.from(hash, "hex"));
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
let isPrefix = cache((path: string) => {
|
|
20
|
+
let spec = authorityLookup.getOurSpec();
|
|
21
|
+
if (!spec) return false;
|
|
22
|
+
for (let prefix of spec.prefixes) {
|
|
23
|
+
if (path.startsWith(prefix.prefix)) return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// NOTE: Assumes fullPath is already a child of parentPath, and only checks for hash
|
|
29
|
+
export function matchesParentRangeFilter(config: {
|
|
30
|
+
parentPath: string;
|
|
31
|
+
fullPath: string;
|
|
32
|
+
packedPath: string;
|
|
33
|
+
}) {
|
|
34
|
+
if (config.packedPath === config.packedPath) return true;
|
|
35
|
+
let filter = decodeParentFilter(config.packedPath);
|
|
36
|
+
if (!filter) return true;
|
|
37
|
+
if (filter.useFullPathHash) {
|
|
38
|
+
let route = PathRouter.getSingleKeyRoute(config.fullPath);
|
|
39
|
+
return filter.start <= route && route < filter.end;
|
|
40
|
+
}
|
|
41
|
+
let route = PathRouter.getRouteChildKey(config.fullPath);
|
|
42
|
+
return filter.start <= route && route < filter.end;
|
|
43
|
+
}
|
|
44
|
+
// export function matchesParentRangeFilterPart(config: {
|
|
45
|
+
// part: string;
|
|
46
|
+
// start: number;
|
|
47
|
+
// end: number;
|
|
48
|
+
// }) {
|
|
49
|
+
// if (config.start === 0 && config.end === 1) return true;
|
|
50
|
+
// let hash = __getRoutingHash(config.part);
|
|
51
|
+
// return config.start <= hash && hash < config.end;
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
export const filterChildPathsBase = measureWrap(
|
|
55
|
+
function filterChildPathsBase(parentPath: string, packedSuffix: string, paths: Set<string>): Set<string> {
|
|
56
|
+
let [startFractionStr, endFractionStr, useFullPathHash] = packedSuffix.split("|");
|
|
57
|
+
let startFraction = Number(startFractionStr);
|
|
58
|
+
let endFraction = Number(endFractionStr);
|
|
59
|
+
|
|
60
|
+
let depth = getPathDepth(parentPath);
|
|
61
|
+
|
|
62
|
+
let filtered = new Set<string>();
|
|
63
|
+
for (let path of paths) {
|
|
64
|
+
if (useFullPathHash) {
|
|
65
|
+
let route = PathRouter.getSingleKeyRoute(path);
|
|
66
|
+
if (startFraction <= route && route < endFraction) {
|
|
67
|
+
filtered.add(path);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
let key = getPathIndexAssert(path, depth);
|
|
71
|
+
let hash = PathRouter.getSingleKeyRoute(key);
|
|
72
|
+
if (startFraction <= hash && hash < endFraction) {
|
|
73
|
+
filtered.add(path);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//console.log(`Filtered ${paths.size} paths to ${filtered.size} paths`);
|
|
78
|
+
return filtered;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
export function encodeParentFilter(config: {
|
|
83
|
+
path: string;
|
|
84
|
+
startFraction: number;
|
|
85
|
+
endFraction: number;
|
|
86
|
+
useFullPathHash?: boolean;
|
|
87
|
+
}) {
|
|
88
|
+
return hack_setPackedPathSuffix(config.path, `${config.startFraction}|${config.endFraction}|${config.useFullPathHash ? "F" : ""}`);
|
|
89
|
+
}
|
|
90
|
+
export function decodeParentFilter(path: string): { path: string; start: number, end: number, useFullPathHash?: boolean } | undefined {
|
|
91
|
+
let packedSuffix = hack_getPackedPathSuffix(path);
|
|
92
|
+
if (!packedSuffix) return undefined;
|
|
93
|
+
let [startStr, endStr, useFullPathHash] = packedSuffix.split("|");
|
|
94
|
+
let unpackedPath = hack_stripPackedPath(path);
|
|
95
|
+
return { path: unpackedPath, start: Number(startStr), end: Number(endStr), useFullPathHash: !!useFullPathHash };
|
|
96
|
+
|
|
97
|
+
}
|