github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/storage/transaction.go (about)

     1  package storage
     2  
     3  import (
     4  	"github.com/onflow/flow-go/fvm/storage/derived"
     5  	"github.com/onflow/flow-go/fvm/storage/logical"
     6  	"github.com/onflow/flow-go/fvm/storage/snapshot"
     7  	"github.com/onflow/flow-go/fvm/storage/state"
     8  )
     9  
    10  type TransactionPreparer interface {
    11  	state.NestedTransactionPreparer
    12  	derived.DerivedTransactionPreparer
    13  }
    14  
    15  type Transaction interface {
    16  	TransactionPreparer
    17  
    18  	// SnapshotTime returns the transaction's current snapshot time.
    19  	SnapshotTime() logical.Time
    20  
    21  	// Finalize convert transaction preparer's intermediate state into
    22  	// committable state.
    23  	Finalize() error
    24  
    25  	// Validate returns nil if the transaction does not conflict with
    26  	// previously committed transactions.  It returns an error otherwise.
    27  	Validate() error
    28  
    29  	// Commit commits the transaction.  If the transaction conflict with
    30  	// previously committed transactions, an error is returned and the
    31  	// transaction is not committed.
    32  	Commit() (*snapshot.ExecutionSnapshot, error)
    33  }