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

Issue 6442088: add uniter.Relationer

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by fwereade
Modified:
11 years, 8 months ago
Reviewers:
mp+118273
Visibility:
Public.

Description

add uniter.Relationer This is a slightly unsatisfying type that emerged fairly naturally from a sketch of a Uniter type that seemed to be going in a nice direction but getting big. I don't think this type is complete yet (lifecycle handling will, I think, force some reasonably significant changes, in time) but it is a useful and self-contained chunk of functionality and IMO worth the propose. Better name suggestions would be appreciated, though. https://code.launchpad.net/~fwereade/juju-core/simple-relationer/+merge/118273 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : add uniter.Relationer #

Total comments: 19

Patch Set 3 : add uniter.Relationer #

Unified diffs Side-by-side diffs Delta from patch set Stats (+419 lines, -5 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M worker/uniter/hookqueue.go View 2 chunks +2 lines, -2 lines 0 comments Download
M worker/uniter/hookqueue_test.go View 1 chunk +3 lines, -3 lines 0 comments Download
A worker/uniter/relationer.go View 1 2 1 chunk +106 lines, -0 lines 0 comments Download
A worker/uniter/relationer_test.go View 1 2 1 chunk +306 lines, -0 lines 0 comments Download

Messages

Total messages: 5
fwereade
Please take a look.
11 years, 8 months ago (2012-08-05 23:48:33 UTC) #1
fwereade
Please take a look.
11 years, 8 months ago (2012-08-06 14:33:56 UTC) #2
dave_cheney.net
> Better name suggestions would be appreciated, though. Relater Relationshiper Lovedoctor
11 years, 8 months ago (2012-08-06 22:25:24 UTC) #3
niemeyer
LGTM. A few comments below. Please ping me in case some of it feels crackful. ...
11 years, 8 months ago (2012-08-07 13:47:18 UTC) #4
fwereade
11 years, 8 months ago (2012-08-07 14:53:21 UTC) #5
*** Submitted:

add uniter.Relationer

This is a slightly unsatisfying type that emerged fairly naturally from a
sketch of a Uniter type that seemed to be going in a nice direction but
getting big. I don't think this type is complete yet (lifecycle handling
will, I think, force some reasonably significant changes, in time) but it
is a useful and self-contained chunk of functionality and IMO worth the
propose.

Better name suggestions would be appreciated, though.

R=dfc, niemeyer
CC=
https://codereview.appspot.com/6442088

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go
File worker/uniter/relationer.go (right):

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:11: // to changes in, a relation.
On 2012/08/07 13:47:18, niemeyer wrote:
> 
> // Relationer manages a unit's presence in a relation.
> 
> The reactions bit is part of that.

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:22: // its presence, and will not respond to
relation changes, until asked.
On 2012/08/07 13:47:18, niemeyer wrote:
> // NewRelationer returns a new Relationer. The unit will not join the relation
> // until explicitly requested.

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:34: // panic if it is called while its Pinger is
active.
On 2012/08/07 13:47:18, niemeyer wrote:
> We documented that in RelationUnit as something higher level, in terms of the
> unit joining the relation. To avoid going back and forth between presence and
> unit-oriented nomenclature, I suggest something along the lines of:
> 
> // Join starts the periodic signaling of the unit's presence in the relation.
> // It must not be called again until Abandon or Depart are called.

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:69: // presence in the relation. It does *not*
remove the presence node.
On 2012/08/07 13:47:18, niemeyer wrote:
> Along similar lines:
> 
> // Abandon stops the periodic signaling of the unit's presence in the
> // relation. It must not be called again until Join is called again.
> // Abandoning doesn't immediately signal to other units that the unit
> // has departed. See also the Depart method.
> 
> (then, I guess we need Depart?)

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:80: // when running hooks.
On 2012/08/07 13:47:18, niemeyer wrote:
> // Context returns the RelationContext associated with r.

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer.go#...
worker/uniter/relationer.go:85: // PrepareHook ensures that the hook is valid,
and that the relation context
On 2012/08/07 13:47:18, niemeyer wrote:
> Might be good to expand a bit on what "valid" means here. It's not actually
> about the hook itself, as I understand it, but rather about whether it makes
> sense to call the provided hook at this point. (I guess?)

Done.

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer_tes...
File worker/uniter/relationer_test.go (right):

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer_tes...
worker/uniter/relationer_test.go:77: assertDeparted(c, w)
On 2012/08/07 13:47:18, niemeyer wrote:
> How can this be working given that StopPresence/Abandon doesn't kill the
pinger?

Long timeout, sufficient to detect abandonment. I'm not sure there's a better
way to do that, but I'm always glad to learn ;).

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer_tes...
worker/uniter/relationer_test.go:115: HookKind:   "joined",
On 2012/08/07 13:47:18, niemeyer wrote:
> Ohh.. this is starting to feel so nice. :-)

:D

https://codereview.appspot.com/6442088/diff/3001/worker/uniter/relationer_tes...
worker/uniter/relationer_test.go:281: case <-time.After(500 * time.Millisecond):
On 2012/08/07 13:47:18, niemeyer wrote:
> Feels like a long time to wait for successful completion. Each 2 of those slow
> the test suite by a second.

Done.
Sign in to reply to this message.

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