Add helpers for sorting slot/plug/connection refs.
Allows external packages to sort their collections without the necessity to
implement the actual ordering logic. Instead, it should be possible to directly
plug provided helpers into sort.Interface.Less().
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Allow adding slots/plugs from snaps with instance keys. Extend unit tests to
cover parallel instances of snaps.
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
In preparation for parallel installation of snaps, introduce the necessary
rename of snap.Info.Name() to snap.Info.InstanceName(). The change is benign and
will make subsequent parallel installs reviews easier and smaller.
Leave TODO notes about possible issues with parallel installation where
possible.
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This patch improves sort code (some silly copy-pasted, harmless but
needleess code is now removed) and adds full test coverage. Tests are
also in a _test package and are no longer polutting the main namespace.
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch changes interfaces.Plug and interfaces.Slot to be built upon
snap.PlugInfo and snap.PlugInfo. This cuts a lot of the duplicated data
and also gives us access to data that was previously provided via
side-channels, such as snap version and developer name.
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch renames the last aspect of the slot/interface and plug.plug
vs plug.name rename. It attains parity with the client/ package. Both
plugs and slots have a .Name fields but that field is translated to
"plug" and "slot" in the type-less JSON representation.
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>