forked from bicomsystems/go-libzfs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
zfs.go
executable file
·108 lines (96 loc) · 2.96 KB
/
zfs.go
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package zfs
import (
"os"
)
type Version struct {
Major int
Minor int
Patch int
}
type Properties map[DatasetProp]PropertyValue
type DestroyFlags struct {
IsChildrenRecursive bool //-r
IsDependentRecursive bool //-R
IsForcedToUnmount bool //-f
IsDryRun bool //-n
VerboseInfo bool //-v
}
type CreateFlags struct {
IsParentCreated bool //-p
SparseVolume bool //-s
}
type RollbackFlags struct {
IsRecursiveDestroy bool //-r
R bool //-R
IsForcedToUnmountClones bool //-f w/o -R
}
type CloneFlags struct {
IsParentCreated bool //-p
}
type ListFlags struct {
IsRecursive bool `json:"recursive"` //-p
Depth int `json:"depth"` //-d
Types []DatasetType `json:"types"` //-t
SortProperties []DatasetProp `json:"sort"` //-s
SortPropertiesDesc []DatasetProp `json:"sort-desc"` //-S
Paths []string `json:"paths"`
}
type MountFlags struct {
IsOverlay bool `json:"is_overlay"` //-O
OptionalProperties []string `json:"properties"` //-o
IsAll bool `json:"is_all"` //-a
}
type SendFlags struct {
Verbose bool `json:"verbose"` //-v
Replicate bool `json:"replicate"` //-R
DoAll bool `json:"do_all"` //-I
FromOrigin bool `json:"fromorigin"`
Dedup bool `json:"dedup"` //-D
Props bool `json:"props"` //-p
DryRun bool `json:"dryrun"` //-n
Parsable bool
Progress bool
LargeBlock bool `json:"large_block"` //-L
EmbedData bool `json:"embed_data"` //-e
Compress bool `json:"compress"` //-c
Raw bool `json:"raw"` //--raw
Backup bool `json:"backup"` //-b
Holds bool `json:"holds"` //-h
}
type RecvFlags struct {
Verbose bool `json:"verbose"` //-v
IsPrefix bool `json:"isprefix"` //-d
IsTail bool `json:"istail"` //-e
DryRun bool `json:"dryrun"` //-n
Force bool `json:"force"` //-r
CanmountOff bool `json:"canmountoff"`
Resumable bool `json:"resumable"` //-s
ByteSwap bool `json:"byteswap"`
NoMount bool `json:"nomount"` //-u
Holds bool `json:"holds"`
SkipHolds bool `json:"skipholds"` //-h
DoMount bool `json:"domount"`
}
type IDataset interface {
Open(path string) (error)
Close() (error)
Path() string
LibraryVersion() (*Version, error)
KernelModuleVersion() (*Version, error)
Create(*CreateFlags, map[DatasetProp]PropertyValue) (IDataset, error)
Destroy(*DestroyFlags) (error)
CreateSnapshot(recursive bool, properties map[DatasetProp]PropertyValue) ([]IDataset, error)
CreateBookmark(nam string) (IDataset, error)
Rollback(*RollbackFlags) (error)
Clone(map[DatasetProp]PropertyValue) ([]IDataset, error)
Rename() (error)
List(*ListFlags) ([]IDataset, error)
Properties() (map[DatasetProp]PropertyValue, error)
Mount(*MountFlags) (error)
Umount(force, isAll bool) (error)
SendFrom(from string, outf *os.File, flags SendFlags) (error)
SendSize(from string, flags *SendFlags) (int64, error)
ReceiveResumeToken() (string, error)
Receive(inf *os.File, flags *RecvFlags) (int64, error)
ReceiveResumeAbort() (error)
}