Snapshotter defines the methods required to implement a snapshot snapshotter for allocating, snapshotting and mounting filesystem changesets. The model works by building up sets of changes with parent-child relationships. A snapshot represents a filesystem state. Every snapshot has a parent, where
| 254 | // Alternatively, for most container runs, snapshotter.Remove() will be called to |
| 255 | // signal the snapshotter to abandon the changes. |
| 256 | type Snapshotter interface { |
| 257 | // Stat returns the info for an active or committed snapshot by name or |
| 258 | // key. |
| 259 | // |
| 260 | // Should be used for parent resolution, existence checks and to discern |
| 261 | // the kind of snapshot. |
| 262 | Stat(ctx context.Context, key string) (Info, error) |
| 263 | |
| 264 | // Update updates the info for a snapshot. |
| 265 | // |
| 266 | // Only mutable properties of a snapshot may be updated. |
| 267 | Update(ctx context.Context, info Info, fieldpaths ...string) (Info, error) |
| 268 | |
| 269 | // Usage returns the resource usage of an active or committed snapshot |
| 270 | // excluding the usage of parent snapshots. |
| 271 | // |
| 272 | // The running time of this call for active snapshots is dependent on |
| 273 | // implementation, but may be proportional to the size of the resource. |
| 274 | // Callers should take this into consideration. Implementations should |
| 275 | // attempt to honor context cancellation and avoid taking locks when making |
| 276 | // the calculation. |
| 277 | Usage(ctx context.Context, key string) (Usage, error) |
| 278 | |
| 279 | // Mounts returns the mounts for the active snapshot transaction identified |
| 280 | // by key. Can be called on a read-write or readonly transaction. This is |
| 281 | // available only for active snapshots. |
| 282 | // |
| 283 | // This can be used to recover mounts after calling View or Prepare. |
| 284 | Mounts(ctx context.Context, key string) ([]mount.Mount, error) |
| 285 | |
| 286 | // Prepare creates an active snapshot identified by key descending from the |
| 287 | // provided parent. The returned mounts can be used to mount the snapshot |
| 288 | // to capture changes. |
| 289 | // |
| 290 | // If a parent is provided, after performing the mounts, the destination |
| 291 | // will start with the content of the parent. The parent must be a |
| 292 | // committed snapshot. Changes to the mounted destination will be captured |
| 293 | // in relation to the parent. The default parent, "", is an empty |
| 294 | // directory. |
| 295 | // |
| 296 | // The changes may be saved to a committed snapshot by calling Commit. When |
| 297 | // one is done with the transaction, Remove should be called on the key. |
| 298 | // |
| 299 | // Multiple calls to Prepare or View with the same key should fail. |
| 300 | Prepare(ctx context.Context, key, parent string, opts ...Opt) ([]mount.Mount, error) |
| 301 | |
| 302 | // View behaves identically to Prepare except the result may not be |
| 303 | // committed back to the snapshot snapshotter. View returns a readonly view on |
| 304 | // the parent, with the active snapshot being tracked by the given key. |
| 305 | // |
| 306 | // This method operates identically to Prepare, except the mounts returned |
| 307 | // may have the readonly flag set. Any modifications to the underlying |
| 308 | // filesystem will be ignored. Implementations may perform this in a more |
| 309 | // efficient manner that differs from what would be attempted with |
| 310 | // `Prepare`. |
| 311 | // |
| 312 | // Commit may not be called on the provided key and will return an error. |
| 313 | // To collect the resources associated with key, Remove must be called with |
no outgoing calls
no test coverage detected
searching dependent graphs…