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

storage: Split pkg cloud into cloud interface and cloud impl #50644

Merged
merged 1 commit into from
Jun 27, 2020

Conversation

adityamaru
Copy link
Contributor

Previously, both the ExternalStorage interface and all the specialized
implementations were in pkg/storage/cloud.

This PR moves the interface and factory method signatures to
pkg/storage/cloud and all the implementations to
pkg/storage/cloudimpl. The motivation behind this is to ensure that
other packages such pkg/sql and pkg/kv depend on just the
interface/factory signatures (not the concrete impl) to prevent
dependency cycles.

More concreteley, we need to plumb an InternalExecutor and kv.DB for our
new user scoped file-table storage. This was previously not possible
because of a pkg/sql -> pkg/storage/cloud ->pkg/sql cycle. Now, since
the executor will be used in cloudimpl this cycle will not occur.

Informs: #47211

Release note: None

@adityamaru adityamaru requested review from a team and pbardea and removed request for a team June 25, 2020 13:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@adityamaru adityamaru requested review from dt and miretskiy and removed request for pbardea June 25, 2020 13:39
@adityamaru
Copy link
Contributor Author

I will rebase once #50493 is merged. I just wanted to get a CI run in to make sure I haven't botched up the move.

@adityamaru adityamaru force-pushed the split-interface-concrete-cloud branch from 391b52a to 26aa14e Compare June 25, 2020 14:24
Copy link
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

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

Reviewed 38 of 38 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @adityamaru and @dt)


pkg/storage/cloud/external_storage.go, line 19 at r2 (raw file):

// ExternalStorage provides functions t

You should update the comment "ExternalStorage provides API..."
Also make it very clear that this file should not have any implementation code -- it's for interfaces only.

@adityamaru adityamaru force-pushed the split-interface-concrete-cloud branch from 26aa14e to 35f3ac7 Compare June 26, 2020 14:22
Copy link
Contributor Author

@adityamaru adityamaru left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dt and @miretskiy)


pkg/storage/cloud/external_storage.go, line 19 at r2 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…
// ExternalStorage provides functions t

You should update the comment "ExternalStorage provides API..."
Also make it very clear that this file should not have any implementation code -- it's for interfaces only.

done.


pkg/testutils/lint/lint_test.go, line 441 at r4 (raw file):

cloudimpl

@miretskiy fyi I had to update the lint allow list for using os.getEnv

@adityamaru adityamaru force-pushed the split-interface-concrete-cloud branch from 35f3ac7 to 6df4be3 Compare June 26, 2020 20:09
Previously, both the ExternalStorage interface and all the specialized
implementations were in `pkg/storage/cloud`.

This PR moves the interface and factory method signatures to
`pkg/storage/cloud` and all the implementations to
`pkg/storage/cloudimpl`.  The motivation behind this is to ensure that
other packages such `pkg/sql` and `pkg/kv` depend on just the
interface/factory signatures (not the concrete impl) to prevent
dependency cycles.

More concreteley, we need to plumb an InternalExecutor and kv.DB for our
new user scoped file-table storage. This was previously not possible
because of a `pkg/sql -> pkg/storage/cloud ->pkg/sql` cycle. Now, since
the executor will be used in `cloudimpl` this cycle will not occur.

Release note: None
@adityamaru adityamaru force-pushed the split-interface-concrete-cloud branch from 6df4be3 to 1eaeed8 Compare June 27, 2020 00:22
@adityamaru
Copy link
Contributor Author

TFTR!

bors r=miretskiy

@craig
Copy link
Contributor

craig bot commented Jun 27, 2020

Build succeeded

@craig craig bot merged commit c627e34 into cockroachdb:master Jun 27, 2020
@adityamaru adityamaru deleted the split-interface-concrete-cloud branch June 29, 2020 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants