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

Issue 6305107: Add unitScopePath (internal to state)

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

Description

Add unitScopePath (internal to state) This is a very simple type that just wraps some common ZK path operations necessary for managing unit relations; it won't be used *widely*, but it should make a few forthcoming code paths a little clearer (and avoid the python situation in which scope-related code is scattered across several types). https://code.launchpad.net/~fwereade/juju-core/unit-scope/+merge/110839 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 17

Patch Set 2 : Add unitScope (internal to state) #

Patch Set 3 : Add unitScopePath (internal to state) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -10 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/relation.go View 1 2 chunks +53 lines, -0 lines 0 comments Download
M state/relation_test.go View 1 2 chunks +46 lines, -10 lines 0 comments Download

Messages

Total messages: 5
fwereade
Please take a look.
11 years, 10 months ago (2012-06-18 14:49:42 UTC) #1
niemeyer
Idea looks good. Some suggestions: https://codereview.appspot.com/6305107/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6305107/diff/1/state/relation.go#newcode95 state/relation.go:95: // relation that is ...
11 years, 10 months ago (2012-06-19 20:39:36 UTC) #2
fwereade
Please take a look. https://codereview.appspot.com/6305107/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6305107/diff/1/state/relation.go#newcode95 state/relation.go:95: // relation that is located ...
11 years, 10 months ago (2012-06-19 22:41:27 UTC) #3
niemeyer
LGTM https://codereview.appspot.com/6305107/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6305107/diff/1/state/relation.go#newcode95 state/relation.go:95: // relation that is located within a particular ...
11 years, 10 months ago (2012-06-20 00:17:52 UTC) #4
fwereade
11 years, 10 months ago (2012-06-20 06:10:36 UTC) #5
*** Submitted:

Add unitScopePath (internal to state)

This is a very simple type that just wraps some common ZK path operations
necessary for managing unit relations; it won't be used *widely*, but it
should make a few forthcoming code paths a little clearer (and avoid the
python situation in which scope-related code is scattered across several
types).

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

https://codereview.appspot.com/6305107/diff/1/state/relation.go
File state/relation.go (right):

https://codereview.appspot.com/6305107/diff/1/state/relation.go#newcode95
state/relation.go:95: // relation that is located within a particular container.
On 2012/06/20 00:17:52, niemeyer wrote:
> On 2012/06/19 22:41:27, fwereade wrote:
> > On 2012/06/19 20:39:36, niemeyer wrote:
> > > This is a precise description of what the relation scope is.
> > 
> > ...except that the term RelationScope is used to indicate what possible
scope
> > path*s* could be in play in a particular relation. Saying, or implying, that
a
> > relation has one relation scope but multiple relation scope paths strikes me
> as
> > somewhat confusing.
> 
> This is a minor implementation detail that will remain contained here and is
> probably not worth our time arguing, so I'm happy with what you decide.
> 
> Just keep in mind that you're introducing an overlapping term ("unit scope")
> that is unnecessary. We have a very clear idea of what the relation scope is,
> both internally and in external documentation, and it matches your description
> of what a unit scope is exactly.

Heh, quite possibly you'll see an ignominious s/unitScopePath/relationScopePath/
CL at some stage soon, when I see the light; but for now, thanks :).

https://codereview.appspot.com/6305107/diff/1/state/relation.go#newcode121
state/relation.go:121: func (s *unitScope) PrepareJoin(role RelationRole) error
{
On 2012/06/20 00:17:52, niemeyer wrote:
> On 2012/06/19 22:41:27, fwereade wrote:
> > On 2012/06/19 20:39:36, niemeyer wrote:
> > > // create creates the relation scope path and any necessary subpaths.
> > > func (p relationScopePath) create(zk *zookeeper.Conn, roles
[]RelationRole)
> > > error
> > 
> > Much nicer to pass the zk here, thanks. Done.
> > 
> > > The set of roles means we can create all the right nodes at once, without
> > having
> > > to skip bad retries in follow up calls.
> > 
> > But I'm not sure about this. The intent of this method is that a unit agent
> call
> > it prior to joining, to ensure that the parents of the nodes it intends to
> write
> > exist already.
> > 
> > I don't think it's sensible to assume otherwise; and I don't see a cheaper
way
> > of ensuring the nodes' existence than just trying to create them: that's
just
> > one round-trip per node. I don't think it's sane or safe to infer (say) the
> > settings node's existence from the fact of any role node's existence, so one
> way
> > or another we have to check, and I don't see why it would be better to have
up
> > to 2 round-trips per node when we can get everything we need with just one.
> > 
> > Furthermore, making a unit agent directly responsible for creating not only
> the
> > nodes it uses but the nodes that other units might want to use just means
> we're
> > potentially checking/hitting more nodes every time we're about to join.
> > 
> > Are you sure about this?
> 
> I'm not. You clearly have more context than I do. I'm happy with moving your
> way.

Cheers :).
Sign in to reply to this message.

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