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

Issue 12748044: state: Make Relation an Entity (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by dimitern
Modified:
10 years, 9 months ago
Reviewers:
gz, mp+180157, rog
Visibility:
Public.

Description

state: Make Relation an Entity This adds relation tags to the names package. The format is "relation-<id>", where <id> is the relation's numeric id. It also adds a Tag() method on the relation, and a few other necessary modifications to make state.Relation objects behave like other entities. This is needed for the uniter API facade, so relations can be used as params and results. https://code.launchpad.net/~dimitern/juju-core/103-relation-entity-tags/+merge/180157 Requires: https://code.launchpad.net/~dimitern/juju-core/102-state-endpoint-refactoring/+merge/180141 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6

Patch Set 2 : state: Make Relation an Entity #

Total comments: 4

Patch Set 3 : state: Make Relation an Entity #

Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -23 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A names/relation.go View 1 1 chunk +24 lines, -0 lines 0 comments Download
A names/relation_test.go View 1 chunk +36 lines, -0 lines 0 comments Download
M names/tag.go View 2 chunks +18 lines, -15 lines 0 comments Download
M names/tag_test.go View 3 chunks +9 lines, -3 lines 0 comments Download
M state/relation.go View 2 chunks +7 lines, -0 lines 0 comments Download
M state/state.go View 3 chunks +9 lines, -0 lines 0 comments Download
M state/state_test.go View 1 2 4 chunks +21 lines, -5 lines 0 comments Download

Messages

Total messages: 5
dimitern
Please take a look.
10 years, 9 months ago (2013-08-14 14:40:51 UTC) #1
rog
LGTM with some extra tests. https://codereview.appspot.com/12748044/diff/1/names/relation.go File names/relation.go (right): https://codereview.appspot.com/12748044/diff/1/names/relation.go#newcode18 names/relation.go:18: func RelationTag(relationId string) string ...
10 years, 9 months ago (2013-08-14 15:02:48 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/12748044/diff/1/names/relation.go File names/relation.go (right): https://codereview.appspot.com/12748044/diff/1/names/relation.go#newcode18 names/relation.go:18: func RelationTag(relationId string) string { ...
10 years, 9 months ago (2013-08-14 15:16:16 UTC) #3
gz
LGTM. https://codereview.appspot.com/12748044/diff/5002/names/relation_test.go File names/relation_test.go (right): https://codereview.appspot.com/12748044/diff/5002/names/relation_test.go#newcode16 names/relation_test.go:16: var relationIdTests = []struct { Okay, so this ...
10 years, 9 months ago (2013-08-14 15:54:56 UTC) #4
dimitern
10 years, 9 months ago (2013-08-14 16:03:30 UTC) #5
Please take a look.

https://codereview.appspot.com/12748044/diff/5002/names/relation_test.go
File names/relation_test.go (right):

https://codereview.appspot.com/12748044/diff/5002/names/relation_test.go#newc...
names/relation_test.go:16: var relationIdTests = []struct {
On 2013/08/14 15:54:56, gz wrote:
> Okay, so this is a case where I like the table test style.

Yeah!

https://codereview.appspot.com/12748044/diff/5002/state/state.go
File state/state.go (right):

https://codereview.appspot.com/12748044/diff/5002/state/state.go#newcode498
state/state.go:498: return nil, errors.NotFoundf("relation %s", id)
On 2013/08/14 15:54:56, gz wrote:
> If the conversion fails, is that really a not found rather than an invalid
> situation?
> 
> Is there a test exercising this branch?

I'll add a test, thanks. And the point is: there won't be a relation with an
invalid id anyway, so it's NotFoundError. It will also help later in the API
when we convert NotFoundErrors to ErrPerm.
Sign in to reply to this message.

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