@nervur.org/genome 0.37.5 → 0.37.6

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.
Files changed (56) hide show
  1. package/contracts/carriers/contract.js +1 -1
  2. package/docs/changelog.md +13 -16
  3. package/genome/brain/brain.js +1 -1
  4. package/genome/brain/far.d.ts +0 -1
  5. package/genome/brain/far.js +2 -4
  6. package/genome/brain/genome.js +1 -1
  7. package/genome/brain/index.d.ts +1 -1
  8. package/genome/brain/index.js +1 -1
  9. package/genome/brain/kit.js +2 -2
  10. package/genome/brain/life.d.ts +1 -1
  11. package/genome/brain/life.js +6 -4
  12. package/genome/brain/limits.d.ts +1 -0
  13. package/genome/brain/limits.js +2 -0
  14. package/genome/brain/methods.js +1 -1
  15. package/genome/brain/notes.d.ts +2 -1
  16. package/genome/brain/notes.js +2 -2
  17. package/genome/brain/space.d.ts +3 -2
  18. package/genome/brain/space.js +24 -3
  19. package/genome/brain/version.js +1 -1
  20. package/genome/cache/cache.d.ts +3 -3
  21. package/genome/cache/cache.js +9 -4
  22. package/genome/cache/index.d.ts +1 -1
  23. package/genome/cache/index.js +1 -1
  24. package/genome/cache/spaces.d.ts +8 -1
  25. package/genome/cache/spaces.js +54 -3
  26. package/genome/carry/carry.js +4 -1
  27. package/genome/carry/gear.js +3 -3
  28. package/genome/carry/held.js +1 -1
  29. package/genome/carry/organ.js +1 -1
  30. package/genome/faculties/ear/blueprint.js +1 -1
  31. package/genome/faculties/ear/text.js +1 -1
  32. package/genome/faculties/library/blueprint.js +1 -1
  33. package/genome/faculties/library/text.js +1 -1
  34. package/genome/faculties/mouth/blueprint.js +1 -1
  35. package/genome/faculties/mouth/text.js +1 -1
  36. package/genome/faculties/scheduler/blueprint.js +1 -1
  37. package/genome/faculties/scheduler/text.js +1 -1
  38. package/genome/log/open.js +5 -3
  39. package/genome/log/record.d.ts +1 -0
  40. package/genome/log/record.js +19 -5
  41. package/genome/log/store.d.ts +1 -0
  42. package/genome/log/store.js +35 -6
  43. package/genome/organism/body.js +2 -2
  44. package/genome/organism/made.js +2 -1
  45. package/genome/pure/frozen.js +15 -7
  46. package/genome/store/reading.js +19 -6
  47. package/genome/store/store.js +4 -4
  48. package/kit/core/foundation.js +2 -2
  49. package/kit/presence/screen-half.js +1 -1
  50. package/package.json +1 -1
  51. package/quo/ward/link.d.ts +0 -1
  52. package/quo/ward/link.js +0 -2
  53. package/seams/carriers/carriers.js +2 -2
  54. package/seams/entry/configuration.js +1 -1
  55. package/standard/blueprint/blueprint.js +1 -1
  56. package/standard/version.js +1 -1
