worker/state: change output to *StatePool #8087

Merged
merged 1 commit into from Nov 16, 2017

Conversation

Projects
None yet
3 participants
Member

axw commented Nov 16, 2017

Description of change

Change worker/state to output a *state.StatePool,
rather than *state.State, and make that worker
responsible for registering state metrics and
communicating the StatePool back up to the agent
for introspection.

The other workers are updated to take a StatePool.
Of particular note, worker/apiserver now accepts
a StatePool and passes that directly to the
apiserver.NewServer call. worker/apiserver no
longer contains a worker; its manifold just calls
through to apiserver.NewServer with the configuration
derived from manifold inputs.

The worker/state worker is now responsible for
pinging all of the state objects, and removing them
from the pool when the corresponding model becomes
Dead or is removed from state.

QA steps

  1. juju bootstrap localhost
  2. juju add-model foo
  3. juju ssh -m controller 0 juju-introspect statepool
    (should show there are two model states; the "system state" is excluded)
  4. juju destroy-model -y foo
  5. juju ssh -m controller 0 juju-introspect statepool
    (should show there is just one model state, i.e. the state for "foo" should have been removed)

Documentation changes

None.

Bug reference

None.

@@ -41,12 +41,12 @@ func StateWorkersManifold(config StateWorkersConfig) dependency.Manifold {
return nil, err
}
- st, err := stTracker.Use()
+ stPool, err := stTracker.Use()
@wallyworld

wallyworld Nov 16, 2017

Owner

spTracker?
statepoolTracker?

@axw

axw Nov 16, 2017

Member

as discussed, no, StatePool is just an implementation detail. eventually this should be replaced with a different manager object which takes responsibility for state objects and their workers

worker/state/statetracker.go
@@ -16,46 +16,48 @@ var ErrStateClosed = errors.New("state closed")
// StateTracker describes a type which wraps and manages the lifetime
// of a *state.State.
@wallyworld

wallyworld Nov 16, 2017

Owner

StatePool
Maybe rename the interface as well?

@axw

axw Nov 16, 2017

Member

reworded, "state.State and state.StatePool"

Member

axw commented Nov 16, 2017

$$merge$$

Contributor

jujubot commented Nov 16, 2017

Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju

Contributor

jujubot commented Nov 16, 2017

Build failed: Tests failed
build url: http://ci.jujucharms.com/job/github-merge-juju/531

worker/state: change output to *StatePool
Change worker/state to output a *state.StatePool,
rather than *state.State, and make that worker
responsible for registering state metrics and
communicating the StatePool back up to the agent
for introspection.

The other workers are updated to take a StatePool.
Of particular note, worker/apiserver now accepts
a StatePool and passes that directly to the
apiserver.NewServer call. worker/apiserver no
longer contains a worker; its manifold just calls
through to apiserver.NewServer with the configuration
derived from manifold inputs.

The worker/state worker is now responsible for
pinging all of the state objects, and removing them
from the pool when the corresponding model becomes
Dead or is removed from state.
Member

axw commented Nov 16, 2017

$$merge$$

Contributor

jujubot commented Nov 16, 2017

Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju

@jujubot jujubot merged commit 6f7c9e0 into juju:state-controller-refactor Nov 16, 2017

1 check failed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment