From e89d07c127bb478345c18b6b1f71d5774567f102 Mon Sep 17 00:00:00 2001 From: Ladd Date: Wed, 1 Jan 2025 22:26:51 -0600 Subject: [PATCH] removed old comments --- src/lossy.ts | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/lossy.ts b/src/lossy.ts index 760c1a7..17118b5 100644 --- a/src/lossy.ts +++ b/src/lossy.ts @@ -1,9 +1,6 @@ // We have the lossless transformation of the delta stream. // We want to enable transformations from the lossless view, // into various possible "lossy" views that combine or exclude some information. -// -// We can achieve this via functional expression, encoded as JSON-Logic. -// Fields in the output can be described as transformations import Debug from 'debug'; import {DeltaFilter, DeltaID} from "./delta.js"; @@ -29,9 +26,7 @@ export function valueFromCollapsedDelta( } } -// TODO: Incremental updates of lossy models. For example, with last-write-wins, -// we keep the timeUpdated for each field. A second stage resolver can rearrange -// the data structure to a preferred shape and may discard the timeUpdated info. +// We support incremental updates of lossy models. export class Lossy { deltaFilter?: DeltaFilter; accumulator?: Accumulator; @@ -50,26 +45,18 @@ export class Lossy { } ingestUpdate(id: DomainEntityID, deltaIds: DeltaID[]) { - debug(`[${this.lossless.rhizomeNode.config.peerId}] prior to ingesting update, deltaIds:`, deltaIds); const losslessPartial = this.lossless.viewSpecific(id, deltaIds, this.deltaFilter); - debug(`[${this.lossless.rhizomeNode.config.peerId}] prior to ingesting update, lossless partial:`, - JSON.stringify(losslessPartial, null, 2)); - if (!losslessPartial) return; const latest = this.accumulator || this.initializer(losslessPartial); this.accumulator = this.reducer(latest, losslessPartial); - - debug(`[${this.lossless.rhizomeNode.config.peerId}] after ingesting update, entity ${id} accumulator:`, - JSON.stringify(this.accumulator, null, 2)); } // Using the lossless view of some given domain entities, // apply a filter to the deltas composing that lossless view, // and then apply a supplied resolver function which receives // the filtered lossless view as input. - // resolve(fn?: Resolver | Resolver, entityIds?: DomainEntityID[], deltaFilter?: DeltaFilter): T { resolve(entityIds?: DomainEntityID[]): Result | undefined { if (!entityIds) { entityIds = Array.from(this.lossless.domainEntities.keys()); @@ -81,17 +68,3 @@ export class Lossy { } } -// Generate a rule -// Apply the rule -- When? -// - Maybe we shard a set of deltas and map/reduce the results -- -// We are trying to implement CRDT, so the results -// must be composable to preserve that feature. -// That also seems to imply we want to stick with -// the lossless view until the delta set is chosen -// - So, in general on a set of deltas -// at times which seem opportune -// the results of which can be recorded -// and indexed such that the results can be reused -// i.e. you want to compute the result of a set which -// contains a prior one -