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

Issue 6422049: initial HookQueue implementation

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

Description

initial HookQueue implementation Does not yet support saving/loading/reconciling state, but should correctly handle all known situations in-memory, assuming a sane stream of added RelationUnitsChange events. https://code.launchpad.net/~fwereade/juju-core/relationer-hook-queue/+merge/115731 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : initial HookQueue implementation #

Patch Set 3 : initial HookQueue implementation #

Patch Set 4 : initial HookQueue implementation #

Total comments: 46

Patch Set 5 : initial HookQueue implementation #

Total comments: 20

Patch Set 6 : initial HookQueue implementation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+513 lines, -0 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A worker/relationer/hookqueue.go View 1 2 3 4 5 1 chunk +215 lines, -0 lines 0 comments Download
A worker/relationer/hookqueue_test.go View 1 2 3 4 5 1 chunk +296 lines, -0 lines 0 comments Download

Messages

Total messages: 8
fwereade
Please take a look.
11 years, 9 months ago (2012-07-19 13:12:37 UTC) #1
fwereade
Please take a look.
11 years, 9 months ago (2012-07-19 13:33:29 UTC) #2
fwereade
Please take a look.
11 years, 9 months ago (2012-07-20 13:30:40 UTC) #3
fwereade
Please take a look.
11 years, 9 months ago (2012-07-23 09:56:25 UTC) #4
niemeyer
Ended up a bit longer than I expected, sorry about that. :( https://codereview.appspot.com/6422049/diff/3004/worker/relationer/hookqueue.go File worker/relationer/hookqueue.go ...
11 years, 9 months ago (2012-07-23 16:40:12 UTC) #5
fwereade
Please take a look. https://codereview.appspot.com/6422049/diff/3004/worker/relationer/hookqueue.go File worker/relationer/hookqueue.go (right): https://codereview.appspot.com/6422049/diff/3004/worker/relationer/hookqueue.go#newcode10 worker/relationer/hookqueue.go:10: // the hook. On 2012/07/23 ...
11 years, 9 months ago (2012-07-24 11:00:49 UTC) #6
niemeyer
Some additional trivials and LGTM! Thanks! https://codereview.appspot.com/6422049/diff/3004/worker/relationer/hookqueue.go File worker/relationer/hookqueue.go (right): https://codereview.appspot.com/6422049/diff/3004/worker/relationer/hookqueue.go#newcode112 worker/relationer/hookqueue.go:112: // is ready ...
11 years, 9 months ago (2012-07-24 15:17:17 UTC) #7
fwereade
11 years, 9 months ago (2012-07-24 16:55:20 UTC) #8
*** Submitted:

initial HookQueue implementation

Does not yet support saving/loading/reconciling state, but should correctly
handle all known situations in-memory, assuming a sane stream of added
RelationUnitsChange events.

R=niemeyer
CC=
https://codereview.appspot.com/6422049

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue.go
File worker/relationer/hookqueue.go (right):

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:8: // HookInfo holds details about a relation
hook that will be required
On 2012/07/24 15:17:17, niemeyer wrote:
> Sorry, my bad. I see the sentence is ambiguous now. Can we please invert it to
> make it clear:
> 
> // HookInfo holds details required to execute a relation hook.

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:25: // info holds information about every unit
known to the queue.
On 2012/07/24 15:17:17, niemeyer wrote:
> Might be worth clarifying that known != *in* the queue:
> 
> // info holds information about all units that were added to the
> // queue and haven't had a "depart" event popped. This means the
> // unit may be in info and not currently in the queue itself.

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:56: // Add updates the queue such that the stream
of HookInfos returned from
On 2012/07/24 15:17:17, niemeyer wrote:
> s/HookInfos/HookInfo values/
> 
> Otherwise, nice comment. Doesn't describe the algorithm but tells what it does
> from an API client perspective.

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:57: // next will reflect the state of the
relation according to the supplied
On 2012/07/24 15:17:17, niemeyer wrote:
> s/next/Peek and Pop/

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:94: } else if hook == "changed" {
On 2012/07/24 15:17:17, niemeyer wrote:
> || above?

Ha, yes. Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:107: // Next returns a HookInfo describing the
next hook to run. Subsequent
On 2012/07/24 15:17:17, niemeyer wrote:
> Head + Pop sound better to me.
> 
> With logic equivalent to:
> 
>   foo := foo.Next()
>   bar := foo.Next()
> 
> I'd not expect foo and bar to point to the same thing.
> 
> In fact, this is how mgo works:
> 
>   for iter.Next(&result) { ... }

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:109: // settings of Members (if they have been
updated), until Done is called.
On 2012/07/24 15:17:17, niemeyer wrote:
> It's not clear to me how Members could change. Can we please just talk about
it
> quickly live?

Done.

https://codereview.appspot.com/6422049/diff/10001/worker/relationer/hookqueue...
worker/relationer/hookqueue.go:146: // the previous call to Done.
On 2012/07/24 15:17:17, niemeyer wrote:
> The second part of the condition covers the first part of it.

I'm not quite sure, but I hate that sentence, so I'm happy to change it :).
Sign in to reply to this message.

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