Skip to content

Expose the remote driver API structs publicly.#249

Merged
mrjana merged 1 commit intomoby:masterfrom
erikh:expose-api
Jul 29, 2015
Merged

Expose the remote driver API structs publicly.#249
mrjana merged 1 commit intomoby:masterfrom
erikh:expose-api

Conversation

@erikh
Copy link
Copy Markdown
Contributor

@erikh erikh commented Jun 3, 2015

The diff sucks. Sorry in advance.

This exposes the message types formerly in drivers/remote/messages.go and moves it into drivers/remote/api. I have taken some care to pass golint but the comments are lacking, happy to fix this up more if that's desired, just need to know what to say.

The other big thing is that I moved maybeError, an interface that api.Response conforms to, into the other driver file and made getError public. This way they can split between.

@squaremo
Copy link
Copy Markdown
Contributor

squaremo commented Jun 3, 2015

Nice! Thanks Erik. Looks good at a scan, and I'll try it out today.

@squaremo
Copy link
Copy Markdown
Contributor

squaremo commented Jun 3, 2015

Works fine with the weave plugin, and a definite improvement, so 👍

@mapuri
Copy link
Copy Markdown

mapuri commented Jun 3, 2015

LGTM!

Not sure if it's a good idea but just wondering if the file drivers/remote/api/api.go should be part of the drivers/driverapi package, so that all driver implementations (including the native remote driver and the external drivers) just need to import and use the driverapi package from libnetwork? It might also make it easier if we decide to share these structs with the arguments and return values to the methods exposed by driverapi.Driver interface, tahn having to keep parity between the two everytime we add a feature to the driverapi.

@squaremo
Copy link
Copy Markdown
Contributor

squaremo commented Jun 4, 2015

It might also make it easier if we decide to share these structs with the arguments and return values to the methods exposed by driverapi.Driver interface

The driverapi.Driver interface doesn't map straight-forwardly to RPCs, because of the EndpointInfo and JoinInfo arguments. So the structs in remote/api really are particular to the remote driver implementation.

Having said that, it would be nicely to enforce parity of driverapi.Driver and remote/api somehow.

@squaremo
Copy link
Copy Markdown
Contributor

squaremo commented Jun 4, 2015

@erikh Looks like you were beaten to the punch by #241 and #240, which make changes to drivers/remote/messages. Should be an easy update though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you pls move this under netutils package ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep I can!

Michael, I will rebase later today.

-Erik

On Jun 4, 2015, at 5:26 AM, Madhu Venugopal notifications@github.com wrote:

In drivers/remote/api/api.go #249 (comment):

  • HostsPath string
  • ResolvConfPath string
    +}

+// LeaveRequest describes the API for detaching an endpoint from a sandbox.
+type LeaveRequest struct {

  • NetworkID string
  • EndpointID string
    +}

+// LeaveResponse is the answer to LeaveRequest.
+type LeaveResponse struct {

  • Response
    +}

+func toAddr(ipAddr string) (*net.IPNet, error) {
Can you pls move this under netutils package ?


Reply to this email directly or view it on GitHub https://github.com/docker/libnetwork/pull/249/files#r31715215.

@mavenugo
Copy link
Copy Markdown
Contributor

mavenugo commented Jun 9, 2015

@erikh any luck with this ?

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jun 9, 2015

Working on this now.

On Jun 8, 2015, at 7:06 PM, Madhu Venugopal notifications@github.com wrote:

@erikh https://github.com/erikh any luck with this ?


Reply to this email directly or view it on GitHub #249 (comment).

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jun 9, 2015

This should be ready for review. Note that I fudged the merge a little, sorry about that and I hope it's not too much of an issue.

@mrjana
Copy link
Copy Markdown
Contributor

mrjana commented Jul 7, 2015

@erikh Would it be more useful to also make the entire remote driver protocol as a package rather than just exposing the structs for JSON encoding? That way we hide all of plugin management and such from the client code and client code can just send events or react to events defined in terms of interfaces

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jul 7, 2015

@mrjana I could make an attempt, but that's outside the scope of what I wanted to do here. If you want to give me a more detailed example of what you're looking for, I can attempt a plugin harness.

Additionally, I need to deserialize the structs in a versioned way. I don't think an evented system will provide that without a lot of contortion.

@dave-tucker dave-tucker added this to the 0.4 milestone Jul 15, 2015
@dave-tucker
Copy link
Copy Markdown
Contributor

I say we create another issue re: making the remote driver protocol a package. It shouldn't prevent this being merged...
@erikh would you be able to rebase please? would love to get this included in the 0.4 release

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jul 15, 2015

Guys, I don’t even know what happened here, but the rebase was pretty clean and it’s still broken.

I’ll see if I can figure it out tomorrow, but I can’t spend too much time on this.

On Jul 14, 2015, at 7:13 PM, Dave Tucker notifications@github.com wrote:

I say we create another issue re: making the remote driver protocol a package. It shouldn't prevent this being merged...
@erikh https://github.com/erikh would you be able to rebase please? would love to get this included in the 0.4 release


Reply to this email directly or view it on GitHub #249 (comment).

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jul 16, 2015

Got it sorted. PTAL. Note that I moved both the public functions in api into remote as private functions that receive the response structs as the first argument instead of making them the method receiver. This is IMO a little cleaner and that way API carries no code, only structs.

@dave-tucker
Copy link
Copy Markdown
Contributor

Thanks erikh 🍰
/cc @mavenugo @aboch @mrjana

@erikh
Copy link
Copy Markdown
Contributor Author

erikh commented Jul 27, 2015

Anything I can do to move this along? We're already depending on these structs in our netplugin.

@mavenugo
Copy link
Copy Markdown
Contributor

@erikh apologies on the delay. LGTM.
@squaremo, @tomdee , @spikecurtis can you please confirm if this works for you too ?

@mrjana
Copy link
Copy Markdown
Contributor

mrjana commented Jul 29, 2015

LGTM

mrjana added a commit that referenced this pull request Jul 29, 2015
Expose the remote driver API structs publicly.
@mrjana mrjana merged commit 4d6e9ae into moby:master Jul 29, 2015
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How come this is here rather than in driver.go? Alternatively: how come this is here, but the convenience functions for converting back and forth to string are not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oversight, sorry.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well it doesnae hurt ... let's fix it up in post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants