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

Issue 7307128: state: get/set environ constraints

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by fwereade
Modified:
11 years, 2 months ago
Reviewers:
mp+148942, dfc, jameinel, dimitern
Visibility:
Public.

Description

state: get/set environ constraints https://code.launchpad.net/~fwereade/juju-core/state-environ-constraints/+merge/148942 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 14

Patch Set 2 : state: get/set environ constraints #

Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -8 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/constraints.go View 1 2 chunks +52 lines, -0 lines 0 comments Download
M state/open.go View 1 2 chunks +21 lines, -8 lines 0 comments Download
M state/state.go View 1 2 chunks +11 lines, -0 lines 0 comments Download
M state/state_test.go View 1 1 chunk +42 lines, -0 lines 0 comments Download

Messages

Total messages: 6
fwereade
Please take a look.
11 years, 2 months ago (2013-02-17 14:35:54 UTC) #1
dfc
LGTM. https://codereview.appspot.com/7307128/diff/1/state/open.go File state/open.go (right): https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode93 state/open.go:93: defer func() { nice https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode101 state/open.go:101: if _, ...
11 years, 2 months ago (2013-02-18 02:16:05 UTC) #2
jameinel
LGTM https://codereview.appspot.com/7307128/diff/1/state/open.go File state/open.go (right): https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode101 state/open.go:101: if _, err = st.EnvironConfig(); err == nil ...
11 years, 2 months ago (2013-02-18 09:32:32 UTC) #3
dimitern
LGTM. I agree with some of jameinel's comments, and I have some questions as well. ...
11 years, 2 months ago (2013-02-18 10:23:29 UTC) #4
rog
https://codereview.appspot.com/7307128/diff/1/state/open.go File state/open.go (right): https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode101 state/open.go:101: if _, err = st.EnvironConfig(); err == nil { ...
11 years, 2 months ago (2013-02-18 14:03:43 UTC) #5
fwereade
11 years, 2 months ago (2013-02-20 13:00:52 UTC) #6
*** Submitted:

state: get/set environ constraints

R=dfc, jameinel, dimitern, rog
CC=
https://codereview.appspot.com/7307128

https://codereview.appspot.com/7307128/diff/1/state/open.go
File state/open.go (right):

https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode93
state/open.go:93: defer func() {
On 2013/02/18 02:16:05, dfc wrote:
> nice
cheers :)

https://codereview.appspot.com/7307128/diff/1/state/open.go#newcode114
state/open.go:114: if err := st.runner.Run(ops, "", nil); err == txn.ErrAborted
{
On 2013/02/18 10:23:29, dimitern wrote:
> On 2013/02/18 09:32:32, jameinel wrote:
> > Though here you *are* creating a locally defined 'err' object. So probably
we
> > want to be consistent, but I'm not entirely sure of which William was
thinking
> > it would be.
> 
> +1

Wrt the above, it doesn't really matter which I do; I'll go with locally scoped
errs, because they're really not used by the rest of the func (the err seen in
the defer is always the named "err" return, to which any returned error will
have been assigned before the code runs).

https://codereview.appspot.com/7307128/diff/1/state/state_test.go
File state/state_test.go (right):

https://codereview.appspot.com/7307128/diff/1/state/state_test.go#newcode477
state/state_test.go:477: cons1, err := s.State.EnvironConstraints()
On 2013/02/18 09:32:32, jameinel wrote:
> I'm a little confused as to why state.Initialize() is having a side effect on
> s.State 
> Is this because the Environment in the database is being updated?
> Maybe a comment on the 'Initialize' line indicating we are depending on the
side
> effect for later parts of the test.
> // Initialize a new state object to push the environment constraints into the
> database

I thought that was maybe covered by the "Environ constraints are not available
before initialization" comment above?

https://codereview.appspot.com/7307128/diff/1/state/state_test.go#newcode488
state/state_test.go:488: 
On 2013/02/18 09:32:32, jameinel wrote:
> So SetEnvironConstraints completely replaces all constraints, correct? (There
> isn't a function for 'add this constraint' yet)

Yeah, that was how it was in python... maybe set should work more like add, or
maybe we should offer both ops, but for now, and in the absence of anyone having
directly complained about the python way, this is deliberate.

> Would we want a negative assertion that cons3 != cons?

Good idea, thanks.
Sign in to reply to this message.

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