querysub 0.682.0 → 0.683.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.682.0",
3
+ "version": "0.683.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -297,7 +297,7 @@ export async function runArchiveMover(config: {
297
297
  console.log(" ");
298
298
  }
299
299
 
300
- const splitValuesBelowLimit = measureWrap(function splitValuesBelowLimit(config: {
300
+ export const splitValuesBelowLimit = measureWrap(function splitValuesBelowLimit(config: {
301
301
  values: PathValue[];
302
302
  maxFileValueCount: number;
303
303
  maxFileByteCount: number;
@@ -2,7 +2,7 @@ import "../inject";
2
2
 
3
3
  import { logErrors } from "../errors";
4
4
  import { PathValueArchives, pathValueArchives } from "../0-path-value-core/pathValueArchives";
5
- import { ARCHIVE_FLUSH_LIMIT, ARCHIVE_STABLE_THRESHOLD, PathValue } from "../0-path-value-core/pathValueCore";
5
+ import { ARCHIVE_FLUSH_LIMIT, ARCHIVE_STABLE_THRESHOLD, FILE_SIZE_LIMIT, FILE_VALUE_COUNT_LIMIT, PathValue } from "../0-path-value-core/pathValueCore";
6
6
  import { runInfinitePollCallAtStart } from "socket-function/src/batching";
7
7
  import { measureBlock } from "socket-function/src/profiling/measure";
8
8
  import { pathValueSerializer } from "../-h-path-value-serialize/PathValueSerializer";
@@ -14,6 +14,7 @@ import { magenta } from "socket-function/src/formatting/logColors";
14
14
  import { PathRouter } from "../0-path-value-core/PathRouter";
15
15
  import { disablePathAuditer } from "../diagnostics/pathAuditerCallback";
16
16
  import { getOurAuthoritySpec } from "../0-path-value-core/PathRouterServerAuthoritySpec";
17
+ import { splitValuesBelowLimit } from "../2-proxy/archiveMoveHarness";
17
18
  import yargs from "yargs";
18
19
 
19
20
  let yargObj = isNodeTrue() && yargs(process.argv)
@@ -101,18 +102,23 @@ async function runGenesisJoinIteration(config?: { force?: boolean }) {
101
102
 
102
103
  let targets = await PathRouter.getPathIdentifierTargets(allCombinedValues, authoritySpec);
103
104
  for (let [target, values] of targets) {
104
-
105
- let dataObj = await pathValueArchives.encodeValuePaths(values, {
106
- pathOverrides: {
107
- sourceType: "join",
108
- },
109
- });
110
- if (!dataObj) continue;
111
- let newFileName = target + "/" + dataObj?.file;
112
- transaction.createFiles.push({
113
- file: newFileName,
114
- data: dataObj.data,
105
+ let split = splitValuesBelowLimit({
106
+ values,
107
+ maxFileValueCount: FILE_VALUE_COUNT_LIMIT,
108
+ maxFileByteCount: FILE_SIZE_LIMIT,
115
109
  });
110
+ for (let splitValues of split) {
111
+ let dataObj = await pathValueArchives.encodeValuePaths(splitValues.values, {
112
+ pathOverrides: {
113
+ sourceType: "join",
114
+ },
115
+ });
116
+ if (!dataObj) continue;
117
+ transaction.createFiles.push({
118
+ file: target + "/" + dataObj.file,
119
+ data: dataObj.data,
120
+ });
121
+ }
116
122
  }
117
123
 
118
124
  console.log(magenta(`Joining ${formatNumber(usedFiles.length)} => ${transaction.createFiles.length} files with ${formatNumber(allCombinedValues.length)} values in ${formatNumber(totalSize)} bytes. Original count: ${formatNumber(originalCount)}, under path count: ${formatNumber(underPathCount)}, within time range count: ${formatNumber(withinTimeRangeCount)}`));