in src/stm.ts [497:527]
private commit(): Promise<void> {
const cmp = new Builder.ComparatorBuilder(this.rawKV, NSApplicator.default);
switch (this.options.isolation) {
case Isolation.SerializableSnapshot:
const earliestMod = this.tx.readSet.earliestModRevision().plus(1).toString();
this.tx.writeSet.addNotChangedChecks(cmp, earliestMod);
this.tx.readSet.addCurrentChecks(cmp);
break;
case Isolation.Serializable:
this.tx.readSet.addCurrentChecks(cmp);
break;
case Isolation.RepeatableReads:
this.tx.readSet.addCurrentChecks(cmp);
break;
case Isolation.ReadCommitted:
break; // none
default:
throw new Error(`Unknown isolation level "${this.options.isolation}"`);
}
this.tx.writeSet.addChanges(cmp);
return cmp
.options(this.options.callOptions)
.commit()
.then(result => {
if (!result.succeeded) {
throw new STMConflictError();
}
});
}