Skip to content

Commit

Permalink
rename MakeOnlineAccountsIter => MakeOrderedOnlineAccountsIter
Browse files Browse the repository at this point in the history
  • Loading branch information
cce committed Jan 29, 2025
1 parent 3e5f8da commit 24ae93a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ledger/acctonline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ func TestAcctOnlineVotersLongerHistory(t *testing.T) {
var foundCount int
err = oa.dbs.Snapshot(func(ctx context.Context, tx trackerdb.SnapshotScope) error {
// read staging = false, excludeBefore = excludeRound
it, err2 := tx.MakeOnlineAccountsIter(ctx, false, excludeRound)
it, err2 := tx.MakeOrderedOnlineAccountsIter(ctx, false, excludeRound)
require.NoError(t, err2)
defer it.Close()

Expand Down
2 changes: 1 addition & 1 deletion ledger/catchpointfilewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (cw *catchpointFileWriter) readDatabaseStep(ctx context.Context) error {
if cw.params.EnableCatchpointsWithOnlineAccounts && !cw.onlineAccountsDone {
// Create the OnlineAccounts iterator JIT
if cw.onlineAccountRows == nil {
rows, err := cw.tx.MakeOnlineAccountsIter(ctx, false, cw.onlineExcludeBefore)
rows, err := cw.tx.MakeOrderedOnlineAccountsIter(ctx, false, cw.onlineExcludeBefore)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions ledger/catchpointfilewriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,9 @@ assert
t.Log("DB round generator", genDBRound, "validator", valDBRound)
t.Log("Latest round generator", genLatestRound, "validator", valLatestRound)

genOAHash, genOARows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOnlineAccountsIter, 0, false)
genOAHash, genOARows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOrderedOnlineAccountsIter, 0, false)
require.NoError(t, err)
valOAHash, valOARows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOnlineAccountsIter, 0, false)
valOAHash, valOARows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOrderedOnlineAccountsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genOAHash, valOAHash)
require.NotZero(t, genOAHash)
Expand All @@ -1222,7 +1222,7 @@ assert
l := testNewLedgerFromCatchpoint(t, dl.generator.trackerDB(), catchpointFilePath)
defer l.Close()

catchpointOAHash, catchpointOARows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOnlineAccountsIter, 0, false)
catchpointOAHash, catchpointOARows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOrderedOnlineAccountsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genOAHash, catchpointOAHash)
t.Log("catchpoint onlineaccounts hash", catchpointOAHash, "matches")
Expand Down
2 changes: 1 addition & 1 deletion ledger/catchpointtracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (ct *catchpointTracker) finishFirstStage(ctx context.Context, dbRound basic
// Generate hashes of the onlineaccounts and onlineroundparams tables.
err := ct.dbs.Snapshot(func(ctx context.Context, tx trackerdb.SnapshotScope) error {
var dbErr error
onlineAccountsHash, _, dbErr = calculateVerificationHash(ctx, tx.MakeOnlineAccountsIter, onlineExcludeBefore, false)
onlineAccountsHash, _, dbErr = calculateVerificationHash(ctx, tx.MakeOrderedOnlineAccountsIter, onlineExcludeBefore, false)
if dbErr != nil {
return dbErr

Expand Down
2 changes: 1 addition & 1 deletion ledger/catchupaccessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ func (c *catchpointCatchupAccessorImpl) GetVerifyData(ctx context.Context) (bala
return fmt.Errorf("unable to get state proof verification data: %v", err)
}

onlineAccountsHash, _, err = calculateVerificationHash(ctx, tx.MakeOnlineAccountsIter, 0, true)
onlineAccountsHash, _, err = calculateVerificationHash(ctx, tx.MakeOrderedOnlineAccountsIter, 0, true)
if err != nil {
return fmt.Errorf("unable to get online accounts verification data: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/store/trackerdb/dualdriver/dualdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ func (*reader) MakeKVsIter(ctx context.Context) (trackerdb.KVsIter, error) {
return nil, nil
}

// MakeOnlineAccountsIter implements trackerdb.Reader
func (*reader) MakeOnlineAccountsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// MakeOrderedOnlineAccountsIter implements trackerdb.Reader
func (*reader) MakeOrderedOnlineAccountsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// TODO: catchpoint
return nil, nil
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/store/trackerdb/generickv/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (r *reader) MakeKVsIter(ctx context.Context) (trackerdb.KVsIter, error) {
panic("unimplemented")
}

// MakeOnlineAccountsIter implements trackerdb.Reader
func (r *reader) MakeOnlineAccountsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// MakeOrderedOnlineAccountsIter implements trackerdb.Reader
func (r *reader) MakeOrderedOnlineAccountsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// TODO: catchpoint
panic("unimplemented")
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/store/trackerdb/sqlitedriver/sqlitedriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ func (r *sqlReader) MakeKVsIter(ctx context.Context) (trackerdb.KVsIter, error)
return MakeKVsIter(ctx, r.q)
}

// MakeOnlineAccountsIter implements trackerdb.Reader
func (r *sqlReader) MakeOnlineAccountsIter(ctx context.Context, useStaging bool, excludeBefore basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// MakeOrderedOnlineAccountsIter implements trackerdb.Reader
func (r *sqlReader) MakeOrderedOnlineAccountsIter(ctx context.Context, useStaging bool, excludeBefore basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
return MakeOnlineAccountsIter(ctx, r.q, useStaging, excludeBefore)
}

Expand Down
2 changes: 1 addition & 1 deletion ledger/store/trackerdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type Reader interface {
MakeCatchpointReader() (CatchpointReader, error)
MakeEncodedAccountsBatchIter() EncodedAccountsBatchIter
MakeKVsIter(ctx context.Context) (KVsIter, error)
MakeOnlineAccountsIter(ctx context.Context, useStaging bool, excludeBefore basics.Round) (TableIterator[*encoded.OnlineAccountRecordV6], error)
MakeOrderedOnlineAccountsIter(ctx context.Context, useStaging bool, excludeBefore basics.Round) (TableIterator[*encoded.OnlineAccountRecordV6], error)
MakeOnlineRoundParamsIter(ctx context.Context, useStaging bool, excludeBefore basics.Round) (TableIterator[*encoded.OnlineRoundParamsRecordV6], error)
}

Expand Down

0 comments on commit 24ae93a

Please sign in to comment.