How does stop/restart works in content-Interface sharing snap

Hi,

I have snap x- called producer snap which shares library A,B and C via content interface slot.
I have snap y - called consumer snap with consumes library A and C.
I also have snap z- called consumer snap with consumes library B and C.

Snaps y and z are connected to snap x via plugs.

What would happen if I do snap stop x. Does snap y and z gets any signal that content-interface slot is down.

What would happen if I do snap restart x. How the dependent slots-plug relationship is handled.

Can you elaborate more on how snaps who are dependent on other snap via plugs, get notified with the change in the slot?

Thanks

Anyone has any suggestion

The snap stop and snap restart commands control systemd services provided by a snap. Content interface plugs and slots are not services, so those commands would have no effect.

What will affect things is the act of connecting or disconnecting the plug. A snap can ask to be notified when one of its plugs or slots is connected/disconnected via an interface hook:

Thanks Jamesh. do you have any sample implementation where I can get better understanding.

Also If Snap A is slot producer and Snap B is a plug consumer. what happens when Snap A is updated with newer version. Will Snap B in sleep when Snap A gets rolled to newer version? what happens to Snap B when the producer slot is upgrading.

Content interface connections express data sharing and socket sharing. Nothing changes during a refresh but once the refresh is done the side that was not refreshing will be updated to see the new content connection (e.g. point to current revision data, whatever was expressed in the connection).

The far side of the connection, the one not being refreshed, is not notified about this.

1 Like