loopdb: provide function NewSqlWriteOpts

It returns transaction options resulting in full (read+write) tx.

Use it in loopdb and instantout stores.
This commit is contained in:
Boris Nagaev 2024-06-14 00:05:27 -03:00
parent 174a6b888b
commit 3fd3fab8d1
No known key found for this signature in database
4 changed files with 20 additions and 12 deletions

View file

@ -323,7 +323,7 @@ type SqliteTxOptions struct {
readOnly bool
}
// NewSqlReadOpts returns a new KeyStoreTxOptions instance triggers a read
// NewSqlReadOpts returns a new KeyStoreTxOptions instance that triggers a read
// transaction.
func NewSqlReadOpts() *SqliteTxOptions {
return &SqliteTxOptions{
@ -331,6 +331,14 @@ func NewSqlReadOpts() *SqliteTxOptions {
}
}
// NewSqlWriteOpts returns a new KeyStoreTxOptions instance that triggers a
// write (regular) transaction.
func NewSqlWriteOpts() *SqliteTxOptions {
return &SqliteTxOptions{
readOnly: false,
}
}
// ReadOnly returns true if the transaction should be read only.
//
// NOTE: This implements the TxOptions interface.