Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsk committed Jan 18, 2024
1 parent c577273 commit 9109751
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/txn/b_txn.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package txn

type Txn struct {
update bool
rw bool
beginTs uint64
scheduler *Scheduler
executor *Executor
Expand All @@ -13,9 +13,9 @@ type Txn struct {
snapshot *Snapshot
}

func NewTxn(update bool, beginTs uint64, snap *Snapshot, scheduler *Scheduler, executor *Executor) *Txn {
func NewTxn(rw bool, beginTs uint64, snap *Snapshot, scheduler *Scheduler, executor *Executor) *Txn {
return &Txn{
update: update,
rw: rw,
beginTs: beginTs,
snapshot: snap,
scheduler: scheduler,
Expand All @@ -34,7 +34,7 @@ func (txn *Txn) Rollback() {
}

func (txn *Txn) Get(key []byte) (Value, bool) {
if txn.update {
if txn.rw {
if value, ok := txn.writeSet.Get(key); ok {
return NewValue(value), true
}
Expand All @@ -45,7 +45,7 @@ func (txn *Txn) Get(key []byte) (Value, bool) {
}

func (txn *Txn) Set(key []byte, value []byte) error {
if !txn.update {
if !txn.rw {
return ReadOnlyTxnErr
}

Expand Down

0 comments on commit 9109751

Please sign in to comment.