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

Issue 6448074: add RelationContext type

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

Description

add RelationContext type The RelationContext manages a single relation's unit settings, as a step towards implementing relation-aware jujuc commands. It exposes features that will be used directly by the relation-get, relation-set, relation-list and relation-ids commands; the interface is designed to allow convenient creation from uniter.RelationState instances, and convenient updates from uniter.HookInfo values. This doesn't yet fit cleanly with the ClientContext type, but integrating the types will have somewhat noisy consequences, so the RelationContext is currently exercised alone. Expect an imminent followup integrating RelationContext into ClientContext as follows: drop LocalUnitName string; add Unit *state.Unit drop RelationName string; add RelationId int keep RemoteUnitName add Relations map[int]*RelationContext, keyed on relation id ...and: change name to HookContext We expect every HookContext to contain full details of all relations the unit is currently participating in, in Relations; this is needed to allow commands like relation-ids and relation-list to run regardless of context. The relation-specific JUJU_RELATION and JUJU_RELATION_ID environment variables (along with JUJU_REMOTE_UNIT where apropriate) would be set when RelationId were valid (ie it must not be -1, and it must bea valid key into Relations). https://code.launchpad.net/~fwereade/juju-core/jujuc-server-relation-context/+merge/117202 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : add RelationContext type #

Total comments: 17

Patch Set 3 : add RelationContext type #

Total comments: 8

Patch Set 4 : add RelationContext type #

Total comments: 4

Patch Set 5 : add RelationContext type #

Unified diffs Side-by-side diffs Delta from patch set Stats (+277 lines, -0 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/jujuc/server/context.go View 1 2 3 4 2 chunks +96 lines, -0 lines 0 comments Download
M cmd/jujuc/server/context_test.go View 1 2 3 2 chunks +179 lines, -0 lines 0 comments Download

Messages

Total messages: 8
fwereade
Please take a look.
11 years, 9 months ago (2012-07-30 01:05:38 UTC) #1
rog
looking nice. minor comments below. https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go File cmd/jujuc/server/context.go (right): https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go#newcode104 cmd/jujuc/server/context.go:104: st *state.State This field ...
11 years, 9 months ago (2012-07-30 09:11:41 UTC) #2
fwereade
Cheers. https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go File cmd/jujuc/server/context.go (right): https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go#newcode115 cmd/jujuc/server/context.go:115: units []string On 2012/07/30 09:11:41, rog wrote: > ...
11 years, 9 months ago (2012-07-30 09:21:00 UTC) #3
fwereade
Please take a look. https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go File cmd/jujuc/server/context.go (right): https://codereview.appspot.com/6448074/diff/2001/cmd/jujuc/server/context.go#newcode104 cmd/jujuc/server/context.go:104: st *state.State On 2012/07/30 09:11:41, ...
11 years, 9 months ago (2012-07-30 13:55:17 UTC) #4
niemeyer
I seem to be missing some of the behavior there, but otherwise find it surprisingly ...
11 years, 9 months ago (2012-07-31 19:56:45 UTC) #5
fwereade
Please take a look. https://codereview.appspot.com/6448074/diff/6001/cmd/jujuc/server/context.go File cmd/jujuc/server/context.go (right): https://codereview.appspot.com/6448074/diff/6001/cmd/jujuc/server/context.go#newcode114 cmd/jujuc/server/context.go:114: units []string On 2012/07/31 19:56:45, ...
11 years, 9 months ago (2012-07-31 20:57:57 UTC) #6
niemeyer
LGTM.. only doc suggestions: https://codereview.appspot.com/6448074/diff/9001/cmd/jujuc/server/context.go File cmd/jujuc/server/context.go (right): https://codereview.appspot.com/6448074/diff/9001/cmd/jujuc/server/context.go#newcode130 cmd/jujuc/server/context.go:130: // WriteSettings persists all changes ...
11 years, 9 months ago (2012-07-31 21:07:23 UTC) #7
fwereade
11 years, 9 months ago (2012-07-31 21:45:40 UTC) #8
*** Submitted:

add RelationContext type

The RelationContext manages a single relation's unit settings, as a step
towards implementing relation-aware jujuc commands. It exposes features that
will be used directly by the relation-get, relation-set, relation-list and
relation-ids commands; the interface is designed to allow convenient
creation from uniter.RelationState instances, and convenient updates from
uniter.HookInfo values.

This doesn't yet fit cleanly with the ClientContext type, but integrating
the types will have somewhat noisy consequences, so the RelationContext is
currently exercised alone. Expect an imminent followup integrating
RelationContext into ClientContext as follows:

  drop LocalUnitName string; add Unit *state.Unit
  drop RelationName string; add RelationId int
  keep RemoteUnitName
  add Relations map[int]*RelationContext, keyed on relation id

...and:

  change name to HookContext

We expect every HookContext to contain full details of all relations the
unit is currently participating in, in Relations; this is needed to allow
commands like relation-ids and relation-list to run regardless of context.
The relation-specific JUJU_RELATION and JUJU_RELATION_ID environment
variables (along with JUJU_REMOTE_UNIT where apropriate) would be set when
RelationId were valid (ie it must not be -1, and it must bea valid key into
Relations).

R=rog, niemeyer
CC=
https://codereview.appspot.com/6448074

https://codereview.appspot.com/6448074/diff/9001/cmd/jujuc/server/context.go
File cmd/jujuc/server/context.go (right):

https://codereview.appspot.com/6448074/diff/9001/cmd/jujuc/server/context.go#...
cmd/jujuc/server/context.go:130: // WriteSettings persists all changes made to
Settings
On 2012/07/31 21:07:23, niemeyer wrote:
> s/Settings/the unit's relation settings./

Done.

https://codereview.appspot.com/6448074/diff/9001/cmd/jujuc/server/context.go#...
cmd/jujuc/server/context.go:138: // ClearCache discards all cached non-member
unit settings, and Settings,
On 2012/07/31 21:07:23, niemeyer wrote:
> // ClearCache discards all cached settings, both for the unit and
> // for the remote members.

Done.
Sign in to reply to this message.

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