state: Database and modelBackend refactoring #7050

Merged
merged 5 commits into from Mar 1, 2017

Conversation

Projects
None yet
4 participants
Contributor

mjs commented Mar 1, 2017

Description of change

In order to support new State-like types (coming soon) and allow them to leverage existing functionality in the state package, some low level txn functionality which was on State has been moved onto Database. Additionally the modelBackend interface has been extended to allow it to be used more widely, providing access to the underlying Database.

The state settings and watcher implementations are now completely based on modelBackend instead of State, allowing alternative State types to use these areas too.

QA steps

This change shouldn't affect external behaviour. Unit tests still pass and a simple bootstrap, deploy, destroy check was undertaken to ensure basic functionality is still OK.

Documentation changes

Not required - no used visible changes.

Bug reference

N.A.

mjs added some commits Feb 28, 2017

state: Transaction helpers to Database
Added versions of various State transaction running helpers on Database
to make these accessible for other types (required for upcoming work).
state: Extend modelBackend interface
modelBackend now provides access to a State's Database and TxnLogWatcher
allowing it to be used more generally. This is required to allow code
reuse for for an coming alternate state implementation. It also helps to
faciliates unit tests that don't require a running database.
state: Use modelBacked through watchers
modelBackend is now used instead of State whereever possible. This makes
the watcher functions useable by alternate State implementations (coming
soon).
state: settings now uses modelBackend
The functionality for reading and writing settings no longer relies
directly on State, allowing it be reused for other State-like
types (coming soon).

Looks reasonable to me.

Contributor

mjs commented Mar 1, 2017

$$merge$$

Contributor

jujubot commented Mar 1, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Mar 1, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10386

Contributor

mjs commented Mar 1, 2017

$$mongodb-death-on-windows$$

Contributor

jujubot commented Mar 1, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 8a97067 into juju:develop Mar 1, 2017

@mjs mjs deleted the mjs:state-modelbackend-refactor branch Mar 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment