-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ledger: move pieces of accountdb.go into a storage package #4776
Conversation
@@ -0,0 +1,702 @@ | |||
package store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reviewers:
98% of the changes originate here.
Moving this structs to be public, and some of their fields in turn to be public caused a lot of upercasing changes all across the ledger package.
58103b8
to
c6017d8
Compare
Codecov Report
@@ Coverage Diff @@
## master #4776 +/- ##
==========================================
- Coverage 54.63% 54.20% -0.44%
==========================================
Files 417 419 +2
Lines 53734 53734
==========================================
- Hits 29358 29126 -232
- Misses 21940 22225 +285
+ Partials 2436 2383 -53
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A big part of the prev PR was in introducing PersistedAccountData
and etc interfaces and have these types non-exported from the package. Please consider doing the same.
} | ||
|
||
// SetCoreAccountData setter for core account data. | ||
func (ba *BaseAccountData) SetCoreAccountData(ad *ledgercore.AccountData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least move struct type declaration to right above the functions for the type; maybe move the declaration and its functions to a dedicated file, e.g. base_account_data.go
Same for each type and its functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Brain
} | ||
|
||
// AccountsInitDbQueries constructs an AccountsReader backed by sql queries. | ||
func AccountsInitDbQueries(q db.Queryable) (*accountsDbQueries, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's weird that a public function returns a private type. If it returns an instance of an interface then return the interface type? weird public/private mix happens several times below
88ef255
to
2dd380c
Compare
} | ||
|
||
// SetCoreAccountData setter for core account data. | ||
func (ba *BaseAccountData) SetCoreAccountData(ad *ledgercore.AccountData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Brain
@@ -964,29 +988,6 @@ func TestAccountsReencoding(t *testing.T) { | |||
require.NoError(t, err) | |||
} | |||
|
|||
// TestAccountsDbQueriesCreateClose tests to see that we can create the accountsDbQueries and close it. | |||
// it also verify that double-closing it doesn't create an issue. | |||
func TestAccountsDbQueriesCreateClose(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where did this test go to? can't see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I pasted it back here in the wrong location, its a the top of the file now.
I tried taking it out but had some other dependencies that needed moving and decided to bring it back for now.
2dd380c
to
815b0da
Compare
accountdb.go
into a storage package
Summary
Picks up on #4428 but with an incremental approach to the refactoring.
Test Plan
Existing tests, this is code refactor.