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

Modularize Block Factory #8499

Merged
merged 4 commits into from
Jan 16, 2025
Merged

Modularize Block Factory #8499

merged 4 commits into from
Jan 16, 2025

Conversation

itaigilo
Copy link
Contributor

Closes #8493.

@itaigilo itaigilo added the exclude-changelog PR description should not be included in next release changelog label Jan 15, 2025
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

github-actions bot commented Jan 15, 2025

E2E Test Results - Quickstart

11 passed

@itaigilo itaigilo marked this pull request as ready for review January 15, 2025 11:30
Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

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

Very clean execution! 💣
Blocking only on the lakefs package import - but please pay attention to the other comment

@@ -18,6 +18,7 @@ import (
"github.com/go-co-op/gocron"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/treeverse/lakefs/modules/block/factory"
Copy link
Member

Choose a reason for hiding this comment

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

🎉

Copy link
Member

Choose a reason for hiding this comment

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

One thing I forgot!
Let's explicitly give it a name to avoid collisions in future factories:

Suggested change
"github.com/treeverse/lakefs/modules/block/factory"
blockfactory "github.com/treeverse/lakefs/modules/block/factory"

Comment on lines 3 to 5
use (
.
)
Copy link
Member

@N-o-Z N-o-Z Jan 15, 2025

Choose a reason for hiding this comment

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

You are importing the lakefs package to the factory module - you need to define it in the work file so it will use the local copy

Suggested change
use (
.
)
use (
.
../../..
)

@@ -23,9 +23,9 @@ import (
"github.com/hashicorp/go-multierror"
lru "github.com/hnlq715/golang-lru"
"github.com/rs/xid"
"github.com/treeverse/lakefs/modules/block/factory"
Copy link
Member

Choose a reason for hiding this comment

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

The run file already imports and instantiate the block adapter, however catalog also instantiates it's own block adapter, this is probably for historical reasons.
Consider - passing the block adapter in run to the catalog New function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I get what you're suggesting -
In the run file, the BuildBlockAdapter is initialized with statsCollector, while in the catalog it isn't, no?

@itaigilo itaigilo requested a review from N-o-Z January 15, 2025 18:11
@@ -23,9 +23,9 @@ import (
"github.com/hashicorp/go-multierror"
lru "github.com/hnlq715/golang-lru"
"github.com/rs/xid"
"github.com/treeverse/lakefs/modules/block/factory"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"github.com/treeverse/lakefs/modules/block/factory"
blockfactory "github.com/treeverse/lakefs/modules/block/factory"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's say this happens, and we have both imports (which we currently don't) -
Why the modules one should be blockfactory and the other just factory?

First, I don't think such convention is currently necessary.
And if it is necessary - please have a convention that reflects the fact that it's a module. I'd say moduleblockfactory, but it's too much.

Bottom line, I think we should leave it for now, since it doesn't make things clearer IMO.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean lets say it happens - we're going to have a module called config/factory when you import both, they will both be factory. One of the will be automatically renamed but I believe the convention should be to explicitly name them!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh, I thought you meant a module and a local with the same name.
Agree.
Updated.

@@ -12,8 +12,8 @@ import (
awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/go-test/deep"
"github.com/spf13/viper"
"github.com/treeverse/lakefs/modules/block/factory"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"github.com/treeverse/lakefs/modules/block/factory"
blockfactory "github.com/treeverse/lakefs/modules/block/factory"

@itaigilo itaigilo requested a review from N-o-Z January 16, 2025 00:10
Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

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

🦖

@itaigilo itaigilo merged commit cf75bce into master Jan 16, 2025
38 checks passed
@itaigilo itaigilo deleted the feature/modularize-block-factory branch January 16, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude-changelog PR description should not be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make block factory a go module
2 participants