Skip to content

Commit 694be0f

Browse files
committed
Adding docs and fixing a comment
Signed-off-by: David Gilligan-Cook <[email protected]>
1 parent 8c3bac3 commit 694be0f

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

crates/spfs/src/tracking/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl SpfsSpecFile {
121121
let value: serde_yaml::Value = serde_yaml::from_str(s).map_err(Error::YAML)?;
122122

123123
// First work out what kind of data this is, based on the
124-
// SpfsFileApiVersionMapping value.
124+
// SpfsSpecApiVersionMapping value.
125125
let with_version = match serde_yaml::from_value::<SpfsSpecApiVersionMapping>(value.clone())
126126
{
127127
Err(err) => {

docs/spfs/usage.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,36 @@ The pruning process will always prefer keeping a tag version over removing it wh
106106

107107
The spfs runtime uses a temporary, in-memory filesystem, which means that large sets of changes can run out of space because of RAM limitations. The size of this filesystem can be overridden using the `SPFS_FILESYSTEM_TMPFS_SIZE` variable (eg `SPFS_FILESYSTEM_TMPFS_SIZE=10G`). Note that specifying values close to or larger than the available memory on the system may cause deadlocks or system instability.
108108

109+
## Shorter spfs run command lines: list of layers in a file
110+
111+
Spfs supports using a yaml file for the list of layer references, the digests or tags, for the runtime environment instead of putting them all on the command line. You can pass an absolute filepath to `spfs run`. Spfs will read the file and use the layer references in the order they are in the file. More than one filepath can be given, and these file paths can be mix with digest or tag references on the command line.
112+
113+
For example:
114+
```sh
115+
# using a list of layers file
116+
> spfs run /path/to/list/of/layers.spfs.yaml
117+
118+
# or, with digests
119+
> spfs run SOMEDIGEST+/path/to/list/of/layers.spfs.yaml+SOMEOTHERDIGEST
120+
121+
# or, with digests and tags
122+
> spfs run SOMEDIGEST+/path/to/list/of/layers.spfs.yaml+SOMETAG
123+
```
124+
125+
Example `layers.spfs.yaml` file containing a list of layers, a mixture of digests and tags, with specific fields in yaml format:
126+
127+
```yaml
128+
# layers.spfs.yaml
129+
api: v0/layerlist
130+
layers:
131+
- A7USTIBXPXHMD5CYEIIOBMFLM3X77ESVR3WAUXQ7XQQGTHKH7DMQ====
132+
- spfs/some/tag/to/something/tagged/in/spfs/repo
133+
- M4JTN4ENZVHV4LEOZ5ONOFYOXQGN2OZBWOGDQXAQ54K5C6QAR2AQ====
134+
- 6PJDUUENJYFFDKZWRKHDUXK4FGGZ7FHDYMZ7P4CXORUG6TUMDJ7A====
135+
```
136+
137+
List of layers files are distinquished from live layer files by their `api: v0/layerlist` field.
138+
109139

110140
## Live Layers: external directories and files in a spfs runtime
111141

@@ -115,7 +145,7 @@ A live layer is configured by a yaml file, called `layer.spfs.yaml` by default.
115145

116146
You can give `spfs run` the path to a live layer file, or the path to a directory that contains a 'layer.spfs.yaml' file, as one of the REFS on the command line that will make up the spfs runtime, e.g. `spfs run digest+digest+livelayerfile+tag+digest`. Multiple files can be specified on the command line. `spfs run` will put a live layer into /spfs each for config file specified.
117147

118-
Example `layer.spfs.yaml` file in `/some/directory/somewhere/`:
148+
Example `layer.spfs.yaml` file containing live layer data in `/some/directory/somewhere/`, in yaml format:
119149

120150
```yaml
121151
# layer.spfs.yaml
@@ -127,7 +157,7 @@ contents:
127157
dest: test_data/some.data
128158
```
129159

130-
The `api:` field is required to indicate which version of live layer is in the file.
160+
The `api:` field is required to indicate which version of live layer is in the file. Live layers files are distinquished from list of layer files by their `api: v0/layer` field.
131161

132162
The `contents:` field is required and tells spfs what this live layer will add into /spfs. It is a list of items. Currently spfs supports bind mount items in live layers. Each bind mount consists of a source (`bind:` or `src:`) path and a destination (`dest:`) path.
133163

0 commit comments

Comments
 (0)