Skip to content

Commit

Permalink
ledger: move catchpoint related methods into a storage package (#4835)
Browse files Browse the repository at this point in the history
  • Loading branch information
icorderi committed Nov 29, 2022
1 parent 3a5e584 commit a00e8a5
Show file tree
Hide file tree
Showing 20 changed files with 793 additions and 752 deletions.
3 changes: 2 additions & 1 deletion cmd/catchpointdump/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/algorand/go-algorand/crypto/merkletrie"
"github.com/algorand/go-algorand/ledger"
"github.com/algorand/go-algorand/ledger/store"
"github.com/algorand/go-algorand/util/db"
)

Expand Down Expand Up @@ -106,7 +107,7 @@ func checkDatabase(databaseName string, outFile *os.File) error {

var stats merkletrie.Stats
err = dbAccessor.Atomic(func(ctx context.Context, tx *sql.Tx) (err error) {
committer, err := ledger.MakeMerkleCommitter(tx, ledgerTrackerStaging)
committer, err := store.MakeMerkleCommitter(tx, ledgerTrackerStaging)
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/catchpointdump/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/algorand/go-algorand/data/transactions/logic"
"github.com/algorand/go-algorand/ledger"
"github.com/algorand/go-algorand/ledger/ledgercore"
"github.com/algorand/go-algorand/ledger/store"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/util/db"
Expand Down Expand Up @@ -318,6 +319,8 @@ func printAccountsDatabase(databaseName string, stagingTables bool, fileHeader l
totals.RewardsLevel)
}
return dbAccessor.Atomic(func(ctx context.Context, tx *sql.Tx) (err error) {
arw := store.NewAccountsSQLReaderWriter(tx)

fmt.Printf("\n")
printDumpingCatchpointProgressLine(0, 50, 0)

Expand Down Expand Up @@ -417,7 +420,7 @@ func printAccountsDatabase(databaseName string, stagingTables bool, fileHeader l
progress++
acctCount++
}
_, err = ledger.LoadAllFullAccounts(context.Background(), tx, balancesTable, resourcesTable, acctCb)
_, err = arw.LoadAllFullAccounts(context.Background(), balancesTable, resourcesTable, acctCb)
if err != nil {
return
}
Expand Down
Loading

0 comments on commit a00e8a5

Please sign in to comment.