我最近开始使用交易。但是,我缺少一些文档。
到目前为止,我有一个常规的save
和get
函数正在调用数据存储。我正在测量这些延迟。
在进行事务处理时,我实际上如何使用下面的代码* typescript打入网络(请查看内联注释)
public async transactionTest(key: any, data: any) {
const transaction: DatastoreTransaction = this.datastore.transaction();
await transaction.run();
// is the save already a network call? I would assume that it's not.
transaction.save({
key: key,
data: data
});
// I'm trying to fetch the entity which I've just saved above which is not yet commited
// This works
// I assumed that GET is only a network call,
// does it first try to fetch the objects saved in the transaction?
var entity = await transaction.get(key);
await transaction.commit();
}
事务中的哪些函数实际上执行方法调用,并且值得衡量延迟和错误?
我希望蚂蚁get
或query
。但是save
呢?