Less ceremony around proxied retractions
This commit is contained in:
parent
1f5389b9cd
commit
1cf0d9f89f
19
src/actor.ts
19
src/actor.ts
|
@ -209,15 +209,17 @@ export class Turn {
|
|||
}
|
||||
}
|
||||
|
||||
retract(h: Handle): void {
|
||||
const peer = this.actor.outbound.get(h);
|
||||
if (peer === void 0) return;
|
||||
this._retract(peer, h);
|
||||
retract(h: Handle | undefined): void {
|
||||
if (h !== void 0) {
|
||||
const peer = this.actor.outbound.get(h);
|
||||
if (peer === void 0) return;
|
||||
this._retract(peer, h);
|
||||
}
|
||||
}
|
||||
|
||||
replace(ref: Ref, h: Handle | undefined, assertion: Assertion): Handle {
|
||||
const newHandle = this.assert(ref, assertion);
|
||||
if (h !== void 0) this.retract(h);
|
||||
this.retract(h);
|
||||
return newHandle;
|
||||
}
|
||||
|
||||
|
@ -411,11 +413,8 @@ export function forwarder(t: Turn, ref: Ref): { proxy: Ref, revoker: Ref } {
|
|||
},
|
||||
retract(turn: Turn, handle: Handle): void {
|
||||
if (underlying === null) return;
|
||||
const h = handleMap.get(handle);
|
||||
if (h !== void 0) {
|
||||
turn.retract(h);
|
||||
handleMap.delete(handle);
|
||||
}
|
||||
turn.retract(handleMap.get(handle));
|
||||
handleMap.delete(handle);
|
||||
},
|
||||
message(turn: Turn, body: Assertion): void {
|
||||
if (underlying === null) return;
|
||||
|
|
|
@ -61,11 +61,8 @@ export class Dataspace implements Partial<Entity> {
|
|||
this.handleMap.delete(upstreamHandle);
|
||||
if (this.assertions.change(rec, -1) !== ChangeDescription.PRESENT_TO_ABSENT) return;
|
||||
this.subscriptions.get(rec.label)?.forEach((seen, _peer) => {
|
||||
const downstreamHandle = seen.get(rec);
|
||||
if (downstreamHandle !== void 0) {
|
||||
turn.retract(downstreamHandle);
|
||||
seen.delete(rec);
|
||||
}
|
||||
turn.retract(seen.get(rec));
|
||||
seen.delete(rec);
|
||||
});
|
||||
if (Observe.isClassOf(rec)) {
|
||||
let peerMap = this.subscriptions.get(Observe._.label(rec)!)!;
|
||||
|
|
Loading…
Reference in New Issue