Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1589)

Issue 77470043: instance: add hostport selection methods

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by rog
Modified:
10 years, 1 month ago
Reviewers:
mp+211570, natefinch
Visibility:
Public.

Description

instance: add hostport selection methods Theoretically we could call Select*Address and then search through the slice for the right address instead, but doing it this way is more convenient and more efficient. https://code.launchpad.net/~rogpeppe/juju-core/523-instance-select-hostport/+merge/211570 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : instance: add hostport selection methods #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -46 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M instance/address.go View 1 2 chunks +63 lines, -13 lines 0 comments Download
M instance/address_test.go View 2 chunks +94 lines, -33 lines 0 comments Download

Messages

Total messages: 4
rog
Please take a look.
10 years, 1 month ago (2014-03-18 16:15:28 UTC) #1
natefinch
This seems like an overly complex refactoring of the code just to avoid having to ...
10 years, 1 month ago (2014-03-18 17:14:46 UTC) #2
natefinch
On 2014/03/18 17:14:46, nate.finch wrote: > This seems like an overly complex refactoring of the ...
10 years, 1 month ago (2014-03-18 17:28:03 UTC) #3
rog
10 years, 1 month ago (2014-03-18 18:42:59 UTC) #4
On 18 March 2014 17:14,  <nate.finch@gmail.com> wrote:
> This seems like an overly complex refactoring of the code just to avoid
> having to extract a list of addresses from a list of hostports.... lists
> that are probably almost always 1-4 items long.  The code look correct,
> I just don't think it's worth the complexity of creating anonymous
> functions to return the address rather than just making a list of
> addresses when we need to do it with hostports.

That was what I started off doing, but then I realised that
you not only need to extract the addresses - you also need
to map back to the index of the chosen address by scanning
the slice, so you can attach the appropriate port number. That seemed like
it was too much work and a little over-heuristic when
we can do the work directly with a little refactoring.

That's why it turned out like this.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b