Skip to content

Commit

Permalink
fix comments (#13404)
Browse files Browse the repository at this point in the history
Co-authored-by: shota.silagadze <shota.silagadze@taal.com>
  • Loading branch information
shotasilagadze and shotasilagadzetaal authored Jan 13, 2025
1 parent 4053930 commit 9eb0394
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions erigon-lib/kv/kv_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,7 @@ type RoDB interface {
ReadOnly() bool
View(ctx context.Context, f func(tx Tx) error) error

// BeginRo - creates transaction
// tx may be discarded by .Rollback() method
//
// A transaction and its cursors must only be used by a single
// thread (not goroutine), and a thread may only have a single transaction at a time.
// It happen automatically by - because this method calls runtime.LockOSThread() inside (Rollback/Commit releases it)
// By this reason application code can't call runtime.UnlockOSThread() - it leads to undefined behavior.
//
// If this `parent` is non-NULL, the new transaction
// will be a nested transaction, with the transaction indicated by parent
// as its parent. Transactions may be nested to any level. A parent
// transaction and its cursors may not issue any other operations than
// Commit and Rollback while it has active child transactions.
// BeginRo - creates transaction, must not be moved between gorotines
BeginRo(ctx context.Context) (Tx, error)
AllTables() TableCfg
PageSize() datasize.ByteSize
Expand Down Expand Up @@ -291,6 +279,19 @@ type RwDB interface {
Update(ctx context.Context, f func(tx RwTx) error) error
UpdateNosync(ctx context.Context, f func(tx RwTx) error) error

// BeginRw - creates transaction
// tx may be discarded by .Rollback() method
//
// A transaction and its cursors must only be used by a single
// thread (not goroutine), and a thread may only have a single transaction at a time.
// It happen automatically by - because this method calls runtime.LockOSThread() inside (Rollback/Commit releases it)
// By this reason application code can't call runtime.UnlockOSThread() - it leads to undefined behavior.
//
// If this `parent` is non-NULL, the new transaction
// will be a nested transaction, with the transaction indicated by parent
// as its parent. Transactions may be nested to any level. A parent
// transaction and its cursors may not issue any other operations than
// Commit and Rollback while it has active child transactions.
BeginRw(ctx context.Context) (RwTx, error)
BeginRwNosync(ctx context.Context) (RwTx, error)
}
Expand Down

0 comments on commit 9eb0394

Please sign in to comment.