@ecsia/core 0.1.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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/bitmask/bitmask.d.ts +21 -0
- package/dist/bitmask/bitmask.d.ts.map +1 -0
- package/dist/bitmask/bitmask.js +103 -0
- package/dist/bitmask/bitmask.js.map +1 -0
- package/dist/bitmask/index.d.ts +3 -0
- package/dist/bitmask/index.d.ts.map +1 -0
- package/dist/bitmask/index.js +2 -0
- package/dist/bitmask/index.js.map +1 -0
- package/dist/component/accessor.d.ts +40 -0
- package/dist/component/accessor.d.ts.map +1 -0
- package/dist/component/accessor.js +220 -0
- package/dist/component/accessor.js.map +1 -0
- package/dist/component/column-set.d.ts +20 -0
- package/dist/component/column-set.d.ts.map +1 -0
- package/dist/component/column-set.js +60 -0
- package/dist/component/column-set.js.map +1 -0
- package/dist/component/define.d.ts +23 -0
- package/dist/component/define.d.ts.map +1 -0
- package/dist/component/define.js +155 -0
- package/dist/component/define.js.map +1 -0
- package/dist/component/descriptors.d.ts +3 -0
- package/dist/component/descriptors.d.ts.map +1 -0
- package/dist/component/descriptors.js +147 -0
- package/dist/component/descriptors.js.map +1 -0
- package/dist/component/index.d.ts +10 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component/index.js +6 -0
- package/dist/component/index.js.map +1 -0
- package/dist/component/sidecar.d.ts +58 -0
- package/dist/component/sidecar.d.ts.map +1 -0
- package/dist/component/sidecar.js +136 -0
- package/dist/component/sidecar.js.map +1 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +70 -0
- package/dist/config.js.map +1 -0
- package/dist/entity/codec.d.ts +45 -0
- package/dist/entity/codec.d.ts.map +1 -0
- package/dist/entity/codec.js +53 -0
- package/dist/entity/codec.js.map +1 -0
- package/dist/entity/index-allocator.d.ts +46 -0
- package/dist/entity/index-allocator.d.ts.map +1 -0
- package/dist/entity/index-allocator.js +121 -0
- package/dist/entity/index-allocator.js.map +1 -0
- package/dist/entity/index.d.ts +13 -0
- package/dist/entity/index.d.ts.map +1 -0
- package/dist/entity/index.js +7 -0
- package/dist/entity/index.js.map +1 -0
- package/dist/entity/record.d.ts +28 -0
- package/dist/entity/record.d.ts.map +1 -0
- package/dist/entity/record.js +42 -0
- package/dist/entity/record.js.map +1 -0
- package/dist/entity/ref.d.ts +70 -0
- package/dist/entity/ref.d.ts.map +1 -0
- package/dist/entity/ref.js +104 -0
- package/dist/entity/ref.js.map +1 -0
- package/dist/entity/reservation.d.ts +12 -0
- package/dist/entity/reservation.d.ts.map +1 -0
- package/dist/entity/reservation.js +28 -0
- package/dist/entity/reservation.js.map +1 -0
- package/dist/entity/store.d.ts +60 -0
- package/dist/entity/store.d.ts.map +1 -0
- package/dist/entity/store.js +193 -0
- package/dist/entity/store.js.map +1 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +12 -0
- package/dist/env.js.map +1 -0
- package/dist/ids.d.ts +9 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +8 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-surface.d.ts +27 -0
- package/dist/inspect-surface.d.ts.map +1 -0
- package/dist/inspect-surface.js +14 -0
- package/dist/inspect-surface.js.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +19 -0
- package/dist/internal.js.map +1 -0
- package/dist/memory/allocU32.d.ts +25 -0
- package/dist/memory/allocU32.d.ts.map +1 -0
- package/dist/memory/allocU32.js +95 -0
- package/dist/memory/allocU32.js.map +1 -0
- package/dist/memory/buffers.d.ts +94 -0
- package/dist/memory/buffers.d.ts.map +1 -0
- package/dist/memory/buffers.js +308 -0
- package/dist/memory/buffers.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +4 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/layout.d.ts +37 -0
- package/dist/memory/layout.d.ts.map +1 -0
- package/dist/memory/layout.js +116 -0
- package/dist/memory/layout.js.map +1 -0
- package/dist/query/compile.d.ts +73 -0
- package/dist/query/compile.d.ts.map +1 -0
- package/dist/query/compile.js +158 -0
- package/dist/query/compile.js.map +1 -0
- package/dist/query/engine.d.ts +48 -0
- package/dist/query/engine.d.ts.map +1 -0
- package/dist/query/engine.js +230 -0
- package/dist/query/engine.js.map +1 -0
- package/dist/query/index.d.ts +8 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +10 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/live-query.d.ts +122 -0
- package/dist/query/live-query.d.ts.map +1 -0
- package/dist/query/live-query.js +543 -0
- package/dist/query/live-query.js.map +1 -0
- package/dist/query/sparse-set.d.ts +18 -0
- package/dist/query/sparse-set.d.ts.map +1 -0
- package/dist/query/sparse-set.js +126 -0
- package/dist/query/sparse-set.js.map +1 -0
- package/dist/reactivity/change-version.d.ts +19 -0
- package/dist/reactivity/change-version.d.ts.map +1 -0
- package/dist/reactivity/change-version.js +76 -0
- package/dist/reactivity/change-version.js.map +1 -0
- package/dist/reactivity/index.d.ts +12 -0
- package/dist/reactivity/index.d.ts.map +1 -0
- package/dist/reactivity/index.js +12 -0
- package/dist/reactivity/index.js.map +1 -0
- package/dist/reactivity/log.d.ts +83 -0
- package/dist/reactivity/log.d.ts.map +1 -0
- package/dist/reactivity/log.js +260 -0
- package/dist/reactivity/log.js.map +1 -0
- package/dist/reactivity/observer-commands.d.ts +40 -0
- package/dist/reactivity/observer-commands.d.ts.map +1 -0
- package/dist/reactivity/observer-commands.js +111 -0
- package/dist/reactivity/observer-commands.js.map +1 -0
- package/dist/reactivity/observers.d.ts +50 -0
- package/dist/reactivity/observers.d.ts.map +1 -0
- package/dist/reactivity/observers.js +127 -0
- package/dist/reactivity/observers.js.map +1 -0
- package/dist/reactivity/reactivity.d.ts +141 -0
- package/dist/reactivity/reactivity.d.ts.map +1 -0
- package/dist/reactivity/reactivity.js +479 -0
- package/dist/reactivity/reactivity.js.map +1 -0
- package/dist/reactivity/structural-journal.d.ts +30 -0
- package/dist/reactivity/structural-journal.d.ts.map +1 -0
- package/dist/reactivity/structural-journal.js +77 -0
- package/dist/reactivity/structural-journal.js.map +1 -0
- package/dist/registry.d.ts +26 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +58 -0
- package/dist/registry.js.map +1 -0
- package/dist/serialize-surface.d.ts +170 -0
- package/dist/serialize-surface.d.ts.map +1 -0
- package/dist/serialize-surface.js +6 -0
- package/dist/serialize-surface.js.map +1 -0
- package/dist/storage/archetype.d.ts +38 -0
- package/dist/storage/archetype.d.ts.map +1 -0
- package/dist/storage/archetype.js +47 -0
- package/dist/storage/archetype.js.map +1 -0
- package/dist/storage/cold-store.d.ts +41 -0
- package/dist/storage/cold-store.d.ts.map +1 -0
- package/dist/storage/cold-store.js +100 -0
- package/dist/storage/cold-store.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +5 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/signature.d.ts +27 -0
- package/dist/storage/signature.d.ts.map +1 -0
- package/dist/storage/signature.js +115 -0
- package/dist/storage/signature.js.map +1 -0
- package/dist/storage/storage.d.ts +72 -0
- package/dist/storage/storage.d.ts.map +1 -0
- package/dist/storage/storage.js +192 -0
- package/dist/storage/storage.js.map +1 -0
- package/dist/storage/store.d.ts +88 -0
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/storage/store.js +473 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/util/stable-index.d.ts +29 -0
- package/dist/util/stable-index.d.ts.map +1 -0
- package/dist/util/stable-index.js +51 -0
- package/dist/util/stable-index.js.map +1 -0
- package/dist/world.d.ts +262 -0
- package/dist/world.d.ts.map +1 -0
- package/dist/world.js +831 -0
- package/dist/world.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Canonical archetype signatures.
|
|
2
|
+
// A Signature is the sorted, de-duplicated Uint32Array of ComponentIds defining an archetype's
|
|
3
|
+
// exact component set. Sorting makes structurally-equal sets identical regardless of add order, so
|
|
4
|
+
// equality is a linear word compare and the lookup map keys on an FNV-1a hash of the sorted ids.
|
|
5
|
+
/** O(n) equality of two sorted signatures. */
|
|
6
|
+
export function sigEquals(a, b) {
|
|
7
|
+
if (a.length !== b.length)
|
|
8
|
+
return false;
|
|
9
|
+
for (let i = 0; i < a.length; i++)
|
|
10
|
+
if (a[i] !== b[i])
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/** FNV-1a over the sorted ids → 32-bit hash for the archetype lookup map. */
|
|
15
|
+
export function sigHash(a) {
|
|
16
|
+
let h = 0x811c9dc5;
|
|
17
|
+
for (let i = 0; i < a.length; i++) {
|
|
18
|
+
h ^= a[i];
|
|
19
|
+
h = Math.imul(h, 0x01000193);
|
|
20
|
+
}
|
|
21
|
+
return h >>> 0;
|
|
22
|
+
}
|
|
23
|
+
/** Sort + de-dup an arbitrary id multiset into the canonical form ( holds). */
|
|
24
|
+
export function canonicalize(ids) {
|
|
25
|
+
const arr = Uint32Array.from(new Set(ids));
|
|
26
|
+
arr.sort();
|
|
27
|
+
return arr;
|
|
28
|
+
}
|
|
29
|
+
/** The neighbor signature reached by adding `c` (sorted insert). Idempotent if `c` already present. */
|
|
30
|
+
export function sigWithAdded(sig, c) {
|
|
31
|
+
const v = c;
|
|
32
|
+
// Binary-search the insertion point; if found, the signature is unchanged (idempotent add).
|
|
33
|
+
let lo = 0;
|
|
34
|
+
let hi = sig.length;
|
|
35
|
+
while (lo < hi) {
|
|
36
|
+
const mid = (lo + hi) >>> 1;
|
|
37
|
+
const cur = sig[mid];
|
|
38
|
+
if (cur === v)
|
|
39
|
+
return sig;
|
|
40
|
+
if (cur < v)
|
|
41
|
+
lo = mid + 1;
|
|
42
|
+
else
|
|
43
|
+
hi = mid;
|
|
44
|
+
}
|
|
45
|
+
const out = new Uint32Array(sig.length + 1);
|
|
46
|
+
out.set(sig.subarray(0, lo), 0);
|
|
47
|
+
out[lo] = v;
|
|
48
|
+
out.set(sig.subarray(lo), lo + 1);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
/** The neighbor signature reached by removing `c`. Returns `sig` unchanged if `c` is absent. */
|
|
52
|
+
export function sigWithRemoved(sig, c) {
|
|
53
|
+
const v = c;
|
|
54
|
+
let lo = 0;
|
|
55
|
+
let hi = sig.length - 1;
|
|
56
|
+
let found = -1;
|
|
57
|
+
while (lo <= hi) {
|
|
58
|
+
const mid = (lo + hi) >>> 1;
|
|
59
|
+
const cur = sig[mid];
|
|
60
|
+
if (cur === v) {
|
|
61
|
+
found = mid;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
if (cur < v)
|
|
65
|
+
lo = mid + 1;
|
|
66
|
+
else
|
|
67
|
+
hi = mid - 1;
|
|
68
|
+
}
|
|
69
|
+
if (found < 0)
|
|
70
|
+
return sig;
|
|
71
|
+
const out = new Uint32Array(sig.length - 1);
|
|
72
|
+
out.set(sig.subarray(0, found), 0);
|
|
73
|
+
out.set(sig.subarray(found + 1), found);
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
/** Packed membership words for fast bitwise-AND query matching. */
|
|
77
|
+
export function buildSigWords(sig, stride) {
|
|
78
|
+
const w = new Uint32Array(stride);
|
|
79
|
+
for (let i = 0; i < sig.length; i++) {
|
|
80
|
+
const c = sig[i];
|
|
81
|
+
w[c >>> 5] = (w[c >>> 5] | (1 << (c & 31))) >>> 0;
|
|
82
|
+
}
|
|
83
|
+
return w;
|
|
84
|
+
}
|
|
85
|
+
/** Exact membership test against the sorted signature array, O(log |sig|). */
|
|
86
|
+
export function sigHas(sig, c) {
|
|
87
|
+
const v = c;
|
|
88
|
+
let lo = 0;
|
|
89
|
+
let hi = sig.length - 1;
|
|
90
|
+
while (lo <= hi) {
|
|
91
|
+
const mid = (lo + hi) >>> 1;
|
|
92
|
+
const cur = sig[mid];
|
|
93
|
+
if (cur === v)
|
|
94
|
+
return true;
|
|
95
|
+
if (cur < v)
|
|
96
|
+
lo = mid + 1;
|
|
97
|
+
else
|
|
98
|
+
hi = mid - 1;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
/** Signature-AND helper the query module calls; exposed for testing. */
|
|
103
|
+
export function signatureMatches(sigWords, withW, notW, orW) {
|
|
104
|
+
for (const t of notW)
|
|
105
|
+
if ((sigWords[t.wordIndex] & t.mask) !== 0)
|
|
106
|
+
return false;
|
|
107
|
+
for (const t of withW)
|
|
108
|
+
if ((sigWords[t.wordIndex] & t.mask) !== t.mask)
|
|
109
|
+
return false;
|
|
110
|
+
for (const c of orW)
|
|
111
|
+
if ((sigWords[c.wordIndex] & c.mask) === 0)
|
|
112
|
+
return false;
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/storage/signature.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+FAA+F;AAC/F,mGAAmG;AACnG,iGAAiG;AAOjG,8CAA8C;AAC9C,MAAM,UAAU,SAAS,CAAC,CAAY,EAAE,CAAY;IAClD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK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A2B,EAC3B,IAA0B,EAC1B,GAAyB;IAEzB,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,IAAI,CAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAY,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAA;IAC1F,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,IAAI,CAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAY,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;IAChG,KAAK,MAAM,CAAC,IAAI,GAAG;QAAE,IAAI,CAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAY,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAA;IACzF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ComponentDef, ComponentId, EntityHandle, Schema } from '@ecsia/schema';
|
|
2
|
+
import type { AccessorWorld, ColumnSet } from '../component/index.js';
|
|
3
|
+
import type { Bitmask } from '../bitmask/index.js';
|
|
4
|
+
import { ArchetypeStore } from './store.js';
|
|
5
|
+
import type { RecordSurface, StorageDeps } from './store.js';
|
|
6
|
+
import type { Archetype } from './archetype.js';
|
|
7
|
+
export interface DefRegistry {
|
|
8
|
+
idOf(def: ComponentDef<Schema>): ComponentId | undefined;
|
|
9
|
+
defOf(id: ComponentId): ComponentDef<Schema> | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface StorageConfig {
|
|
12
|
+
readonly buffers: StorageDeps['buffers'];
|
|
13
|
+
readonly accessorWorld: AccessorWorld;
|
|
14
|
+
readonly bitmask: Bitmask;
|
|
15
|
+
readonly record: RecordSurface;
|
|
16
|
+
readonly registry: DefRegistry;
|
|
17
|
+
readonly maxHotArchetypes: number;
|
|
18
|
+
readonly stride: number;
|
|
19
|
+
readonly maxEntities: number;
|
|
20
|
+
enqueueRemoveLog(index: number, c: ComponentId): void;
|
|
21
|
+
/**
|
|
22
|
+
*: does any observer subscribe to `c`'s removal? When true for any held component, despawn
|
|
23
|
+
* defers the dying row's column reclaim (swap-pop) so an onRemove handler can read the last value.
|
|
24
|
+
* Optional so a query-less harness can construct storage without reactivity.
|
|
25
|
+
*/
|
|
26
|
+
hasRemoveObserver?(c: ComponentId): boolean;
|
|
27
|
+
/** Shape-log hook: structural entry at the commit point. Wired by the world to reactivity. */
|
|
28
|
+
trackShape?(index: number, c: ComponentId, kind: number): void;
|
|
29
|
+
/** Single-entity incremental query maintenance; wired by the world to the engine. */
|
|
30
|
+
maintainEntity(index: number, c: ComponentId): void;
|
|
31
|
+
/**
|
|
32
|
+
* Spawn-time maintenance: a component-less entity lands in EMPTY and never drives
|
|
33
|
+
* `maintainEntity`, so constraint-less queries are told about it here (keeps the incremental path
|
|
34
|
+
* symmetric with the despawn path). No-op for component-constrained queries.
|
|
35
|
+
*/
|
|
36
|
+
onEntitySpawned(index: number): void;
|
|
37
|
+
/** Despawn eviction: remove the index from EVERY live query unconditionally. */
|
|
38
|
+
dropEntity(index: number): void;
|
|
39
|
+
tick(): number;
|
|
40
|
+
handleIndex(handle: EntityHandle): number;
|
|
41
|
+
}
|
|
42
|
+
export declare class Storage {
|
|
43
|
+
#private;
|
|
44
|
+
readonly archetypes: ArchetypeStore;
|
|
45
|
+
constructor(cfg: StorageConfig);
|
|
46
|
+
/** Subscribe to archetypeCreated; forwarded from the ArchetypeStore. */
|
|
47
|
+
onArchetypeCreated(fn: (arch: Archetype) => void): void;
|
|
48
|
+
/** Entity indices currently resident in cold archetype `archetypeId` (O(rows in that archetype)). */
|
|
49
|
+
coldResidentsOf(archetypeId: number): Iterable<number>;
|
|
50
|
+
/** The per-TYPE cold ColumnSet for `componentId` (cold blocks are keyed by component, not archetype). */
|
|
51
|
+
coldColumnSet(componentId: ComponentId): ColumnSet | undefined;
|
|
52
|
+
/** The cold-block row holding `componentId`'s fields for entity `index`, or -1 if absent. */
|
|
53
|
+
coldRowOf(index: number, componentId: ComponentId): number;
|
|
54
|
+
onSpawn(handle: EntityHandle): void;
|
|
55
|
+
onDespawn(handle: EntityHandle): void;
|
|
56
|
+
add(handle: EntityHandle, def: ComponentDef<Schema>): void;
|
|
57
|
+
remove(handle: EntityHandle, def: ComponentDef<Schema>): void;
|
|
58
|
+
spawnWith(handle: EntityHandle, defs: readonly ComponentDef<Schema>[]): void;
|
|
59
|
+
/** Atomic multi-id add — ONE migration to a single target signature (relations path). */
|
|
60
|
+
addMany(handle: EntityHandle, defs: readonly ComponentDef<Schema>[]): void;
|
|
61
|
+
/** Atomic multi-id remove — symmetric to addMany. */
|
|
62
|
+
removeMany(handle: EntityHandle, defs: readonly ComponentDef<Schema>[]): void;
|
|
63
|
+
warm(defs: readonly ComponentDef<Schema>[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* (has() never reads the
|
|
66
|
+
* bitmask for a dead handle); this asserts world.phase === 'serial' inside bitmaskHas.
|
|
67
|
+
*/
|
|
68
|
+
has(handle: EntityHandle, def: ComponentDef<Schema>): boolean;
|
|
69
|
+
resolveRead(handle: EntityHandle, archetypeId: number, row: number, def: unknown): unknown;
|
|
70
|
+
resolveWrite(handle: EntityHandle, archetypeId: number, row: number, def: unknown): unknown;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAoB,MAAM,uBAAuB,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAsB,MAAM,YAAY,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IAAI;IAMjD;;;OAGG;IACH,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO;IAO7D,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO;IAI1F,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO;CAkC5F"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// The storage facade: ties the entity record + the per-entity bitmask + the
|
|
2
|
+
// ArchetypeStore into the world's structural-verb surface and the accessor-resolution path. It is
|
|
3
|
+
// the AccessorResolver the pooled EntityRef calls (resolveRead/resolveWrite) — resolving the
|
|
4
|
+
// (archetype, component) ColumnSet from the entity's REAL archetype now, replacing the seam that
|
|
5
|
+
// keyed column sets purely by (archetypeId, componentId) on the registry.
|
|
6
|
+
//
|
|
7
|
+
// All structural verbs run serial / main-thread. In the single-thread executor
|
|
8
|
+
// world.phase stays 'serial' permanently, so every op takes the synchronous direct-apply path
|
|
9
|
+
import { bindAccessorRow } from '../component/index.js';
|
|
10
|
+
import { ArchetypeStore, EMPTY_ARCHETYPE_ID } from './store.js';
|
|
11
|
+
import { coldRowOf } from './cold-store.js';
|
|
12
|
+
import { canonicalize } from './signature.js';
|
|
13
|
+
// ShapeKind ordinals for the lifecycle commit points.
|
|
14
|
+
const SHAPE_CREATE = 0;
|
|
15
|
+
const SHAPE_DESTROY = 1;
|
|
16
|
+
const NO_COMPONENT_SHAPE = 0;
|
|
17
|
+
export class Storage {
|
|
18
|
+
archetypes;
|
|
19
|
+
#cfg;
|
|
20
|
+
constructor(cfg) {
|
|
21
|
+
this.#cfg = cfg;
|
|
22
|
+
this.archetypes = new ArchetypeStore({
|
|
23
|
+
buffers: cfg.buffers,
|
|
24
|
+
accessorWorld: cfg.accessorWorld,
|
|
25
|
+
bitmask: cfg.bitmask,
|
|
26
|
+
record: cfg.record,
|
|
27
|
+
maxHotArchetypes: cfg.maxHotArchetypes,
|
|
28
|
+
stride: cfg.stride,
|
|
29
|
+
maxEntities: cfg.maxEntities,
|
|
30
|
+
enqueueRemoveLog: cfg.enqueueRemoveLog,
|
|
31
|
+
...(cfg.trackShape !== undefined ? { trackShape: cfg.trackShape } : {}),
|
|
32
|
+
maintainEntity: cfg.maintainEntity,
|
|
33
|
+
tick: cfg.tick,
|
|
34
|
+
defOf: (c) => cfg.registry.defOf(c),
|
|
35
|
+
handleIndex: (h) => cfg.handleIndex(h),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** Subscribe to archetypeCreated; forwarded from the ArchetypeStore. */
|
|
39
|
+
onArchetypeCreated(fn) {
|
|
40
|
+
this.archetypes.onArchetypeCreated(fn);
|
|
41
|
+
}
|
|
42
|
+
// --- cold-query support: per-archetype residents + per-type cold value access ---
|
|
43
|
+
/** Entity indices currently resident in cold archetype `archetypeId` (O(rows in that archetype)). */
|
|
44
|
+
*coldResidentsOf(archetypeId) {
|
|
45
|
+
for (const [index, archId] of this.archetypes.cold.archOf) {
|
|
46
|
+
if (archId === archetypeId)
|
|
47
|
+
yield index;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The per-TYPE cold ColumnSet for `componentId` (cold blocks are keyed by component, not archetype). */
|
|
51
|
+
coldColumnSet(componentId) {
|
|
52
|
+
return this.archetypes.cold.blocks.get(componentId);
|
|
53
|
+
}
|
|
54
|
+
/** The cold-block row holding `componentId`'s fields for entity `index`, or -1 if absent. */
|
|
55
|
+
coldRowOf(index, componentId) {
|
|
56
|
+
return coldRowOf(this.archetypes.cold, index, componentId);
|
|
57
|
+
}
|
|
58
|
+
// --- entity lifecycle hooks (driven by EntityStore.spawn/despawn) ----------
|
|
59
|
+
onSpawn(handle) {
|
|
60
|
+
const index = this.#cfg.handleIndex(handle);
|
|
61
|
+
const empty = this.archetypes.emptyArchetype;
|
|
62
|
+
const row = this.archetypes.allocRow(empty, handle);
|
|
63
|
+
this.#cfg.record.commitRecord(index, EMPTY_ARCHETYPE_ID, row);
|
|
64
|
+
// Empty signature → no bits set; bitmaskApplyDelta from empty to empty is a no-op but keeps the
|
|
65
|
+
// coherence discipline explicit.
|
|
66
|
+
this.#cfg.bitmask.bitmaskApplyDelta(index, empty.signature, empty.signature);
|
|
67
|
+
// Emit the Create shape entry once the entity is committed to the empty
|
|
68
|
+
// archetype (componentId = NO_COMPONENT; the kind disambiguates).
|
|
69
|
+
this.#cfg.trackShape?.(index, NO_COMPONENT_SHAPE, SHAPE_CREATE);
|
|
70
|
+
// The component-less entity matches no component-constrained query, but a constraint-less
|
|
71
|
+
// query DOES match the empty signature. Tell those queries now (the seed already includes such
|
|
72
|
+
// entities, so this keeps the before-/after-spawn incremental paths symmetric).
|
|
73
|
+
this.#cfg.onEntitySpawned(index);
|
|
74
|
+
}
|
|
75
|
+
onDespawn(handle) {
|
|
76
|
+
const index = this.#cfg.handleIndex(handle);
|
|
77
|
+
const archId = this.#cfg.record.archetypeIdOf(index);
|
|
78
|
+
const arch = this.archetypes.byId[archId];
|
|
79
|
+
// /: emit Destroy BEFORE removeRow AND before identity invalidation
|
|
80
|
+
// (freeEntity runs after onDespawn in EntityStore), so a remove/destroy observer can still
|
|
81
|
+
// resolve the dying entity's last location. The full fixed sequence is: Destroy + remove-logs,
|
|
82
|
+
// then removeRow, then bitmask clear, then freeEntity.
|
|
83
|
+
this.#cfg.trackShape?.(index, NO_COMPONENT_SHAPE, SHAPE_DESTROY);
|
|
84
|
+
// Removal reactivity for every held component, BEFORE the row is reclaimed.
|
|
85
|
+
// If ANY held component has a remove-observer, defer the row reclaim so its values survive
|
|
86
|
+
// the drain. The gate keeps the no-observer path free of the swap window cost.
|
|
87
|
+
let defer = false;
|
|
88
|
+
const hasRemoveObserver = this.#cfg.hasRemoveObserver;
|
|
89
|
+
for (let i = 0; i < arch.signature.length; i++) {
|
|
90
|
+
const c = arch.signature[i];
|
|
91
|
+
this.#cfg.enqueueRemoveLog(index, c);
|
|
92
|
+
if (hasRemoveObserver !== undefined && hasRemoveObserver(c))
|
|
93
|
+
defer = true;
|
|
94
|
+
}
|
|
95
|
+
const row = this.#cfg.record.rowOf(index);
|
|
96
|
+
const fixSibling = (movedIndex, newRow) => {
|
|
97
|
+
this.#cfg.record.commitRecord(movedIndex, archId, newRow);
|
|
98
|
+
};
|
|
99
|
+
if (defer) {
|
|
100
|
+
this.archetypes.removeRow(arch, row, fixSibling, (newRow) => {
|
|
101
|
+
this.#cfg.record.commitRecord(index, archId, newRow);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.archetypes.removeRow(arch, row, fixSibling);
|
|
106
|
+
}
|
|
107
|
+
this.#cfg.bitmask.bitmaskClear(index);
|
|
108
|
+
// The despawned entity leaves every query that held it, INCLUDING a constraint-less query
|
|
109
|
+
// (which a now-empty shape would otherwise still appear to match). dropEntity unconditionally
|
|
110
|
+
// evicts the index from every live query's `current` (recording a `removed` delta where declared).
|
|
111
|
+
this.#cfg.dropEntity(index);
|
|
112
|
+
}
|
|
113
|
+
// --- structural verbs ------------------------------------------------------
|
|
114
|
+
add(handle, def) {
|
|
115
|
+
const id = this.#requireId(def);
|
|
116
|
+
this.archetypes.migrateAdding(handle, id);
|
|
117
|
+
}
|
|
118
|
+
remove(handle, def) {
|
|
119
|
+
const id = this.#requireId(def);
|
|
120
|
+
this.archetypes.migrateRemoving(handle, id);
|
|
121
|
+
}
|
|
122
|
+
spawnWith(handle, defs) {
|
|
123
|
+
for (const d of defs)
|
|
124
|
+
this.#requireId(d);
|
|
125
|
+
this.archetypes.spawnWith(handle, defs);
|
|
126
|
+
}
|
|
127
|
+
/** Atomic multi-id add — ONE migration to a single target signature (relations path). */
|
|
128
|
+
addMany(handle, defs) {
|
|
129
|
+
const ids = [];
|
|
130
|
+
for (const d of defs)
|
|
131
|
+
ids.push(this.#requireId(d));
|
|
132
|
+
this.archetypes.migrateAddingMany(handle, ids);
|
|
133
|
+
}
|
|
134
|
+
/** Atomic multi-id remove — symmetric to addMany. */
|
|
135
|
+
removeMany(handle, defs) {
|
|
136
|
+
const ids = [];
|
|
137
|
+
for (const d of defs)
|
|
138
|
+
ids.push(this.#requireId(d));
|
|
139
|
+
this.archetypes.migrateRemovingMany(handle, ids);
|
|
140
|
+
}
|
|
141
|
+
warm(defs) {
|
|
142
|
+
const ids = [];
|
|
143
|
+
for (const d of defs)
|
|
144
|
+
ids.push(this.#requireId(d));
|
|
145
|
+
this.archetypes.warm(canonicalize(ids));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* (has() never reads the
|
|
149
|
+
* bitmask for a dead handle); this asserts world.phase === 'serial' inside bitmaskHas.
|
|
150
|
+
*/
|
|
151
|
+
has(handle, def) {
|
|
152
|
+
const id = this.#requireId(def);
|
|
153
|
+
return this.#cfg.bitmask.bitmaskHas(this.#cfg.handleIndex(handle), id);
|
|
154
|
+
}
|
|
155
|
+
// --- AccessorResolver -------------------------------
|
|
156
|
+
resolveRead(handle, archetypeId, row, def) {
|
|
157
|
+
return this.#resolve(handle, archetypeId, row, def);
|
|
158
|
+
}
|
|
159
|
+
resolveWrite(handle, archetypeId, row, def) {
|
|
160
|
+
return this.#resolve(handle, archetypeId, row, def);
|
|
161
|
+
}
|
|
162
|
+
#resolve(handle, archetypeId, row, def) {
|
|
163
|
+
const id = this.#requireId(def);
|
|
164
|
+
const arch = this.archetypes.byId[archetypeId];
|
|
165
|
+
if (arch === undefined)
|
|
166
|
+
throw new Error(`storage.resolve: unknown archetype ${archetypeId}`);
|
|
167
|
+
let set;
|
|
168
|
+
let boundRow = row;
|
|
169
|
+
if (arch.cold) {
|
|
170
|
+
set = this.archetypes.cold.blocks.get(id);
|
|
171
|
+
boundRow = coldRowOf(this.archetypes.cold, this.#cfg.handleIndex(handle), id);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
set = arch.columnSets.get(id);
|
|
175
|
+
}
|
|
176
|
+
if (set === undefined) {
|
|
177
|
+
const rt = def;
|
|
178
|
+
if (rt.columnLayouts.length === 0 && !rt.hasRichFields) {
|
|
179
|
+
throw new Error(`storage.resolve: component '${def.name}' is a tag (no fields to read/write)`);
|
|
180
|
+
}
|
|
181
|
+
throw new Error(`storage.resolve: entity does not hold component '${def.name}'`);
|
|
182
|
+
}
|
|
183
|
+
return bindAccessorRow(set, boundRow, handle);
|
|
184
|
+
}
|
|
185
|
+
#requireId(def) {
|
|
186
|
+
const id = this.#cfg.registry.idOf(def);
|
|
187
|
+
if (id === undefined)
|
|
188
|
+
throw new Error(`component '${def.name}' is not registered with this world — register it in createWorld({ components: [...] })`);
|
|
189
|
+
return id;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,kGAAkG;AAClG,6FAA6F;AAC7F,iGAAiG;AACjG,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,8FAA8F;AAG9F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,sDAAsD;AACtD,MAAM,YAAY,GAAG,CAAC,CAAA;AACtB,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,kBAAkB,GAAG,CAAgB,CAAA;AAuC3C,MAAM,OAAO,OAAO;IACT,UAAU,CAAgB;IAC1B,IAAI,CAAe;IAE5B,YAAY,GAAkB;QAC5B,IAAI,CAAC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AAS;YAClB,MAAM,IAAI,KAAK,CACb,cAAc,GAAG,CAAC,IAAI,yFAAyF,CAChH,CAAA;QACH,OAAO,EAAE,CAAA;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ComponentId, ComponentDef, Schema } from '@ecsia/schema';
|
|
2
|
+
import type { ArchetypeId } from '@ecsia/schema';
|
|
3
|
+
import type { Buffers } from '../memory/index.js';
|
|
4
|
+
import type { AccessorWorld } from '../component/index.js';
|
|
5
|
+
import type { Bitmask } from '../bitmask/index.js';
|
|
6
|
+
import type { Signature } from './signature.js';
|
|
7
|
+
import type { Archetype } from './archetype.js';
|
|
8
|
+
import type { ColdStore } from './cold-store.js';
|
|
9
|
+
export declare const EMPTY_ARCHETYPE_ID: ArchetypeId;
|
|
10
|
+
export declare const ARCHETYPE_NONE: ArchetypeId;
|
|
11
|
+
/** The two-word record surface the store commits through. */
|
|
12
|
+
export interface RecordSurface {
|
|
13
|
+
commitRecord(index: number, archetypeId: number, row: number): void;
|
|
14
|
+
archetypeIdOf(index: number): number;
|
|
15
|
+
rowOf(index: number): number;
|
|
16
|
+
}
|
|
17
|
+
export interface StorageDeps {
|
|
18
|
+
readonly buffers: Buffers;
|
|
19
|
+
readonly accessorWorld: AccessorWorld;
|
|
20
|
+
readonly bitmask: Bitmask;
|
|
21
|
+
readonly record: RecordSurface;
|
|
22
|
+
readonly maxHotArchetypes: number;
|
|
23
|
+
/** Bitmask/sigWords stride = ceil(N/32) ( C4). */
|
|
24
|
+
readonly stride: number;
|
|
25
|
+
/** Mint ceiling; clamps a new column's initial reservation so it never exceeds the world cap. */
|
|
26
|
+
readonly maxEntities: number;
|
|
27
|
+
/** Removal-reactivity hook for components in fromArch \ toArch ( fills the body). */
|
|
28
|
+
enqueueRemoveLog(index: number, c: ComponentId): void;
|
|
29
|
+
/**
|
|
30
|
+
* Shape-log hook: emit a structural entry at the commit point. Optional so a
|
|
31
|
+
* query-less harness (unit tests) constructs the store directly; the world wires it to reactivity.
|
|
32
|
+
*/
|
|
33
|
+
trackShape?(index: number, c: ComponentId, kind: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Single-entity incremental query maintenance: called once per component in the
|
|
36
|
+
* symmetric difference of a migration AFTER the bitmask delta is applied, so matchesEntityNow reads
|
|
37
|
+
* a coherent shape. Optional so a query-less harness ( unit tests) constructs the store directly.
|
|
38
|
+
* re-routes this through reactivity's MAINTAIN_STRUCTURAL shape-log drain.
|
|
39
|
+
*/
|
|
40
|
+
maintainEntity?(index: number, c: ComponentId): void;
|
|
41
|
+
tick(): number;
|
|
42
|
+
defOf(c: ComponentId): ComponentDef<Schema> | undefined;
|
|
43
|
+
handleIndex(handle: number): number;
|
|
44
|
+
}
|
|
45
|
+
export declare class ArchetypeStore {
|
|
46
|
+
#private;
|
|
47
|
+
readonly byId: Archetype[];
|
|
48
|
+
readonly cold: ColdStore;
|
|
49
|
+
constructor(deps: StorageDeps);
|
|
50
|
+
get hotCount(): number;
|
|
51
|
+
get emptyArchetype(): Archetype;
|
|
52
|
+
getOrCreateArchetype(sig: Signature): Archetype;
|
|
53
|
+
/** Subscribe to archetypeCreated. Serial-phase only. */
|
|
54
|
+
onArchetypeCreated(fn: (arch: Archetype) => void): void;
|
|
55
|
+
edgeAdd(arch: Archetype, c: ComponentId): Archetype;
|
|
56
|
+
edgeRemove(arch: Archetype, c: ComponentId): Archetype;
|
|
57
|
+
/** Reserve a row in `arch` for `handle`; records the occupant. Caller writes column values. */
|
|
58
|
+
allocRow(arch: Archetype, handle: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Swap-pop removal: move the last live row into `row`, then fix the moved sibling's record via
|
|
61
|
+
* the callback. `fixSibling` fires exactly once iff row !== count-1 (I6). Serial only.
|
|
62
|
+
*
|
|
63
|
+
*: when `relocateDying` is supplied (a remove-observer subscribes to a
|
|
64
|
+
* held component), the dying entity's column data must survive intact until after observerDrain so
|
|
65
|
+
* an onRemove handler can read its last value. Instead of a one-way overwrite of the dying row, we
|
|
66
|
+
* SWAP it with the last live row: the sibling's data lands in `row` (record fixed), and the dying
|
|
67
|
+
* entity's data lands at the now-excluded `last` slot (record relocated via `relocateDying`). The
|
|
68
|
+
* dying row is naturally reclaimed — it sits at/above `count`, outside every `[0,count)` iteration,
|
|
69
|
+
* and is overwritten by the next allocRow (which only happens next frame, since observer mutations
|
|
70
|
+
* stage to command buffers). For hot rows this needs no per-frame stale-row list.
|
|
71
|
+
*/
|
|
72
|
+
removeRow(arch: Archetype, row: number, fixSibling: (movedIndex: number, newRow: number) => void, relocateDying?: (newRow: number) => void): void;
|
|
73
|
+
/** Move one entity from fromArch to toArch: K-shared copy + init-added + shuffle-pop + commit. */
|
|
74
|
+
migrate(handle: number, fromArch: Archetype, toArch: Archetype): number;
|
|
75
|
+
/** entity.add(C): single-id add via the cached edge. */
|
|
76
|
+
migrateAdding(handle: number, c: ComponentId): number;
|
|
77
|
+
/** entity.remove(C): single-id remove via the cached edge. */
|
|
78
|
+
migrateRemoving(handle: number, c: ComponentId): number;
|
|
79
|
+
/** Multi-id atomic add — ONE target signature, one migration (relations atomicity). */
|
|
80
|
+
migrateAddingMany(handle: number, addIds: readonly ComponentId[]): number;
|
|
81
|
+
/** Multi-id atomic remove — symmetric to migrateAddingMany. */
|
|
82
|
+
migrateRemovingMany(handle: number, removeIds: readonly ComponentId[]): number;
|
|
83
|
+
/** spawnWith fast path: compute the target signature up front and migrate ONCE. */
|
|
84
|
+
spawnWith(handle: number, defs: readonly ComponentDef<Schema>[]): number;
|
|
85
|
+
/** Promote a cold archetype (by signature) to hot: allocate columns, migrate its rows out. */
|
|
86
|
+
warm(sig: Signature): void;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/storage/store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM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