|
@@ -269,53 +269,6 @@ export abstract class Edge extends PrimitiveDelta {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// // An Edge that does not yet have a target
|
|
|
-// export class NewEdge extends Edge {
|
|
|
-// readonly after: readonly ReadAllOutgoing[];
|
|
|
-
|
|
|
-// constructor(source: NodeCreation, label: string, after: readonly ReadAllOutgoing[]) {
|
|
|
-// super(source, label);
|
|
|
-// this.after = after;
|
|
|
-// }
|
|
|
-
|
|
|
-// getDependencies(): readonly [Delta,string][] {
|
|
|
-// return [
|
|
|
-// [this.source, "SRC"],
|
|
|
-// ...this.after.map(a => [a, "A"] as [Delta,string]),
|
|
|
-// ];
|
|
|
-// }
|
|
|
-
|
|
|
-// serialize() {
|
|
|
-// return {
|
|
|
-// type: "NewEdge",
|
|
|
-// source: this.source.hash.toString('hex'),
|
|
|
-// label: this.label,
|
|
|
-// };
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// An Edge that has been assigned a target (by an EdgeUpdate) at least once.
|
|
|
-// export class ExistingEdge extends Edge {
|
|
|
-// // the delta being overwritten
|
|
|
-// readonly delta: EdgeUpdate;
|
|
|
-
|
|
|
-// constructor(source: NodeCreation, label: string, delta: EdgeUpdate) {
|
|
|
-// super(source, label);
|
|
|
-// this.delta = delta;
|
|
|
-// }
|
|
|
-
|
|
|
-// getDependencies(): readonly [Delta,string][] {
|
|
|
-// return [[this.delta, "U"]];
|
|
|
-// }
|
|
|
-
|
|
|
-// serialize() {
|
|
|
-// return {
|
|
|
-// type: "ExistingEdge",
|
|
|
-// overwrites: this.delta.hash.toString('hex'),
|
|
|
-// };
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
export class EdgeCreation extends Edge {
|
|
|
// Dependencies:
|
|
|
readonly after: readonly ReadAllOutgoing[];
|
|
@@ -346,6 +299,7 @@ export class EdgeCreation extends Edge {
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
export class EdgeUpdate extends Edge {
|
|
|
// Dependencies
|
|
|
readonly overwrites: Edge;
|
|
@@ -364,8 +318,6 @@ export class EdgeUpdate extends Edge {
|
|
|
this.reads = reads;
|
|
|
this.afterReads = afterReads;
|
|
|
|
|
|
- // this.overwritable = new ExistingEdge(overwrites.source, overwrites.label, this);
|
|
|
-
|
|
|
// Register our dependencies' inverse dependencies + detect conflicts:
|
|
|
overwrites.registerWrite(this);
|
|
|
target.registerDependency(this);
|
|
@@ -449,8 +401,8 @@ export class TargetValue implements Target {
|
|
|
// One of the possibilities explored was to have a separate delta for Reading an Edge.
|
|
|
// Problem is that deltas have content-based IDs, and all concurrent Reads (of the same Write) would be identical.
|
|
|
// If two EdgeUpdates both read the same value, but one of them also overwrites this value, then there would not be a R/U conflict because they both perform the 'same' Read (same ID), but there should really be a conflict.
|
|
|
-// To solve this issue, every Read would need an additional unique ID attribute, but this is overkill: two concurrent identical EdgeUpdates that depend on an identical Read, would then become different (conflicting) operations.
|
|
|
-// So I conclude that it's better for a Reads to really just be dependencies of EdgeUpdates.
|
|
|
+// To solve this issue, every Read would need an additional unique ID attribute, but this is overkill: two concurrent identical EdgeUpdates that depend on an identical Read, would then become different (conflicting) operations, while they do exactly the same thing.
|
|
|
+// So I conclude that it's better for Reads to really just be dependencies of EdgeUpdates.
|
|
|
|
|
|
// export class EdgeRead extends PrimitiveDelta {
|
|
|
// // Every read has a unique ID (otherwise, different concurrent reads would be represented by the same delta)
|