@@ -172,7 +172,7 @@ const hearsWard = async (rig ) => {
172
172
 
173
173
 
174
174
 
175
-
175
+
176
176
 
177
177
 
178
178
 
package/docs/changelog.md CHANGED
@@ -1,22 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## 0.37.5
3
+ ## 0.37.6
4
4
 
5
- Pushes and pulls are reliable again. Since 0.37.4, a repo lobe that checked on a job in the very second the job ended
6
- took it for lost, its end still on its way, so a push or a pull that had in fact landed was reported failed: the push
7
- had moved the far `main`, yet the next push, finding nothing left to send, said it landed while the far repo still
8
- answered its old head. A check now never guesses: the jailer keeps the end it last told each repo lobe, and the lobe
9
- takes that end, whole, from its letter or from its check, whichever comes first. Only a job the jailer no longer holds
10
- ends as lost.
5
+ A lobe's space now counts all it costs the disk. The letters a lobe posts, waiting or dead, weigh against the lobe that
6
+ posted them, not the one they wait for, so a lobe held to its space can no longer grow the disk by posting. Each
7
+ relation weighs the real bytes of its note beside a fixed share for its other rows, so raising or lifting the note's
8
+ bound no longer makes a relation weigh more than it holds.
11
9
 
12
- A repo now always answers the head its `main` stands at: each scan that ends whole keeps the head it read. On
13
- updating, a repo whose head stood behind its `main` answers it again within a minute, after the scan the update owes;
14
- nothing is lost, and nothing needs pushing again.
10
+ The store's log is read at the page size its own header names, so a store of another page size is told whole, torn or
11
+ damaged as surely as one of the default.
15
12
 
16
- A pull or a push whose far side hangs no longer holds its repo until the time it may stand still passes:
17
- `nervur lobe <repo> stop` ends it at once, failed, saying it was stopped, its owner's or its asker's to ask. One that
18
- lands already is refused, since it ends landed.
13
+ A store of a host with no pages counts the frames its data key seals: past half the most one key may safely seal, it
14
+ asks the rekey its next start runs, and short of that most it stops rather than seal one more.
19
15
 
20
- An MCP call no longer waits without end on a node busy with other asks: it answers within a minute, at most, an error
21
- naming the node it reached and saying that what it asked may still take effect, so a model reads that node before it
22
- asks again. Work longer than that is a job, answered at once, as before.
16
+ A move's last piece carries only the relation of the owner who took the pieces, however many relations the owners
17
+ hold, so it stays small.
18
+
19
+ The message of a store last run below the genome's floor now says to update it to the floor first.
@@ -44,7 +44,7 @@ import { makeSweep } from './old.js';
44
44
 
45
45
 
46
46
 
47
-
47
+
48
48
 
49
49
 
50
50
 
@@ -50,4 +50,3 @@ export declare const ended: (serving: Serving, args: Fields, done: Done, joined?
50
50
  export declare const endedWhenLanded: (serving: Serving, args: Fields, done: Done, joined?: Batch) => void;
51
51
  export declare const anchorDropped: (serving: Serving, lobe: string, far: string, done: Done, joined: Batch) => void;
52
52
  export declare const serveEar: (serving: Serving, method: string, args: Fields, done: Done) => void;
53
- export declare const isEar: (asker: string) => boolean;
@@ -66,11 +66,11 @@ import { askedBy } from './blueprint.js';
66
66
 
67
67
 
68
68
 
69
-
69
+
70
70
 
71
71
 
72
72
 
73
-
73
+
74
74
 
75
75
 
76
76
 
@@ -326,5 +326,3 @@ export const serveEar = (serving , method , args , done
326
326
  );
327
327
  ended(serving, args, done);
328
328
  };
329
-
330
- export const isEar = (asker ) => asker === EAR;
@@ -39,7 +39,7 @@ export const keepGenome = (cells ) => {
39
39
  };
40
40
  if (isLater(FLOOR, kept))
41
41
  return {
42
- why: `the store was last booted by genome ${kept}, below ${FLOOR}, the oldest this genome ${GENOME_VERSION} carries forward: move it to ${FLOOR} first`,
42
+ why: `the store was last booted by genome ${kept}, below ${FLOOR}, the oldest this genome ${GENOME_VERSION} carries forward: update it to ${FLOOR} first`,
43
43
  };
44
44
  if (kept !== GENOME_VERSION) putRow(cells, ROW, GENOME_VERSION, 'brain');
45
45
  return null;
@@ -22,7 +22,7 @@ export { capsIn, carriersIn, LIFTED, limitIn, worded } from './limits.js';
22
22
  export { placeOrgan, type Halves } from './organ.js';
23
23
  export { everyOrgan, putOrgan, type Added } from './organs.js';
24
24
  export { makeReflex, type Level, type Reflex } from './reflex.js';
25
- export { countedRow, spaceOver, type Space } from './space.js';
25
+ export { chargedRows, countedRow, spaceOver, type Space } from './space.js';
26
26
  export { roadOf, type Road } from './road.js';
27
27
  export { assetsFor } from './assets.js';
28
28
  export { givenOf, putGiven } from './given.js';
@@ -23,7 +23,7 @@ export { capsIn, carriersIn, LIFTED, limitIn, worded } from './limits.js';
23
23
  export { placeOrgan, } from './organ.js';
24
24
  export { everyOrgan, putOrgan, } from './organs.js';
25
25
  export { makeReflex, } from './reflex.js';
26
- export { countedRow, spaceOver, } from './space.js';
26
+ export { chargedRows, countedRow, spaceOver, } from './space.js';
27
27
  export { roadOf, } from './road.js';
28
28
  export { assetsFor } from './assets.js';
29
29
  export { givenOf, putGiven } from './given.js';
@@ -60,11 +60,11 @@
60
60
 
61
61
 
62
62
 
63
-
63
+
64
64
 
65
65
 
66
66
 
67
-
67
+
68
68
 
69
69
 
70
70
 
@@ -20,5 +20,5 @@ type Life = {
20
20
  };
21
21
  export declare const backup: (kit: Life, fields: Fields, settled: (answer: Answer) => void) => void;
22
22
  export declare const move: (kit: Kit, asker: string, fields: Fields, { done, settled }: Reply) => void;
23
- export declare const backupPiece: (kit: Kit, fields: Fields, reply: Reply) => void;
23
+ export declare const backupPiece: (kit: Kit, asker: string, fields: Fields, reply: Reply) => void;
24
24
  export {};
@@ -159,8 +159,10 @@ export const move = (kit , asker , fields , { done, settled }
159
159
  });
160
160
  };
161
161
 
162
- const lastPiece = (kit , leaving , bytes , { done, joined } ) => {
163
- const heirs = everyRelation(kit.gear.cells()).flatMap(({ heir, node }) => (node === BRAIN ? [heir] : []));
162
+ const lastPiece = (kit , asker , leaving , bytes , { done, joined } ) => {
163
+ const heirs = everyRelation(kit.gear.cells()).flatMap(({ heir, node, far }) =>
164
+ node === BRAIN && far === asker ? [heir] : [],
165
+ );
164
166
  const ending = kit.gear.backupEnd({ bytes, heirs, joined });
165
167
  void ending.then(
166
168
  (ended) => {
@@ -185,7 +187,7 @@ const lastPiece = (kit , leaving , bytes , { done, joined }
185
187
  );
186
188
  };
187
189
 
188
- export const backupPiece = (kit , fields , reply ) => {
190
+ export const backupPiece = (kit , asker , fields , reply ) => {
189
191
  const asked = { mark: textAt(fields, 'mark'), at: numberAt(fields, 'at'), length: numberAt(fields, 'length') };
190
192
  const found = kit.leaving.current;
191
193
  const leaving = found !== null && asked.mark === found.mark ? found : null;
@@ -194,7 +196,7 @@ export const backupPiece = (kit , fields , reply ) => {
194
196
  return kit.gear.leave(NOT_SEALED);
195
197
  }
196
198
  if (leaving !== null && leaving.bytes !== null && asked.at === leaving.bytes)
197
- return lastPiece(kit, leaving, leaving.bytes, reply);
199
+ return lastPiece(kit, asker, leaving, leaving.bytes, reply);
198
200
  void kit.gear.backupPiece(asked).then((taken) => {
199
201
  if ('why' in taken) return reply.settled(error('refused', taken.why));
200
202
  const { piece, made } = taken;
@@ -3,6 +3,7 @@ import { type Answer, type Caps, type Data, type Fields } from '#standard';
3
3
  import { type Cells } from '#cage';
4
4
  import type { Change } from './changes.js';
5
5
  export declare const LIFTED: number;
6
+ export declare const NOTE_LIMIT = 4096;
6
7
  export declare const limitIn: (cells: Cells, name: string, lobe?: string | null) => number | undefined;
7
8
  export declare const capsIn: (cells: Cells, lobe: string) => Caps;
8
9
  export declare const lobeWordOf: (cells: Cells, name: string, lobe: string) => Answer;
@@ -9,6 +9,8 @@ import { nodeAt } from '../map/index.js';
9
9
 
10
10
  export const LIFTED = Number.MAX_SAFE_INTEGER;
11
11
 
12
+ export const NOTE_LIMIT = 4096;
13
+
12
14
  const TREE_CAPS = ['nodes', 'depth', 'key', 'text', 'sounds'];
13
15
 
14
16
  const OF_A_LOBE = new Set([
@@ -177,7 +177,7 @@ const HANDLERS = {
177
177
  joined,
178
178
  ),
179
179
  move: (kit, asker, fields, reply) => move(kit, asker, fields, reply),
180
- backupPiece: (kit, _asker, fields, reply) => backupPiece(kit, fields, reply),
180
+ backupPiece: (kit, asker, fields, reply) => backupPiece(kit, asker, fields, reply),
181
181
  upgrade: (kit, _asker, fields, { settled }) => upgrade(kit.gear, fields, settled),
182
182
  state: (kit, asker, fields, { settled, binds }) => {
183
183
  const cursor = typeof fields['cursor'] === 'string' ? fields['cursor'] : undefined;
@@ -1,7 +1,8 @@
1
1
  import { type Data, type Fields } from '#standard';
2
2
  import type { Cells } from '#cage';
3
3
  import type { Change } from './changes.js';
4
- export declare const NOTE_LIMIT = 4096;
4
+ import { NOTE_LIMIT } from './limits.js';
5
+ export { NOTE_LIMIT };
5
6
  export declare const noteIn: (args: Fields) => Data;
6
7
  export declare const noteRefusal: (cells: Cells, lobe: string, note: Data) => string | null;
7
8
  export declare const saysRefusal: (cells: Cells, lobe: string, says: Data) => string | null;
@@ -6,10 +6,10 @@ import { mapOf } from '../map/index.js';
6
6
  import { textAt } from './fields.js';
7
7
  import { putGrant } from './grants.js';
8
8
  import { heldDirection, setNote } from './holds.js';
9
- import { limitIn } from './limits.js';
9
+ import { limitIn, NOTE_LIMIT } from './limits.js';
10
10
  import { BRAIN } from '../ids/index.js';
11
11
 
12
- export const NOTE_LIMIT = 4096;
12
+ export { NOTE_LIMIT };
13
13
 
14
14
  export const noteIn = (args ) => args['note'] ?? null;
15
15
 
@@ -1,6 +1,7 @@
1
- import type { Cache } from '../cache/index.js';
1
+ import type { Cache, Charged } from '../cache/index.js';
2
2
  import { type CellKey, type Batch, type Reader } from '#cage';
3
- export declare const RELATION = 8192;
3
+ export declare const RELATION = 4096;
4
+ export declare const chargedRows: Charged;
4
5
  export declare const countedRow: ([partition, row, node]: CellKey) => CellKey | null;
5
6
  export type SpaceGear = {
6
7
  readonly spaces: Cache['spaces'];
@@ -1,10 +1,29 @@
1
1
  // SPDX-License-Identifier: FSL-1.1-ALv2
2
-
2
+ import { dataOfBytes, isFields } from '#standard';
3
+
3
4
  import { weightOver, } from '#cage';
4
5
  import { BRAIN } from '../ids/index.js';
5
6
  import { LIFTED } from './limits.js';
6
7
 
7
- export const RELATION = 8192;
8
+ export const RELATION = 4096;
9
+
10
+ export const chargedRows = {
11
+ prefixes: [
12
+ [BRAIN, 'holds'],
13
+ [BRAIN, 'grant'],
14
+ [BRAIN, 'letter'],
15
+ [BRAIN, 'dead'],
16
+ ],
17
+ of: (key, value) => {
18
+ const [, row, first, second] = key;
19
+ if (row === 'holds') return typeof first === 'string' ? first : null;
20
+ if (row === 'grant') return typeof second === 'string' ? second : null;
21
+ const read = dataOfBytes(value);
22
+ if ('why' in read || !isFields(read.data)) return null;
23
+ const { asker } = read.data;
24
+ return typeof asker === 'string' ? asker : null;
25
+ },
26
+ };
8
27
 
9
28
  const HOLDS = 'holds';
10
29
  const INVITED = 'invited';
@@ -44,7 +63,9 @@ const WAITING =
44
63
  export const spaceOver = (gear ) => {
45
64
  const { spaces, reader, limit, room, core } = gear;
46
65
  const held = (node ) =>
47
- spaces.bytes(node) + (spaces.rows([BRAIN, HOLDS, node]) + spaces.rows([BRAIN, GRANTED, node])) * RELATION;
66
+ spaces.bytes(node) +
67
+ spaces.charged(node) +
68
+ (spaces.rows([BRAIN, HOLDS, node]) + spaces.rows([BRAIN, GRANTED, node])) * RELATION;
48
69
  const limitOf = (node ) => (core(node) ? LIFTED : (limit('space', node) ?? room()));
49
70
  const growth = (writes ) =>
50
71
  writes.reduce(
@@ -65,7 +65,7 @@ const refused = (why ) => ({
65
65
 
66
66
 
67
67
 
68
-
68
+
69
69
 
70
70
 
71
71
 
@@ -1,7 +1,7 @@
1
1
  import { type Committed, type Store } from '../store/index.js';
2
2
  import { type Batch, type Reader } from '#cage';
3
3
  import { type Snapshot } from './snapshot.js';
4
- import { type Counted, type Spaces } from './spaces.js';
4
+ import { type Charged, type Counted, type Spaces } from './spaces.js';
5
5
  export type Cache = Reader & {
6
6
  commit(batches: readonly Batch[]): Promise<Committed | {
7
7
  readonly why: string;
@@ -11,10 +11,10 @@ export type Cache = Reader & {
11
11
  limit(bytes: number): void;
12
12
  held(): number;
13
13
  kept(): number;
14
- readonly spaces: Pick<Spaces, 'bytes' | 'rows'>;
14
+ readonly spaces: Pick<Spaces, 'bytes' | 'rows' | 'charged'>;
15
15
  };
16
16
  export type Watch = {
17
17
  needs(key: Uint8Array): boolean;
18
18
  shown(batches: readonly Batch[], olders: ReadonlyMap<string, Uint8Array | null>): void;
19
19
  };
20
- export declare const makeCache: (store: Store, bytes: number, watch?: Watch | null, counted?: Counted) => Cache;
20
+ export declare const makeCache: (store: Store, bytes: number, watch?: Watch | null, counted?: Counted, charged?: Charged) => Cache;
@@ -3,7 +3,7 @@ import { hex } from '#standard';
3
3
  import { Damaged, once, unlessDamaged, } from '../store/index.js';
4
4
  import { countOver, nthOver, weightOver, } from '#cage';
5
5
  import { makeHistory, } from './snapshot.js';
6
- import { spacesOver, } from './spaces.js';
6
+ import { NONE_CHARGED, spacesOver, } from './spaces.js';
7
7
 
8
8
 
9
9
 
@@ -19,7 +19,7 @@ import { spacesOver, } from './spaces.js';
19
19
 
20
20
 
21
21
 
22
-
22
+
23
23
 
24
24
 
25
25
 
@@ -172,6 +172,7 @@ export const makeCache = (
172
172
  bytes ,
173
173
  watch = null,
174
174
  counted = () => null,
175
+ charged = NONE_CHARGED,
175
176
  ) => {
176
177
  checkLimit(bytes);
177
178
  const heat = { keys: new Map(), ceiling: bytes, held: 0 };
@@ -182,7 +183,7 @@ export const makeCache = (
182
183
  count: (from, to) => countOver(store, from, to),
183
184
  nth: (from, to, index) => nthOver(store, from, to, index),
184
185
  };
185
- const spaces = spacesOver(store, counted);
186
+ const spaces = spacesOver(store, counted, charged);
186
187
  const parts = { store, watch, heat, history, spaces, reader, stopped: false, flight: null };
187
188
  let line = Promise.resolve();
188
189
  return {
@@ -208,6 +209,10 @@ export const makeCache = (
208
209
  },
209
210
  held: () => heat.held,
210
211
  kept: () => history.count(),
211
- spaces: { bytes: (partition) => spaces.bytes(partition), rows: (prefix) => spaces.rows(prefix) },
212
+ spaces: {
213
+ bytes: (partition) => spaces.bytes(partition),
214
+ rows: (prefix) => spaces.rows(prefix),
215
+ charged: (node) => spaces.charged(node),
216
+ },
212
217
  };
213
218
  };
@@ -1,3 +1,3 @@
1
1
  export { makeCache, type Cache, type Watch } from './cache.js';
2
2
  export type { Snapshot } from './snapshot.js';
3
- export type { Spaces } from './spaces.js';
3
+ export type { Charged, Spaces } from './spaces.js';
@@ -1,4 +1,4 @@
1
1
  // SPDX-License-Identifier: FSL-1.1-ALv2
2
2
  export { makeCache, } from './cache.js';
3
3
 
4
-
4
+
@@ -1,14 +1,21 @@
1
1
  import { type CellKey, type Batch, type Reader } from '#cage';
2
2
  export type Counted = (key: CellKey) => CellKey | null;
3
+ export type Charged = {
4
+ readonly prefixes: readonly CellKey[];
5
+ of(key: CellKey, value: Uint8Array): string | null;
6
+ };
7
+ export declare const NONE_CHARGED: Charged;
3
8
  export type Moved = {
4
9
  readonly bytes: ReadonlyMap<string, number>;
5
10
  readonly rows: ReadonlyMap<string, number>;
11
+ readonly charged: ReadonlyMap<string, number>;
6
12
  };
7
13
  export type Spaces = {
8
14
  bytes(partition: string): number;
9
15
  rows(prefix: CellKey): number;
16
+ charged(node: string): number;
10
17
  moving(batches: readonly Batch[]): Moved;
11
18
  landed(moved: Moved): void;
12
19
  forget(): void;
13
20
  };
14
- export declare const spacesOver: (store: Reader, counted: Counted) => Spaces;
21
+ export declare const spacesOver: (store: Reader, counted: Counted, charged?: Charged) => Spaces;
@@ -16,13 +16,26 @@ import { unlessDamaged } from '../store/index.js';
16
16
 
17
17
 
18
18
 
19
-
19
+
20
+
21
+
22
+
23
+
24
+ export const NONE_CHARGED = { prefixes: [], of: () => null };
25
+
26
+
27
+
28
+
29
+
30
+
20
31
 
21
32
 
22
33
 
23
34
 
24
35
 
25
36
 
37
+
38
+
26
39
 
27
40
 
28
41
 
@@ -39,9 +52,34 @@ const added = (moved , name , by ) => {
39
52
  moved.set(name, (moved.get(name) ?? 0) + by);
40
53
  };
41
54
 
42
- export const spacesOver = (store , counted ) => {
55
+ const PAGE = 256;
56
+
57
+ export const spacesOver = (store , counted , charged = NONE_CHARGED) => {
43
58
  const bytes = new Map ();
44
59
  const rows = new Map ();
60
+ let charges = null;
61
+ const chargesOf = () => {
62
+ if (charges !== null) return charges;
63
+ const summed = new Map ();
64
+ unlessDamaged(() => {
65
+ for (const prefix of charged.prefixes) {
66
+ const { from, to } = prefixRange(prefix);
67
+ for (let after = null; ;) {
68
+ const pairs = store.range(from, to, PAGE, after);
69
+ for (const pair of pairs) {
70
+ const found = keyOf(pair.key)?.key;
71
+ const node = found === undefined ? null : charged.of(found, pair.value);
72
+ if (node !== null) added(summed, node, weightOver(store, pair.key));
73
+ }
74
+ if (pairs.length < PAGE) break;
75
+ after = pairs.at(-1)?.key ?? null;
76
+ }
77
+ }
78
+ return null;
79
+ }, null);
80
+ charges = summed;
81
+ return summed;
82
+ };
45
83
  const bytesOf = (partition ) => {
46
84
  const known = bytes.get(partition);
47
85
  if (known !== undefined) return known;
@@ -62,9 +100,11 @@ export const spacesOver = (store , counted ) => {
62
100
  return {
63
101
  bytes: bytesOf,
64
102
  rows: rowsOf,
103
+ charged: (node) => chargesOf().get(node) ?? 0,
65
104
  moving: (batches) => {
66
105
  const movedBytes = new Map ();
67
106
  const movedRows = new Map ();
107
+ const movedCharged = new Map ();
68
108
  for (const { key, value } of lastWrites(batches)) {
69
109
  const found = keyOf(key)?.key;
70
110
  const partition = found?.[0];
@@ -72,20 +112,31 @@ export const spacesOver = (store , counted ) => {
72
112
  bytesOf(partition);
73
113
  const older = unlessDamaged(() => weightOver(store, key), 0);
74
114
  added(movedBytes, partition, (value === null ? 0 : key.length + value.length) - older);
115
+ if (charged.prefixes.some((prefix) => prefix.every((part, at) => found[at] === part))) {
116
+ chargesOf();
117
+ const was = older === 0 ? null : unlessDamaged(() => store.get(key), null);
118
+ const from = was === null ? null : charged.of(found, was);
119
+ const to = value === null ? null : charged.of(found, value);
120
+ if (from !== null) added(movedCharged, from, -older);
121
+ if (to !== null && value !== null) added(movedCharged, to, key.length + value.length);
122
+ }
75
123
  const prefix = counted(found);
76
124
  if (prefix === null) continue;
77
125
  rowsOf(prefix);
78
126
  added(movedRows, hex(keyBytes(prefix)), (value === null ? 0 : 1) - (older === 0 ? 0 : 1));
79
127
  }
80
- return { bytes: movedBytes, rows: movedRows };
128
+ return { bytes: movedBytes, rows: movedRows, charged: movedCharged };
81
129
  },
82
130
  landed: (moved) => {
83
131
  for (const [partition, by] of moved.bytes) added(bytes, partition, by);
84
132
  for (const [prefix, by] of moved.rows) added(rows, prefix, by);
133
+ const summed = chargesOf();
134
+ for (const [node, by] of moved.charged) added(summed, node, by);
85
135
  },
86
136
  forget: () => {
87
137
  bytes.clear();
88
138
  rows.clear();
139
+ charges = null;
89
140
  },
90
141
  };
91
142
  };
@@ -111,7 +111,10 @@ const cutOff = (hold , held , message , why
111
111
  const ended = (hold , held , ending ) => {
112
112
  if ('answered' in ending) {
113
113
  const writes = held.cells?.batch() ?? [];
114
- const full = writes.length === 0 ? null : (hold.gear.refused?.(held.lobe, writes, held.cells?.held() ?? 0) ?? null);
114
+ const judged = [...writes, ...held.posted];
115
+ const posted = held.posted.reduce((sum, { key, value }) => sum + key.length + (value?.length ?? 0), 0);
116
+ const full =
117
+ judged.length === 0 ? null : (hold.gear.refused?.(held.lobe, judged, (held.cells?.held() ?? 0) + posted) ?? null);
115
118
  if (full !== null) return settle(hold, held, error('busy', full), []);
116
119
  ringAgain(hold, held, ending.answered, enqueue(hold));
117
120
  settle(hold, held, ending.answered, [...writes, ...held.taken, ...postedBy(hold, held)]);
@@ -45,7 +45,7 @@
45
45
 
46
46
 
47
47
 
48
-
48
+
49
49
 
50
50
 
51
51
 
@@ -129,8 +129,8 @@
129
129
 
130
130
 
131
131
 
132
-
133
-
132
+
133
+
134
134
 
135
135
 
136
136
 
@@ -25,7 +25,7 @@ export const DRAW = 'draw';
25
25
 
26
26
 
27
27
 
28
-
28
+
29
29
 
30
30
 
31
31
 
@@ -22,7 +22,7 @@ import { spanOf } from './span.js';
22
22
 
23
23
 
24
24
 
25
-
25
+
26
26
 
27
27
 
28
28
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  export const EAR_BLUEPRINT = {
5
5
  name: 'nervur.ear',
6
- version: '0.37.5',
6
+ version: '0.37.6',
7
7
  description: 'The ear: it opens and seals the boxes of Quo, and the brain keeps every relation.',
8
8
  methods: {
9
9
  arrived: {