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

Separate out client v2 package #986

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

ian-shim
Copy link
Contributor

Why are these changes needed?

Instead of suffixing v2, create a separate v2 package under clients

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ian-shim ian-shim marked this pull request as ready for review December 11, 2024 23:51
"github.com/Layr-Labs/eigenda/api/clients"
"github.com/prometheus/client_golang/prometheus"

clients "github.com/Layr-Labs/eigenda/api/clients/v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

how about using "github.com/Layr-Labs/eigenda/api/v2/clients" instead? This way we don't need this renaming on every import.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this would prob be a much bigger refactor though right?
Would have been nice from the getgo if the entire api was versioned, but I see that every single package inside api has its own v2 packages. Is there a lot of code sharing between the v1 and v2 packages? If not, perhaps we could consider versioning the entire api?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this would be a big refactor to do just within the api package.
Yes, it would be more difficult to do this in other packages because there's a lot of sharing

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be very nice to do, but don't have enough context on everything in the api package, and whether this refactor would make sense with the rest of the code in this repo.

@@ -1,4 +1,4 @@
package clients
package v2
Copy link
Contributor

Choose a reason for hiding this comment

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

How about keeping the package name clients here?
Its typical for golang modules to use an "invisible" version suffix (this is actually part of how golang's algo does version management). See for eg this urfave example: https://github.com/urfave/cli/blob/main/examples/example-cli/example-cli.go (imported as cli/v3, but module is just used as cli., not v3. which would be awkward).

I'm not sure if its typical to do the same thing for packages, but I feel like it would be cleaner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To do this, don't you need to version the entire module (like here in your example)?

Copy link
Contributor

Choose a reason for hiding this comment

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

No I'm just saying leave the directory structure the same (api/clients/v2/.*.go), but name the package clients (package can be named different than the directory).

Comment on lines +19 to +25
type DisperserClientConfig struct {
Hostname string
Port string
UseSecureGrpcFlag bool
}

type DisperserClientV2 interface {
type DisperserClient interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep the package name clients, then we could simplify these to clients.DisperserConfig and clients.Disperser.

Copy link
Contributor

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

Approving so we can move on with our lives, although let's keep in mind a future move to versioning the entire api package (api/v2/...).
I'd also still vote for clients.Disperser instead of clients.DisperserClient but I'm fine if people like the more verbose version.

@ian-shim ian-shim merged commit b7fe161 into Layr-Labs:master Dec 16, 2024
6 checks passed
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.

4 participants