keeping state in units

Kapil Thangavelu kapilt at gmail.com
Wed Feb 11 13:12:17 UTC 2015


Hi Folks,

Just merged a new charm helper that I wanted to highlight. I've seen quite
a few charms tracking state in various ways, from ad hoc files per setting
to the config settings helper, which leads to some charms having a
half-dozen state tracking files.  Ideally charms can be written such that
they just consider current state and write out and effect. However its
quite natural for some charms to have the need for local state as they need
to consider the application of deltas from multiple sources to the state
they've already achieved on a unit.

The charmhelper unitdata.py provides a versioned, transactional, kv store
for a unit backed by a single sqlite file. It provides methods for
returning deltas against previously known values to simplify delta
calculation and application by charm. Docs embedded in implementation link
below, feedback welcome.

http://goo.gl/B0AdTR

cheers,

Kapil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20150211/2565ff27/attachment.html>


More information about the Juju mailing list