josephg / node-foundationdb

Modern Node.js FoundationDB bindings
Other
116 stars 17 forks source link

Versionstamps don't get filled in tuples with scoped transactions #24

Closed aikoven closed 5 years ago

aikoven commented 5 years ago
const subspace = db.at('some-prefix').withValueEncoding(fdb.encoders.tuple);

const value = await db.doTransaction(async tn => {
  const value = [fdb.tuple.unboundVersionstamp()];
  tn.scopedTo(subspace).setVersionstampedValue('some-key', value);
  return value;
});

If I console.log the value returned from the transaction, I get [{ type: 'unbound versionstamp', code: undefined }]. It seems that the value tuple gets to valsToBake of the scoped transaction, and does not propagate to the root transaction, for which the _exec method is called.

josephg commented 5 years ago

Good catch... I've added your test case and fixed it by refactoring the valsToBake stuff out.

josephg commented 5 years ago

📦 0.9.0 !

aikoven commented 5 years ago

Wow, that was fast! 👏

Thanks for this amazing library!

josephg commented 5 years ago

:) thanks for a great bug report!