1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! This crate implements the basic support to download and unpack
//! [OCI images](https://github.com/opencontainers/image-spec) stored
//! in a [container registry](https://distribution.github.io/distribution/).
//!
//! It is not expected to support every feature in the OCI specifications. Instead,
//! the goal is to implement all features used in the most common images.
//!
//! # Usage
//!
//! The first step for unpacking an OCI image is to get a [reference][Reference]
//! instance to describe its location:
//!
//! ```
//! # use oci_unpack::*;
//! let reference = Reference::try_from("debian:stable").unwrap();
//! ```
//!
//! The string is parsed following the same rules as the `docker pull` command,
//! as described in the [`Reference`] documentation.
//!
//! Then, an [`Unpacker`] instance is created to configure how to download and
//! unpack the referenced image.
//!
//! ```
//! # use oci_unpack::*;
//! # fn f(reference: Reference) {
//! Unpacker::new(reference).unpack("/tmp/image").unwrap();
//! # }
//! ```
//!
//! An instance of [`EventHandler`] can be used to receive notifications during
//! the download/unpack process. The file `examples/unpack.rs` in the repository
//! has a full implementation of a handler.
//!
//! # Sandbox
//!
//! Before creating any file in the target directory, [`Unpacker::unpack`] tries
//! to create a sandbox with [Landlock](https://landlock.io/), so the process will
//! be able to create files only beneath the target directory.
//!
//! Errors on creating the sandbox can be ignored by setting [`Unpacker::require_sandbox`]
//! to `false`.
//!
//! The sandbox is only available if the crate is built with the `sandbox` feature, which
//! is enabled by default.
//!
//! # Zstd Compression
//!
//! The `zstd` feature (enabled by default) is required to support images compressed with zstd.
pub use ;
pub use ;
pub use ;
/// Errors from the functions in the public API.