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

Issue 7727044: state: add allWatcher

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

Description

state: add allWatcher This is the data structure that will manage the shared state for all watching clients. Initially, we have a single method, "change", which mutates the state in response to a watcher-for change. For the record, this is the allWatcher inner loop as planned: for { select { case <-aw.tomb.Dying(): return tomb.ErrDying case change := <-in: if err := aw.changed(change); err != nil { return err } case req := <-aw.request: aw.handle(req) } aw.respond() } https://code.launchpad.net/~rogpeppe/juju-core/241-allwatcher-changed/+merge/153203 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: add allWatcher #

Patch Set 3 : state: add allWatcher #

Patch Set 4 : state: add allWatcher #

Patch Set 5 : state: add allWatcher #

Total comments: 2

Patch Set 6 : state: add allWatcher #

Unified diffs Side-by-side diffs Delta from patch set Stats (+300 lines, -108 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M state/megawatcher.go View 1 2 3 5 chunks +61 lines, -14 lines 0 comments Download
M state/megawatcher_internal_test.go View 1 2 3 5 chunks +237 lines, -94 lines 0 comments Download

Messages

Total messages: 5
rog
Please take a look.
11 years ago (2013-03-13 17:49:55 UTC) #1
rog
Please take a look.
11 years ago (2013-03-13 18:47:30 UTC) #2
dimitern
LGTM
11 years ago (2013-03-13 20:24:04 UTC) #3
fwereade
LGTM, I think these tests are very much worth it. Thanks. https://codereview.appspot.com/7727044/diff/8001/state/megawatcher_internal_test.go File state/megawatcher_internal_test.go (right): ...
11 years ago (2013-03-14 12:17:16 UTC) #4
rog
11 years ago (2013-03-14 13:05:40 UTC) #5
*** Submitted:

state: add allWatcher

This is the data structure that will manage the
shared state for all watching clients.
Initially, we have a single method, "change", which
mutates the state in response to a watcher-for change.

For the record, this is the allWatcher inner loop as planned:

	for {
		select {
		case <-aw.tomb.Dying():
			return tomb.ErrDying
		case change := <-in:
			if err := aw.changed(change); err != nil {
				return err
			}
		case req := <-aw.request:
			aw.handle(req)
		}
		aw.respond()
	}

R=dimitern, fwereade
CC=
https://codereview.appspot.com/7727044

https://codereview.appspot.com/7727044/diff/8001/state/megawatcher_internal_t...
File state/megawatcher_internal_test.go (right):

https://codereview.appspot.com/7727044/diff/8001/state/megawatcher_internal_t...
state/megawatcher_internal_test.go:132: expectContents: []entityEntry{{
On 2013/03/14 12:17:16, fwereade wrote:
> This is testing that the second remove doesn't bump to the head of the list,
> right?

yup.
Sign in to reply to this message.

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