I see. Thanks for the pointer. This is very helpful in our design.
On 04/18/2017 09:30 AM, Marco Ceppi wrote:
On Tue, Apr 18, 2017 at 8:57 AM Alex Kavanagh
<[email protected] <mailto:[email protected]>> wrote:
Hi
On Tue, Apr 18, 2017 at 1:50 PM, fengxia <[email protected]
<mailto:[email protected]>> wrote:
I did a quick experiment:
1. Created two layers in one charm, each layer has a few
states, set_state() can trigger @when defined in other layers.
2. Use the same set of states, now splitting them in two
charms => @when don't trigger anymore.
So does this mean states have a namespace by the charm it belongs?
States are stored on the individual instance of the charm. They
are private and no other charm can see those states.
More directly, states are private per unit of a charm. Layers
namespace by convention rather than implicitly. For example, layer foo
should set states as follows:
set_state('foo.state-name')
That state, as you've seen, can be responded to by any other layer in
that charm, in that deployed unit. As such, if you have two units of
charm bar, bar/0 can not see or set states for bar/1 and vice versa.
If you need to transfer state between charms, that's what Juju
Relations are for. They provide the ability to transfer key/vals
between one or more connected item:
https://jujucharms.com/docs/stable/developer-layers-interfaces
Thanks,
Marco Ceppi
--
Feng xia
Engineer
Lenovo USA
Phone: 5088011794
[email protected]
Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums
--
Juju mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju