Skip to content
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

refactor: Make db stuff internal/private #291

Merged
merged 4 commits into from
Mar 17, 2022

Conversation

AndrewSisley
Copy link
Contributor

Part of #200

Makes everything in the db package that doesn't need to be public (db.NewDb, Errors, and the Options) private/internal. Had to do a bit of rejigging in the bench package, so watch out for that (results same as develop branch).

godocs now looks like this (godoc -http=:6060 => http://localhost:6060/pkg/github.com/sourcenetwork/defradb/db/):

image

@AndrewSisley AndrewSisley added documentation Improvements or additions to documentation area/db-system Related to the core system related components of the DB refactor This issue specific to or requires *notable* refactoring of existing codebases and components labels Mar 11, 2022
@AndrewSisley AndrewSisley self-assigned this Mar 11, 2022
@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #291 (ba0f343) into develop (764be70) will increase coverage by 1.38%.
The diff coverage is 70.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #291      +/-   ##
===========================================
+ Coverage    63.30%   64.69%   +1.38%     
===========================================
  Files           83       81       -2     
  Lines         9230     9035     -195     
===========================================
+ Hits          5843     5845       +2     
+ Misses        2771     2574     -197     
  Partials       616      616              
Impacted Files Coverage Δ
db/collection_delete.go 58.13% <ø> (ø)
db/collection_update.go 42.10% <50.00%> (ø)
db/db.go 53.84% <64.28%> (+0.80%) ⬆️
db/query.go 43.39% <66.66%> (ø)
db/schema.go 34.14% <66.66%> (ø)
db/collection.go 53.43% <78.94%> (ø)
db/collection_get.go 51.02% <100.00%> (ø)
db/sequence.go 65.11% <100.00%> (ø)
api/http/api.go

db/db_test.go Outdated Show resolved Hide resolved
@AndrewSisley AndrewSisley force-pushed the sisley/refactor/I200-db-internalize branch from 7137e16 to ba0f343 Compare March 11, 2022 19:27
Copy link
Contributor

@orpheuslummis orpheuslummis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Although I suggest adding a comment to the Option type along the lines of

Option is a function that, when applied, configures a field on db

@AndrewSisley
Copy link
Contributor Author

LGTM. Although I suggest adding a comment to the Option type along the lines of

Option is a function that, when applied, configures a field on db

That would be inconsistent with the rest of our public members 😁 - jokes aside though - I think this pattern is pretty common in golang and would not be worth noting atm. Would perhaps be better to leave it as-is until we properly document it with the rest of public members?

@orpheuslummis
Copy link
Contributor

orpheuslummis commented Mar 15, 2022

I think this pattern is pretty common in golang and would not be worth noting atm

Sounds preferable not to over-document idiomatic patterns indeed.

Copy link
Member

@jsimnz jsimnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@AndrewSisley AndrewSisley merged commit 8951302 into develop Mar 17, 2022
@AndrewSisley AndrewSisley deleted the sisley/refactor/I200-db-internalize branch March 17, 2022 04:24
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
* Remove Listen function from db package

* Make Collection struct private

* Remove unused structs

* Make db.DB private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/db-system Related to the core system related components of the DB documentation Improvements or additions to documentation refactor This issue specific to or requires *notable* refactoring of existing codebases and components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants