Comment 10 for bug 1849845

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

@Jochen the spool mode is not documented in the proper place (snapcraft.io/docs) but it is documented on the forum in the feature discussion thread here: https://forum.snapcraft.io/t/improvements-in-the-content-interface/2387

The main difference is that the syntax changes so that slots have a "source" attribute that can have both read and write attributes with lists of paths.

slots:
  content:
    source:
      read: [$SNAP/foo]
      write: [$SNAP_DATA/bar]

The plug side syntax is the same as before.

Connecting such slot to a plug changes the semantics in one way, in the direct mode the plug target directory is used *directly* as the mount target. For example with this plug

plugs:
  content:
    target: $SNAP_DATA/here

A single direct slot defining a single directory to read or write would just get mounted over "here". In the new spool mode the directory "here" is not mounted over. Instead each element defined by all the connected slots are mounted as distinct entries inside. For example, if the slot and plug defined in this comment were connected the resulting directory tree would look like this:

$SNAP_DATA/here/foo # bind mount to other side snap's $SNAP/foo
$SNAP_DATA/here/bar # bind mount to other side snap's $SNAP_DATA/bar

The spool mode is better because you can then enumerate "here" and know what is connected reliably.