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

Issue 7096054: environs/agent: add Change function

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by rog
Modified:
11 years, 3 months ago
Reviewers:
dimitern, mp+143087, niemeyer, fwereade, TheMue
Visibility:
Public.

Description

environs/agent: add Change function This enables independent workers to make changes to the config file without clashing. https://code.launchpad.net/~rogpeppe/juju-core/189-agent-change/+merge/143087 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : environs/agent: add Change function #

Patch Set 3 : environs/agent: add Change function #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+136 lines, -0 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M environs/agent/agent.go View 1 2 2 chunks +32 lines, -0 lines 2 comments Download
M environs/agent/agent_test.go View 3 chunks +102 lines, -0 lines 0 comments Download

Messages

Total messages: 7
rog
Please take a look.
11 years, 3 months ago (2013-01-14 11:41:23 UTC) #1
fwereade
Nice, LGTM.
11 years, 3 months ago (2013-01-14 11:47:54 UTC) #2
dimitern
LGTM
11 years, 3 months ago (2013-01-14 12:31:42 UTC) #3
TheMue
LGTM, nice.
11 years, 3 months ago (2013-01-14 13:39:31 UTC) #4
rog
*** Submitted: environs/agent: add Change function This enables independent workers to make changes to the ...
11 years, 3 months ago (2013-01-14 13:46:34 UTC) #5
niemeyer
https://codereview.appspot.com/7096054/diff/7001/environs/agent/agent.go File environs/agent/agent.go (right): https://codereview.appspot.com/7096054/diff/7001/environs/agent/agent.go#newcode153 environs/agent/agent.go:153: func (c *Conf) Change(mutate func(conf *Conf) error) error { ...
11 years, 3 months ago (2013-01-15 19:09:06 UTC) #6
rog
11 years, 3 months ago (2013-01-16 14:57:55 UTC) #7
https://codereview.appspot.com/7096054/diff/7001/environs/agent/agent.go
File environs/agent/agent.go (right):

https://codereview.appspot.com/7096054/diff/7001/environs/agent/agent.go#newc...
environs/agent/agent.go:153: func (c *Conf) Change(mutate func(conf *Conf)
error) error {
On 2013/01/15 19:09:06, niemeyer wrote:
> A few late comments on this one:
> 
> 1) Not sure if a method is the right choice, given that it completely ignores
> what c is, and overrides it no matter what. A function next to ReadConf
> (ChangeConf?) might be more appropriate. If there's value in seeing the
> end-result of the mutation, it can return the final value instead.
> 
> 2) It must definitely comment that it's racy across processes, since the doc
> makes it sound like it's safe.
> 
> 3) That's more about Conf itself: why isn't Write checking that the
> configuration is correct, instead of requiring an explicit call on Check,
taking
> in account that we wouldn't like a broken configuration.

i think i'll delete the Change method for now, given the issues with it. i only
need it in one place, and i can do the same thing externally there.

with regard to 3), Write *is* checking that the configuration is correct unless
i'm missing something stupid.
Sign in to reply to this message.

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