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

Issue 6440050: add new methods to RelationUnit

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+116838
Visibility:
Public.

Description

add new methods to RelationUnit Endpoint is required to construct JUJU_RELATION for the unit agent Relation is also required to construct JUJU_RELATION_ID for the unit agent ReadSettings will be used by the unit agent to read settings for departed units, and occasionally to populate cold settings caches. https://code.launchpad.net/~fwereade/juju-core/more-relation-unit-methods/+merge/116838 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 21

Patch Set 2 : add Id, Name, RemoteSettings to RelationUnit #

Total comments: 6

Patch Set 3 : add Id, Name, RemoteSettings to RelationUnit #

Total comments: 6

Patch Set 4 : add new methods to RelationUnit #

Patch Set 5 : add new methods to RelationUnit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+144 lines, -23 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M state/relation.go View 1 2 3 4 6 chunks +64 lines, -8 lines 0 comments Download
M state/relation_test.go View 1 2 3 4 5 chunks +76 lines, -13 lines 0 comments Download
M state/unit.go View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 8
fwereade
Please take a look.
11 years, 9 months ago (2012-07-26 11:32:25 UTC) #1
niemeyer
Tastes good. Just a few twists to consider: https://codereview.appspot.com/6440050/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/1/state/relation.go#newcode173 state/relation.go:173: // ...
11 years, 9 months ago (2012-07-26 13:22:49 UTC) #2
niemeyer
https://codereview.appspot.com/6440050/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/1/state/relation.go#newcode228 state/relation.go:228: func (ru *RelationUnit) RemoteSettings(unit string) (settings map[string]interface{}, err error) ...
11 years, 9 months ago (2012-07-26 13:24:36 UTC) #3
fwereade
Please take a look. https://codereview.appspot.com/6440050/diff/1/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/1/state/relation.go#newcode173 state/relation.go:173: // Name returns the value ...
11 years, 9 months ago (2012-07-26 14:24:28 UTC) #4
niemeyer
Last round: https://codereview.appspot.com/6440050/diff/5001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/5001/state/relation.go#newcode157 state/relation.go:157: role: ep.RelationRole, Sorry for not realizing this ...
11 years, 9 months ago (2012-07-26 15:15:02 UTC) #5
fwereade
Please take a look. https://codereview.appspot.com/6440050/diff/5001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/5001/state/relation.go#newcode157 state/relation.go:157: role: ep.RelationRole, On 2012/07/26 15:15:02, ...
11 years, 9 months ago (2012-07-26 16:02:45 UTC) #6
niemeyer
LGTM with a few trivials. Thanks! https://codereview.appspot.com/6440050/diff/8001/state/relation.go File state/relation.go (right): https://codereview.appspot.com/6440050/diff/8001/state/relation.go#newcode176 state/relation.go:176: // Endpoint returns ...
11 years, 9 months ago (2012-07-26 18:02:39 UTC) #7
fwereade
11 years, 9 months ago (2012-07-26 19:02:04 UTC) #8
*** Submitted:

add new methods to RelationUnit

Endpoint is required to construct JUJU_RELATION for the unit agent
Relation is also required to construct JUJU_RELATION_ID for the unit agent
ReadSettings will be used by the unit agent to read settings for departed
units, and occasionally to populate cold settings caches.

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

https://codereview.appspot.com/6440050/diff/8001/state/relation.go
File state/relation.go (right):

https://codereview.appspot.com/6440050/diff/8001/state/relation.go#newcode176
state/relation.go:176: // Endpoint returns the relation endpoint associated with
the unit.
On 2012/07/26 18:02:39, niemeyer wrote:
> The previously recommended comment sounds slightly more correct:
> 
> // Endpoint returns the relation endpoint associated with the unit
> // participation in this relation.

...the relation endpoint that defines the unit's participation in the relation.

https://codereview.appspot.com/6440050/diff/8001/state/relation.go#newcode250
state/relation.go:250: if stat, err := ru.st.zk.Exists(path); err != nil {
On 2012/07/26 18:02:39, niemeyer wrote:
> A second roundtrip is a pity. I suggest adding a trivial "existed" flag onto
> *ConfigNode that we explore here in a semi-hackish way for the moment. mstate
> will hopefully get us over it, and if not we add a better mechanism later.

I don't expect to hit this method very often -- only when (1) we want settings
for a unit that is not a relation member (and even then at most once per hook)
and (2) we've just started up a unit agent and have not yet been fed cached
settings by the relation's HookQueue (at most once per process). Given the
expected rarity of those situations, I think it's better to hit zookeeper more
and dirty up ConfigNode less.

https://codereview.appspot.com/6440050/diff/8001/state/relation.go#newcode253
state/relation.go:253: return nil, fmt.Errorf("unit settings do not exist")
On 2012/07/26 18:02:39, niemeyer wrote:
> "settings for unit %q not found in relation %q"

Entities already named in errorContextf.
Sign in to reply to this message.

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