- tensorstore.KvStore.with_transaction(self, transaction: Transaction | None) KvStore
Returns a transaction-bound view of this key-value store.
The returned view may be used to perform transactional read/write operations.
Example
>>> store = await ts.KvStore.open({'driver': 'memory'}) >>> txn = ts.Transaction() >>> await store.with_transaction(txn).write(b'a', b'value') >>> (await store.with_transaction(txn).read(b'a')).value b'value' >>> await txn.commit_async()