Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(477)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 12551043: state: implement the single FindEntity method

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by rog
Modified:
12 years, 5 months ago
Reviewers:
dimitern , mp+178825, gz
Visibility:
Public.
state: implement the single FindEntity method We rely on clients to do the type conversions themselves if they want, rather than trying to second-guess every possible interface that a they might want to use. Create a new state/interface.go file to hold interfaces that entities can conform to. https://code.launchpad.net/~rogpeppe/juju-core/363-agent-entity/+merge/178825 Requires: https://code.launchpad.net/~rogpeppe/juju-core/362-names-parse-tag/+merge/178619 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: implement the single FindEntity method #

Total comments: 9

Patch Set 3 : state: implement the single FindEntity method #

Patch Set 4 : state: implement the single FindEntity method #

Patch Set 5 : state: implement the single FindEntity method #

Patch Set 6 : state: implement the single FindEntity method #

Patch Set 7 : state: implement the single FindEntity method #

Total comments: 3

Patch Set 8 : state: implement the single FindEntity method #

Patch Set 9 : state: implement the single FindEntity method #

Total comments: 2
Created: 12 years, 5 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+520 lines, -653 lines) Patch
A [revision details] View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/jujud/agent_test.go View 2 chunks +1 line, -9 lines 0 comments Download
M names/tag.go View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M names/tag_test.go View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M state/apiserver/admin.go View 3 chunks +6 lines, -2 lines 0 comments Download
M state/apiserver/agent/agent.go View 1 chunk +6 lines, -1 line 0 comments Download
M state/apiserver/client/api_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M state/apiserver/client/client.go View 1 chunk +17 lines, -4 lines 0 comments Download
M state/apiserver/client/client_test.go View 5 1 chunk +5 lines, -1 line 0 comments Download
M state/apiserver/common/ensuredead.go View 1 2 3 4 5 2 chunks +8 lines, -12 lines 0 comments Download
M state/apiserver/common/ensuredead_test.go View 1 2 3 4 5 5 chunks +11 lines, -28 lines 0 comments Download
M state/apiserver/common/errors.go View 1 chunk +15 lines, -0 lines 2 comments Download
M state/apiserver/common/life.go View 2 chunks +15 lines, -11 lines 0 comments Download
M state/apiserver/common/life_test.go View 1 2 5 chunks +10 lines, -28 lines 0 comments Download
M state/apiserver/common/password.go View 2 chunks +7 lines, -7 lines 0 comments Download
M state/apiserver/common/password_test.go View 1 2 5 chunks +42 lines, -18 lines 0 comments Download
M state/apiserver/common/remove.go View 1 2 3 4 5 1 chunk +13 lines, -13 lines 0 comments Download
M state/apiserver/common/remove_test.go View 1 2 5 chunks +12 lines, -30 lines 0 comments Download
M state/apiserver/common/setstatus.go View 2 chunks +8 lines, -12 lines 0 comments Download
M state/apiserver/common/setstatus_test.go View 1 2 3 4 5 8 chunks +24 lines, -31 lines 0 comments Download
M state/apiserver/common/watch.go View 1 2 3 4 5 2 chunks +8 lines, -12 lines 0 comments Download
M state/apiserver/common/watch_test.go View 1 2 3 4 5 7 chunks +11 lines, -27 lines 0 comments Download
M state/apiserver/root.go View 2 chunks +7 lines, -2 lines 0 comments Download
M state/apiserver/upgrader/upgrader.go View 3 chunks +22 lines, -9 lines 0 comments Download
M state/apiserver/utils.go View 2 chunks +3 lines, -3 lines 0 comments Download
M state/assign_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/initialize_test.go View 2 chunks +3 lines, -2 lines 0 comments Download
A state/interface.go View 1 2 3 1 chunk +149 lines, -0 lines 0 comments Download
M state/machine.go View 1 chunk +0 lines, -2 lines 0 comments Download
M state/state.go View 1 2 3 4 5 6 7 8 3 chunks +9 lines, -213 lines 0 comments Download
M state/state_test.go View 1 2 3 4 5 6 7 4 chunks +92 lines, -170 lines 0 comments Download
M state/unit.go View 1 chunk +0 lines, -2 lines 0 comments Download
Total messages: 8
|
rog
Please take a look.
12 years, 5 months ago (2013年08月06日 17:59:26 UTC) #1
Please take a look.
Sign in to reply to this message.
dimitern
Looks really good, but I'm concerned about some test cases in apiserver/common being removed. Also ...
12 years, 5 months ago (2013年08月07日 09:13:09 UTC) #2
Looks really good, but I'm concerned about some test cases in apiserver/common
being removed. Also needs merging trunk changes in.
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life...
File state/apiserver/common/life_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life...
state/apiserver/common/life_test.go:55: "x3": {err: fmt.Errorf("x3 error")},
Please, do not remove this case.
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
File state/apiserver/common/remove.go (right):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
state/apiserver/common/remove.go:28: func (r *Remover) removeEntity(entityp
params.Entity) error {
s/entityp params.Entity/tag string/
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
File state/apiserver/common/remove_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
state/apiserver/common/remove_test.go:67: "x5": {life: state.Dead, err:
fmt.Errorf("x5 error")},
Don't remove this as well please.
https://codereview.appspot.com/12551043/diff/3001/state/state.go
File state/state.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/state.go#oldcode467
state/state.go:467: // Tagger represents an entity with a tag.
Yay!
https://codereview.appspot.com/12551043/diff/3001/state/state_test.go
File state/state_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/state_test.go#oldcode...
state/state_test.go:1538: // TODO(fwereade): when lp:1199352 (relation lacks
Tag) is fixed, check
Please, graft this TODO comment somewhere in the new code.
Sign in to reply to this message.
rog
Please take a look. https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life_test.go File state/apiserver/common/life_test.go (left): https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life_test.go#oldcode55 state/apiserver/common/life_test.go:55: "x3": {err: fmt.Errorf("x3 error")}, On ...
12 years, 5 months ago (2013年08月07日 12:20:43 UTC) #3
Please take a look.
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life...
File state/apiserver/common/life_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/life...
state/apiserver/common/life_test.go:55: "x3": {err: fmt.Errorf("x3 error")},
On 2013年08月07日 09:13:09, dimitern wrote:
> Please, do not remove this case.
Done.
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
File state/apiserver/common/remove.go (right):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
state/apiserver/common/remove.go:28: func (r *Remover) removeEntity(entityp
params.Entity) error {
On 2013年08月07日 09:13:09, dimitern wrote:
> s/entityp params.Entity/tag string/
Done.
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
File state/apiserver/common/remove_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/apiserver/common/remo...
state/apiserver/common/remove_test.go:67: "x5": {life: state.Dead, err:
fmt.Errorf("x5 error")},
On 2013年08月07日 09:13:09, dimitern wrote:
> Don't remove this as well please.
Done.
https://codereview.appspot.com/12551043/diff/3001/state/state_test.go
File state/state_test.go (left):
https://codereview.appspot.com/12551043/diff/3001/state/state_test.go#oldcode...
state/state_test.go:1538: // TODO(fwereade): when lp:1199352 (relation lacks
Tag) is fixed, check
On 2013年08月07日 09:13:09, dimitern wrote:
> Please, graft this TODO comment somewhere in the new code.
Done.
Sign in to reply to this message.
dimitern
LGTM with that TODO reinstated. https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ensuredead.go File state/apiserver/common/ensuredead.go (left): https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ensuredead.go#oldcode18 state/apiserver/common/ensuredead.go:18: type DeadEnsurerer interface { ...
12 years, 5 months ago (2013年08月07日 12:56:26 UTC) #4
LGTM with that TODO reinstated.
https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ens...
File state/apiserver/common/ensuredead.go (left):
https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ens...
state/apiserver/common/ensuredead.go:18: type DeadEnsurerer interface {
I'm gonna miss that :)
https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ens...
File state/apiserver/common/ensuredead.go (right):
https://codereview.appspot.com/12551043/diff/17010/state/apiserver/common/ens...
state/apiserver/common/ensuredead.go:35: return NotSupportedError(tag, "ensuring
death")
so grim.. :) but I have not better suggestion.
https://codereview.appspot.com/12551043/diff/17010/state/state_test.go
File state/state_test.go (left):
https://codereview.appspot.com/12551043/diff/17010/state/state_test.go#oldcod...
state/state_test.go:1538: // TODO(fwereade): when lp:1199352 (relation lacks
Tag) is fixed, check
Where is this TODO?
Sign in to reply to this message.
rog
Please take a look.
12 years, 5 months ago (2013年08月07日 13:02:34 UTC) #5
Please take a look.
Sign in to reply to this message.
rog
Please take a look.
12 years, 5 months ago (2013年08月07日 14:24:41 UTC) #6
Please take a look.
Sign in to reply to this message.
gz
LGTM. Kills the -erers which is grand, and the extra cast/check error/NotImplementedError everywhere is offset ...
12 years, 5 months ago (2013年08月07日 14:54:42 UTC) #7
LGTM. Kills the -erers which is grand, and the extra cast/check
error/NotImplementedError everywhere is offset by the test fakes becoming much
simpler.
https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/err...
File state/apiserver/common/errors.go (right):
https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/err...
state/apiserver/common/errors.go:24: func NotSupportedError(entity, operation
string) error {
I wonder if this wants a less generic name? I'm not sure the package prefix is
enough to say this is about entities not supporting operations.
Sign in to reply to this message.
rog
https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/errors.go File state/apiserver/common/errors.go (right): https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/errors.go#newcode24 state/apiserver/common/errors.go:24: func NotSupportedError(entity, operation string) error { On 2013年08月07日 14:54:42, ...
12 years, 5 months ago (2013年08月07日 15:00:48 UTC) #8
https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/err...
File state/apiserver/common/errors.go (right):
https://codereview.appspot.com/12551043/diff/26001/state/apiserver/common/err...
state/apiserver/common/errors.go:24: func NotSupportedError(entity, operation
string) error {
On 2013年08月07日 14:54:42, gz wrote:
> I wonder if this wants a less generic name? I'm not sure the package prefix is
> enough to say this is about entities not supporting operations.
A reasonable point. I'll change it to use a better name,
if I can think of one.
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /