@osmix/core 0.1.8 → 0.2.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/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +86 -69
- package/dist/contracts.d.ts +26 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +1 -0
- package/dist/contracts.js.map +1 -0
- package/dist/entities.d.ts +1 -1
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +2 -7
- package/dist/entities.js.map +1 -1
- package/dist/ids.d.ts +2 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +23 -15
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts.map +1 -1
- package/dist/mocks.js.map +1 -1
- package/dist/nodes.d.ts +9 -3
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +6 -13
- package/dist/nodes.js.map +1 -1
- package/dist/osm.d.ts +1 -1
- package/dist/osm.d.ts.map +1 -1
- package/dist/osm.js +1 -4
- package/dist/osm.js.map +1 -1
- package/dist/relations.d.ts +3 -2
- package/dist/relations.d.ts.map +1 -1
- package/dist/relations.js +15 -9
- package/dist/relations.js.map +1 -1
- package/dist/stringtable.d.ts.map +1 -1
- package/dist/stringtable.js +4 -13
- package/dist/stringtable.js.map +1 -1
- package/dist/tags.d.ts +1 -1
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js.map +1 -1
- package/dist/typed-arrays.d.ts +1 -1
- package/dist/typed-arrays.d.ts.map +1 -1
- package/dist/typed-arrays.js.map +1 -1
- package/dist/ways.d.ts +2 -1
- package/dist/ways.d.ts.map +1 -1
- package/dist/ways.js +18 -18
- package/dist/ways.js.map +1 -1
- package/package.json +46 -31
- package/src/contracts.ts +28 -0
- package/src/entities.ts +179 -194
- package/src/ids.ts +228 -235
- package/src/index.ts +12 -9
- package/src/mocks.ts +114 -113
- package/src/nodes.ts +364 -397
- package/src/osm.ts +196 -207
- package/src/relations.ts +530 -558
- package/src/stringtable.ts +174 -183
- package/src/tags.ts +263 -271
- package/src/typed-arrays.ts +184 -194
- package/src/types/geoflatbush.d.ts +28 -33
- package/src/types/geokdbush.d.ts +28 -33
- package/src/types/kdbush.d.ts +34 -34
- package/src/ways.ts +381 -405
- package/test/ids.bench.ts +29 -0
- package/test/ids.test.ts +84 -0
- package/test/memory.test.ts +29 -30
- package/test/relations.bench.ts +27 -0
- package/test/relations.test.ts +101 -0
- package/test/tags-search.test.ts +76 -56
- package/test/typed-arrays.test.ts +100 -99
- package/tsconfig.build.json +6 -3
- package/tsconfig.json +7 -7
package/src/tags.ts
CHANGED
|
@@ -8,30 +8,31 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { ContentHasher } from "@osmix/shared/content-hasher"
|
|
12
|
-
import type { OsmTags } from "@osmix/
|
|
13
|
-
|
|
14
|
-
import
|
|
11
|
+
import type { ContentHasher } from "@osmix/shared/content-hasher";
|
|
12
|
+
import type { OsmTags } from "@osmix/types";
|
|
13
|
+
|
|
14
|
+
import StringTable from "./stringtable.ts";
|
|
15
|
+
import { type BufferType, ResizeableTypedArray as RTA } from "./typed-arrays.ts";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Serializable state for worker transfer.
|
|
18
19
|
*/
|
|
19
20
|
export interface TagsTransferables<T extends BufferType = BufferType> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
/** Maps entity index → start position in tagKeys/tagVals. */
|
|
22
|
+
tagStart: T;
|
|
23
|
+
/** Maps entity index → number of tags. */
|
|
24
|
+
tagCount: T;
|
|
25
|
+
/** Flattened tag key indices. */
|
|
26
|
+
tagKeys: T;
|
|
27
|
+
/** Flattened tag value indices. */
|
|
28
|
+
tagVals: T;
|
|
29
|
+
|
|
30
|
+
/** Flattened entity indices for reverse key lookup. */
|
|
31
|
+
keyEntities: T;
|
|
32
|
+
/** Maps key index → start position in keyEntities. */
|
|
33
|
+
keyIndexStart: T;
|
|
34
|
+
/** Maps key index → count of entities with that key. */
|
|
35
|
+
keyIndexCount: T;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -41,256 +42,247 @@ export interface TagsTransferables<T extends BufferType = BufferType> {
|
|
|
41
42
|
* Note: String indices reference a shared `StringTable`.
|
|
42
43
|
*/
|
|
43
44
|
export class Tags {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* Hashes tag keys and values for each entity.
|
|
288
|
-
*/
|
|
289
|
-
updateHash(hasher: ContentHasher): ContentHasher {
|
|
290
|
-
return hasher
|
|
291
|
-
.update(this.tagStart.array)
|
|
292
|
-
.update(this.tagCount.array)
|
|
293
|
-
.update(this.tagKeys.array)
|
|
294
|
-
.update(this.tagVals.array)
|
|
295
|
-
}
|
|
45
|
+
/** Reference to the shared string table for key/value storage */
|
|
46
|
+
private stringTable: StringTable = new StringTable();
|
|
47
|
+
|
|
48
|
+
// ─── Entity → Tag Lookup ───────────────────────────────────────────────────
|
|
49
|
+
/** Maps entity index → start position in tagKeys/tagVals */
|
|
50
|
+
private tagStart: RTA<Uint32Array>;
|
|
51
|
+
/** Maps entity index → number of tags (max 255) */
|
|
52
|
+
private tagCount: RTA<Uint8Array>;
|
|
53
|
+
/** All tag key string indices, concatenated */
|
|
54
|
+
private tagKeys: RTA<Uint32Array>;
|
|
55
|
+
/** All tag value string indices, concatenated (parallel to tagKeys) */
|
|
56
|
+
private tagVals: RTA<Uint32Array>;
|
|
57
|
+
|
|
58
|
+
// ─── Key → Entity Reverse Lookup ───────────────────────────────────────────
|
|
59
|
+
/**
|
|
60
|
+
* Flattened array of entity indices that have each tag key.
|
|
61
|
+
* Indexed via keyIndexStart and keyIndexCount.
|
|
62
|
+
*/
|
|
63
|
+
private keyEntities: RTA<Uint32Array>;
|
|
64
|
+
|
|
65
|
+
/** Maps key string index → start position in keyEntities */
|
|
66
|
+
private keyIndexStart: RTA<Uint32Array>;
|
|
67
|
+
/** Maps key string index → count of entities with that key */
|
|
68
|
+
private keyIndexCount: RTA<Uint32Array>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Temporary map used during ingestion to collect entity indices per key.
|
|
72
|
+
* Converted to flat arrays during buildIndex() and then cleared.
|
|
73
|
+
*/
|
|
74
|
+
private keyEntityIndexBuilder = new Map<number, number[]>();
|
|
75
|
+
|
|
76
|
+
/** Whether buildIndex() has been called */
|
|
77
|
+
private indexBuilt = false;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Create a new Tags index.
|
|
81
|
+
*/
|
|
82
|
+
constructor(stringTable: StringTable, transferables?: TagsTransferables) {
|
|
83
|
+
this.stringTable = stringTable;
|
|
84
|
+
if (transferables) {
|
|
85
|
+
this.tagStart = RTA.from(Uint32Array, transferables.tagStart);
|
|
86
|
+
this.tagCount = RTA.from(Uint8Array, transferables.tagCount);
|
|
87
|
+
this.tagKeys = RTA.from(Uint32Array, transferables.tagKeys);
|
|
88
|
+
this.tagVals = RTA.from(Uint32Array, transferables.tagVals);
|
|
89
|
+
this.keyEntities = RTA.from(Uint32Array, transferables.keyEntities);
|
|
90
|
+
this.keyIndexStart = RTA.from(Uint32Array, transferables.keyIndexStart);
|
|
91
|
+
this.keyIndexCount = RTA.from(Uint32Array, transferables.keyIndexCount);
|
|
92
|
+
this.indexBuilt = true;
|
|
93
|
+
} else {
|
|
94
|
+
this.tagStart = new RTA(Uint32Array);
|
|
95
|
+
this.tagCount = new RTA(Uint8Array);
|
|
96
|
+
this.tagKeys = new RTA(Uint32Array);
|
|
97
|
+
this.tagVals = new RTA(Uint32Array);
|
|
98
|
+
this.keyEntities = new RTA(Uint32Array);
|
|
99
|
+
this.keyIndexStart = new RTA(Uint32Array);
|
|
100
|
+
this.keyIndexCount = new RTA(Uint32Array);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Add tags to an entity.
|
|
106
|
+
*/
|
|
107
|
+
addTags(index: number, tags?: OsmTags): [number[], number[]] {
|
|
108
|
+
const tagKeys: number[] = [];
|
|
109
|
+
const tagValues: number[] = [];
|
|
110
|
+
|
|
111
|
+
if (tags) {
|
|
112
|
+
for (const [key, value] of Object.entries(tags)) {
|
|
113
|
+
tagKeys.push(this.stringTable.add(key));
|
|
114
|
+
tagValues.push(this.stringTable.add(String(value)));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.addTagKeysAndValues(index, tagKeys, tagValues);
|
|
119
|
+
|
|
120
|
+
return [tagKeys, tagValues];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Add tags to an entity using key and value indexes.
|
|
125
|
+
*/
|
|
126
|
+
addTagKeysAndValues(index: number, keys: number[], values: number[]) {
|
|
127
|
+
this.tagStart.set(index, this.tagKeys.length);
|
|
128
|
+
this.tagCount.set(index, keys.length);
|
|
129
|
+
this.tagKeys.pushMany(keys);
|
|
130
|
+
this.tagVals.pushMany(values);
|
|
131
|
+
|
|
132
|
+
keys.forEach((key) => {
|
|
133
|
+
const keyEntities = this.keyEntityIndexBuilder.get(key);
|
|
134
|
+
if (keyEntities) {
|
|
135
|
+
keyEntities.push(index);
|
|
136
|
+
} else {
|
|
137
|
+
this.keyEntityIndexBuilder.set(key, [index]);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Finalize the tag index.
|
|
144
|
+
*
|
|
145
|
+
* Compacts arrays and builds the reverse key→entity index.
|
|
146
|
+
* Must be called before `hasKey()`.
|
|
147
|
+
*/
|
|
148
|
+
buildIndex() {
|
|
149
|
+
this.tagStart.compact();
|
|
150
|
+
this.tagCount.compact();
|
|
151
|
+
this.tagKeys.compact();
|
|
152
|
+
this.tagVals.compact();
|
|
153
|
+
|
|
154
|
+
// Convert the builder map to flat arrays for the reverse index
|
|
155
|
+
for (const [keyIndex, entityIndexes] of this.keyEntityIndexBuilder) {
|
|
156
|
+
this.keyIndexStart.set(keyIndex, this.keyEntities.length);
|
|
157
|
+
this.keyIndexCount.set(keyIndex, entityIndexes.length);
|
|
158
|
+
this.keyEntities.pushMany(entityIndexes);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.keyIndexStart.compact();
|
|
162
|
+
this.keyIndexCount.compact();
|
|
163
|
+
this.keyEntityIndexBuilder.clear();
|
|
164
|
+
|
|
165
|
+
this.indexBuilt = true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Check if the index is built and ready for use.
|
|
170
|
+
*/
|
|
171
|
+
isReady() {
|
|
172
|
+
return this.indexBuilt;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get the number of tags for an entity.
|
|
177
|
+
*/
|
|
178
|
+
cardinality(index: number): number {
|
|
179
|
+
return this.tagCount.at(index) ?? 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get the tags for an entity.
|
|
184
|
+
*/
|
|
185
|
+
getTags(index: number): OsmTags | undefined {
|
|
186
|
+
const tagCount = this.tagCount.at(index) ?? 0;
|
|
187
|
+
if (tagCount === 0) return;
|
|
188
|
+
const tagStart = this.tagStart.at(index) ?? 0;
|
|
189
|
+
const tagKeyIndexes = this.tagKeys.array.slice(tagStart, tagStart + tagCount);
|
|
190
|
+
const tagValIndexes = this.tagVals.array.slice(tagStart, tagStart + tagCount);
|
|
191
|
+
const tags: OsmTags = {};
|
|
192
|
+
for (let i = 0; i < tagCount; i++) {
|
|
193
|
+
const keyIndex = tagKeyIndexes[i];
|
|
194
|
+
const valIndex = tagValIndexes[i];
|
|
195
|
+
if (keyIndex === undefined || valIndex === undefined)
|
|
196
|
+
throw Error("Tag key or value not found");
|
|
197
|
+
tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex);
|
|
198
|
+
}
|
|
199
|
+
return tags;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get tags from key and value indexes.
|
|
204
|
+
*/
|
|
205
|
+
getTagsFromIndices(keys: number[], values: number[]): OsmTags {
|
|
206
|
+
const tags: OsmTags = {};
|
|
207
|
+
for (let i = 0; i < keys.length; i++) {
|
|
208
|
+
const keyIndex = keys[i];
|
|
209
|
+
const valIndex = values[i];
|
|
210
|
+
if (keyIndex === undefined || valIndex === undefined)
|
|
211
|
+
throw Error("Tag key or value not found");
|
|
212
|
+
tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex);
|
|
213
|
+
}
|
|
214
|
+
return tags;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Find the index of a tag key.
|
|
219
|
+
*/
|
|
220
|
+
find(key: string): number {
|
|
221
|
+
return this.stringTable.find(key);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Get all entity indexes that have a specific tag key.
|
|
226
|
+
*/
|
|
227
|
+
hasKey(keyIndex: number): number[] {
|
|
228
|
+
if (keyIndex < 0) return [];
|
|
229
|
+
const start = this.keyIndexStart.at(keyIndex) ?? 0;
|
|
230
|
+
const count = this.keyIndexCount.at(keyIndex) ?? 0;
|
|
231
|
+
return Array.from(this.keyEntities.array.subarray(start, start + count));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Create a unique composite index for a key=value pair.
|
|
236
|
+
* Uses row-major indexing: `key * width + val`.
|
|
237
|
+
*/
|
|
238
|
+
kvToIndex(key: number, val: number) {
|
|
239
|
+
const width = this.stringTable.length;
|
|
240
|
+
return key * width + val;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get transferable objects for passing to another thread.
|
|
245
|
+
*/
|
|
246
|
+
transferables(): TagsTransferables {
|
|
247
|
+
return {
|
|
248
|
+
tagStart: this.tagStart.array.buffer,
|
|
249
|
+
tagCount: this.tagCount.array.buffer,
|
|
250
|
+
tagKeys: this.tagKeys.array.buffer,
|
|
251
|
+
tagVals: this.tagVals.array.buffer,
|
|
252
|
+
keyEntities: this.keyEntities.array.buffer,
|
|
253
|
+
keyIndexStart: this.keyIndexStart.array.buffer,
|
|
254
|
+
keyIndexCount: this.keyIndexCount.array.buffer,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Get the approximate memory requirements for a given number of tags in bytes.
|
|
260
|
+
*/
|
|
261
|
+
static getBytesRequired(count: number) {
|
|
262
|
+
return (
|
|
263
|
+
count * Uint32Array.BYTES_PER_ELEMENT + // tagStart
|
|
264
|
+
count * Uint8Array.BYTES_PER_ELEMENT // tagCount
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Reconstruct a Tags index from transferable objects.
|
|
270
|
+
*/
|
|
271
|
+
static fromTransferables(stringTable: StringTable, transferables: TagsTransferables) {
|
|
272
|
+
const tagIndex = new Tags(stringTable, transferables);
|
|
273
|
+
tagIndex.indexBuilt = true;
|
|
274
|
+
return tagIndex;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Update a ContentHasher with the tags data.
|
|
279
|
+
* Hashes tag keys and values for each entity.
|
|
280
|
+
*/
|
|
281
|
+
updateHash(hasher: ContentHasher): ContentHasher {
|
|
282
|
+
return hasher
|
|
283
|
+
.update(this.tagStart.array)
|
|
284
|
+
.update(this.tagCount.array)
|
|
285
|
+
.update(this.tagKeys.array)
|
|
286
|
+
.update(this.tagVals.array);
|
|
287
|
+
}
|
|
296
288
|
}
|