-
Notifications
You must be signed in to change notification settings - Fork 363
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
Modularize Block Factory #8499
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ go 1.23 | |
|
||
use ( | ||
. | ||
./modules/block/factory | ||
./webui | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package factory | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/treeverse/lakefs/pkg/block" | ||
"github.com/treeverse/lakefs/pkg/block/factory" | ||
"github.com/treeverse/lakefs/pkg/block/params" | ||
"github.com/treeverse/lakefs/pkg/stats" | ||
) | ||
|
||
func BuildBlockAdapter(ctx context.Context, statsCollector stats.Collector, c params.AdapterConfig) (block.Adapter, error) { | ||
adapter, err := factory.BuildBlockAdapter(ctx, statsCollector, c) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return block.NewMetricsAdapter(adapter), nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/treeverse/lakefs/modules/block/factory | ||
|
||
go 1.23 | ||
|
||
// This module uses the go.work file to get all package dependencies from lakefs |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||||||||||||||
go 1.23 | ||||||||||||||||
|
||||||||||||||||
use ( | ||||||||||||||||
. | ||||||||||||||||
) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I get what you're suggesting - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) - First, I don't think such convention is currently necessary. Bottom line, I think we should leave it for now, since it doesn't make things clearer IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
"github.com/treeverse/lakefs/pkg/batch" | ||||||
"github.com/treeverse/lakefs/pkg/block" | ||||||
"github.com/treeverse/lakefs/pkg/block/factory" | ||||||
"github.com/treeverse/lakefs/pkg/config" | ||||||
"github.com/treeverse/lakefs/pkg/graveler" | ||||||
"github.com/treeverse/lakefs/pkg/graveler/branch" | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"github.com/treeverse/lakefs/pkg/block" | ||||||
"github.com/treeverse/lakefs/pkg/block/factory" | ||||||
"github.com/treeverse/lakefs/pkg/block/gs" | ||||||
"github.com/treeverse/lakefs/pkg/block/local" | ||||||
"github.com/treeverse/lakefs/pkg/config" | ||||||
|
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.
🎉
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.
One thing I forgot!
Let's explicitly give it a name to avoid collisions in future factories: