Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 263 to 318

Compare

+37 −7 in 6 places
Lines 40–50 at 318 (were 40–45 at 263)
4040 indexVersion?: (version: Published) => void;
4141 /** Version of the selected membership event, independent of later publishes. */
4242 membershipVersion?: (atom: AtomId, version: number) => number | undefined;
43+ /**
44+ * membershipVersion reading the membership pages first, each page once (abso - Performance, 714): for a walk over
45+ * many atoms, such as SharedAdditions. Most atoms have one event, and the page says its version.
46+ */
47+ membershipVersions?: () => (atom: AtomId, version: number) => number | undefined;
4348 readonly name: string;
4449 readonly versions: Published[];
4550 /** Every atom published into this space (for shared, everything in it). */
Lines 63–75 at 318 (were 58–63 at 263)
5863 name,
5964 indexVersion: (version) => indexMembership(storage, prefix, version),
6065 membershipVersion: (atom, version) => membershipEvent(storage, prefix, atom, version)?.version,
66+ membershipVersions: () => {
67+ const pages = new PageReader(storage, prefix);
68+ return (atom, version) => {
69+ const known = pages.versionAt(atom, version);
70+ return known === null ? membershipEvent(storage, prefix, atom, version)?.version : known;
71+ };
72+ },
6173 versions: storedArray(storage, `${prefix}:versions`),
6274 own: new StoredSet(storage, `${prefix}:own`),
6375 publishedIn: new StoredMap(storage, `${prefix}:published`),
Lines 136–154 at 318 (were 124–129 at 263)
124136 }
125137 /** Whether atom is present at version, or undefined when its events must be read. */
126138 presentAt(atom: AtomId, version: number): boolean | undefined {
139+ const code = this.#code(atom);
140+ if (code === undefined || code === MIXED) return undefined;
141+ if (code === NONE) return false;
142+ return version >= code;
143+ }
144+ /** membershipVersion from the page: the version of its only event, or undefined; null when its events must be read. */
145+ versionAt(atom: AtomId, version: number): number | undefined | null {
146+ const code = this.#code(atom);
147+ if (code === undefined || code === MIXED) return null;
148+ if (code === NONE) return undefined;
149+ return version >= code ? code : undefined;
150+ }
151+ #code(atom: AtomId): number | undefined {
127152 this.#kept ??= this.#storage.read(`${this.#prefix}:pages:meta`, "kept") === 1;
128153 if (!this.#kept) return undefined;
129154 const seq = seqOf(atom);
Lines 160–166 at 318 (were 135–144 at 263)
135160 if (this.#pages.size >= 64) this.#pages.delete(this.#pages.keys().next().value!);
136161 this.#pages.set(index, page);
137162 }
138− const code = page[seq % PAGE] ?? NONE;
139− if (code === NONE) return false;
140− if (code === MIXED) return undefined;
141− return version >= code;
163+ return page[seq % PAGE] ?? NONE;
142164 }
143165}
144166
Lines 383–399 at 318 (were 361–370 at 263)
361383 readonly baseVersion: number;
362384 readonly base: ReadonlySet<AtomId>;
363385 readonly current: ReadonlySet<AtomId>;
364− constructor(space: Space, baseVersion: number, base: ReadonlySet<AtomId>, current: ReadonlySet<AtomId>) {
386+ /** `endVersion`: the version `current` is (the newest by default; an earlier one for owed news, news.ts). */
387+ constructor(
388+ space: Space,
389+ baseVersion: number,
390+ base: ReadonlySet<AtomId>,
391+ current: ReadonlySet<AtomId>,
392+ endVersion = last(space),
393+ ) {
365394 super();
366395 if (space.name !== SHARED || !space.membershipVersion) throw Error("shared additions require indexed shared space");
367− this.endVersion = last(space);
396+ this.endVersion = endVersion;
368397 this.space = space;
369398 this.baseVersion = baseVersion;
370399 this.base = base;
Lines 403–412 at 318 (were 374–382 at 263)
374403 return this.current.has(id) && !this.base.has(id);
375404 }
376405 *values(): SetIterator<AtomId> {
406+ const versionOf = this.space.membershipVersions?.() ?? this.space.membershipVersion!;
377407 for (let version = this.baseVersion + 1; version <= this.endVersion; version++) {
378408 for (const id of this.space.versions[version]!.atoms) {
379− if (this.space.membershipVersion!(id, this.endVersion) === version && this.has(id)) yield id;
409+ if (versionOf(id, this.endVersion) === version && this.has(id)) yield id;
380410 }
381411 }
382412 }
MCP
compare on this site's /mcp
CLI
abso diff 263 318 worker/project/spaces.ts --json
JSON
/christopher/abso-core/compare/263..318?file=worker%2Fproject%2Fspaces.ts&format=json