in src/election.ts [309:327]
private async proclaimInner(buf: Buffer, keyRevision: string | undefined) {
if (!keyRevision) {
this.pendingProclaimation = this.pendingProclaimation ?? getDeferred();
this.value = buf;
return this.pendingProclaimation.promise;
}
const leaseId = await this.lease.grant();
const r = await this.namespace
.if(leaseId, 'Create', '==', keyRevision)
.then(this.namespace.put(leaseId).value(buf).lease(leaseId))
.commit();
this.value = buf;
if (!r.succeeded) {
this.resign().catch(() => undefined);
throw new NotCampaigningError();
}
}