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

Issue 7594048: state: add allWatcher.respond method

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by rog
Modified:
11 years, 1 month ago
Reviewers:
dimitern, mp+153519, jameinel
Visibility:
Public.

Description

state: add allWatcher.respond method This is probably the most complex piece - we maintain reference counts to keep track of which clients know about which which objects, so we can delete those objects when everyone has been notified of their removal. https://code.launchpad.net/~rogpeppe/juju-core/243-allwatcher-respond/+merge/153519 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: add allWatcher.respond method #

Total comments: 1

Patch Set 3 : state: add allWatcher.respond method #

Total comments: 6

Patch Set 4 : state: add allWatcher.respond method #

Total comments: 2

Patch Set 5 : state: add allWatcher.respond method #

Patch Set 6 : state: add allWatcher.respond method #

Unified diffs Side-by-side diffs Delta from patch set Stats (+536 lines, -556 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
D state/api/apiserver.go.THIS View 1 chunk +0 lines, -532 lines 0 comments Download
M state/megawatcher.go View 1 2 3 4 11 chunks +124 lines, -4 lines 0 comments Download
M state/megawatcher_internal_test.go View 1 2 3 4 5 13 chunks +410 lines, -20 lines 0 comments Download

Messages

Total messages: 8
rog
Please take a look. https://codereview.appspot.com/7594048/diff/2001/state/api/apiserver.go.THIS File state/api/apiserver.go.THIS (left): https://codereview.appspot.com/7594048/diff/2001/state/api/apiserver.go.THIS#oldcode1 state/api/apiserver.go.THIS:1: package api i don't know ...
11 years, 1 month ago (2013-03-15 10:03:19 UTC) #1
dimitern
Overall LGTM with some suggestions. I have a bad feeling about holding references to all ...
11 years, 1 month ago (2013-03-15 13:04:42 UTC) #2
rog
On 2013/03/15 13:04:42, dimitern wrote: > Overall LGTM with some suggestions. > > I have ...
11 years, 1 month ago (2013-03-15 13:57:07 UTC) #3
rog
Please take a look. https://codereview.appspot.com/7594048/diff/4001/state/megawatcher.go File state/megawatcher.go (right): https://codereview.appspot.com/7594048/diff/4001/state/megawatcher.go#newcode205 state/megawatcher.go:205: // the entry nothing else ...
11 years, 1 month ago (2013-03-15 14:24:59 UTC) #4
jameinel
On 2013/03/15 13:57:07, rog wrote: > On 2013/03/15 13:04:42, dimitern wrote: > > Overall LGTM ...
11 years, 1 month ago (2013-03-17 11:31:09 UTC) #5
jameinel
As long as we are sure allInfo only has one thread/goroutine accessing it: LGTM. https://codereview.appspot.com/7594048/diff/11001/state/megawatcher.go ...
11 years, 1 month ago (2013-03-17 11:36:54 UTC) #6
rog
On 17 March 2013 11:31, <john.meinel@canonical.com> wrote: Firstly, thanks for these helpful thoughts. > I ...
11 years, 1 month ago (2013-03-18 12:04:10 UTC) #7
rog
11 years, 1 month ago (2013-03-18 12:37:54 UTC) #8
*** Submitted:

state: add allWatcher.respond method

This is probably the most complex piece - we
maintain reference counts to keep track of
which clients know about which which objects,
so we can delete those objects when everyone
has been notified of their removal.

R=dimitern, jameinel
CC=
https://codereview.appspot.com/7594048

https://codereview.appspot.com/7594048/diff/11001/state/megawatcher.go
File state/megawatcher.go (right):

https://codereview.appspot.com/7594048/diff/11001/state/megawatcher.go#newcod...
state/megawatcher.go:313: }
On 2013/03/17 11:36:54, jameinel wrote:
> Odd: http://golang.org/src/pkg/container/list/list.go?s=1535:1580#L68
> 
> Checks to see if the element being removed thinks it is part of the list, but
> doesn't end up setting e.l to nil after it has been removed.

you mean e.list, presumably? it does get set to nil - see in the  public Remove
method (line 61)

> Do we need to worry about thread safety? Certainly the invariant of being in
> a.entities and being a valid entry in a.list should be preserved if possible.
> 
> I don't know if allInfo needs to be thread-safe, though.

allInfo does not need to be thread-safe. If it did, it would be very wrong! (in
general, if there's no mutex and no channels, a Go data structure cannot be
thread-safe).
Sign in to reply to this message.

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