aboutsummaryrefslogtreecommitdiffstats
path: root/liblfjail/zfs.hh
blob: 915e042c96d42b7e74e491023050f4e871049f38 (plain) (blame)
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
/*
 * This source code is released into the public domain.
 */

#ifndef	LFJAIL_ZFS_HH
#define	LFJAIL_ZFS_HH

#include "generator.hh"
#include "generic_error.hh"

namespace lfjail::zfs {

/*
 * Exception thrown when a ZFS operation fails.
 */
struct zfs_error final : generic_error {
	zfs_error(std::string what_)
		: generic_error("{}", std::move(what_))
	{}
};

/*
 * Pools.
 */

struct pool {
	std::string name;
};

/* Fetch details for a specific pool by name. */
auto get_pool(std::string_view name) -> pool;

/* Fetch details for all pools on the system. */
auto get_pools() -> std::generator<pool>;

/*
 * Datasets.
 */

struct dataset {
	std::string name;
};

/* Return true if a dataset by this name exists. */
auto dataset_exists(std::string_view name) -> bool;

/* Fetch details for a specific dataset by name. */
auto get_dataset(std::string_view name) -> dataset;

/* Fetch names for all datasets on the system. */
auto get_dataset_names() -> std::generator<std::string>;

/* Fetch details for all datasets on the system. */
auto get_datasets() -> std::generator<dataset>;

} // namespace lfjail::zfs

#endif	// LFJAIL_ZFS_HH