Documentation
¶
Index ¶
- Constants
- Variables
- func ComponentNamecheck(datasetPathComponent string) error
- func EncryptionCLISupported(ctx context.Context) (bool, error)
- func FilesystemVersionEqualIdentity(a, b FilesystemVersion) bool
- func PrometheusRegister(registry prometheus.Registerer) error
- func ResumeRecvSupported(ctx context.Context, fs *DatasetPath) (bool, error)
- func ResumeSendSupported(ctx context.Context) (bool, error)
- func ValidHoldTag(tag string) error
- func ZFSCreatePlaceholderFilesystem(ctx context.Context, fs *DatasetPath, parent *DatasetPath) (err error)
- func ZFSDestroy(ctx context.Context, arg string) (err error)
- func ZFSDestroyFilesystemVersion(ctx context.Context, filesystem *DatasetPath, version *FilesystemVersion) (err error)
- func ZFSDestroyFilesystemVersions(ctx context.Context, reqs []*DestroySnapOp)
- func ZFSDestroyIdempotent(ctx context.Context, path string) error
- func ZFSGetEncryptionEnabled(ctx context.Context, fs string) (enabled bool, err error)
- func ZFSGetGUID(ctx context.Context, fs string, version string) (g uint64, err error)
- func ZFSGetReceiveResumeTokenOrEmptyStringIfNotSupported(ctx context.Context, fs *DatasetPath) (string, error)
- func ZFSHold(ctx context.Context, fs string, v FilesystemVersion, tag string) error
- func ZFSHolds(ctx context.Context, fs, snap string) ([]string, error)
- func ZFSList(ctx context.Context, properties []string, zfsArgs ...string) (res [][]string, err error)
- func ZFSListChan(ctx context.Context, out chan ZFSListResult, properties []string, ...)
- func ZFSRecv(ctx context.Context, fs string, v *ZFSSendArgVersion, stream io.ReadCloser, ...) (err error)
- func ZFSRecvClearResumeToken(ctx context.Context, fs string) (err error)
- func ZFSRelease(ctx context.Context, tag string, snaps ...string) error
- func ZFSRollback(ctx context.Context, fs *DatasetPath, snapshot FilesystemVersion, ...) (err error)
- func ZFSSet(ctx context.Context, fs *DatasetPath, props *ZFSProperties) (err error)
- func ZFSSetPlaceholder(ctx context.Context, p *DatasetPath, isPlaceholder bool) error
- func ZFSSnapshot(ctx context.Context, fs *DatasetPath, name string, recursive bool) (err error)
- type BookmarkExists
- type ClearResumeTokenError
- type DatasetDoesNotExist
- type DatasetFilter
- type DatasetPath
- func (p *DatasetPath) Copy() (c *DatasetPath)
- func (p *DatasetPath) Empty() bool
- func (p DatasetPath) Equal(q *DatasetPath) bool
- func (p *DatasetPath) Extend(extend *DatasetPath)
- func (p *DatasetPath) HasPrefix(prefix *DatasetPath) bool
- func (p *DatasetPath) Length() int
- func (p *DatasetPath) MarshalJSON() ([]byte, error)
- func (p *DatasetPath) Pool() (string, error)
- func (p *DatasetPath) ToString() string
- func (p *DatasetPath) TrimNPrefixComps(n int)
- func (p *DatasetPath) TrimPrefix(prefix *DatasetPath)
- func (p *DatasetPath) UnmarshalJSON(b []byte) error
- type DatasetPathForest
- type DatasetPathVisit
- type DatasetPathsVisitor
- type DestroySnapOp
- type DestroySnapshotsError
- type DrySendInfo
- type DrySendType
- type EntityType
- type ErrRecvResumeNotSupported
- type FilesystemPlaceholderState
- type FilesystemVersion
- func ParseFilesystemVersion(args ParseFilesystemVersionArgs) (v FilesystemVersion, err error)
- func ZFSBookmark(ctx context.Context, fs string, v FilesystemVersion, bookmark string) (bm FilesystemVersion, err error)
- func ZFSGetFilesystemVersion(ctx context.Context, ds string) (v FilesystemVersion, _ error)
- func ZFSListFilesystemVersions(ctx context.Context, fs *DatasetPath, options ListFilesystemVersionsOptions) (res []FilesystemVersion, err error)
- func (v FilesystemVersion) FullPath(fs string) string
- func (v FilesystemVersion) GetCreateTXG() uint64
- func (v FilesystemVersion) GetGUID() uint64
- func (v FilesystemVersion) GetGuid() uint64
- func (v FilesystemVersion) GetName() string
- func (v FilesystemVersion) IsBookmark() bool
- func (v FilesystemVersion) IsSnapshot() bool
- func (v FilesystemVersion) RelName() string
- func (v FilesystemVersion) String() string
- func (v FilesystemVersion) ToAbsPath(p *DatasetPath) string
- func (v FilesystemVersion) ToSendArgVersion() ZFSSendArgVersion
- type GetMountpointOutput
- type ListFilesystemVersionsOptions
- type MigrateHashBasedPlaceholderReport
- type NilBool
- type OptionUint64
- type ParseFilesystemVersionArgs
- type PathValidationError
- type RecvCannotReadFromStreamErr
- type RecvDestroyOrOverwriteEncryptedErr
- type RecvFailedWithResumeTokenErr
- type RecvOptions
- type ResumeToken
- type SendStream
- type VersionType
- type VersionTypeSet
- type ZFSError
- type ZFSListMappingPropertiesResult
- type ZFSListResult
- type ZFSProperties
- type ZFSSendArgVersion
- func (v ZFSSendArgVersion) FullPath(fs string) string
- func (v ZFSSendArgVersion) GetGuid() uint64
- func (v ZFSSendArgVersion) IsSnapshot() bool
- func (v ZFSSendArgVersion) MustBeBookmark()
- func (v ZFSSendArgVersion) ToSendArgVersion() ZFSSendArgVersion
- func (a ZFSSendArgVersion) ValidateExists(ctx context.Context, fs string) error
- func (a ZFSSendArgVersion) ValidateExistsAndGetVersion(ctx context.Context, fs string) (v FilesystemVersion, _ error)
- func (v ZFSSendArgVersion) ValidateInMemory(fs string) error
- type ZFSSendArgsResumeTokenMismatchError
- type ZFSSendArgsResumeTokenMismatchErrorCode
- type ZFSSendArgsUnvalidated
- type ZFSSendArgsValidated
- type ZFSSendArgsValidationError
- type ZFSSendArgsValidationErrorCode
Constants ¶
const MaxDatasetNameLen = 256 - 1
const ( // For a placeholder filesystem to be a placeholder, the property source must be local, // i.e. not inherited. PlaceholderPropertyName string = "zrepl:placeholder" )
const RecvStderrBufSiz = 1 << 15
Variables ¶
var ( AllVersionTypes = VersionTypeSet{ Bookmark: true, Snapshot: true, } Bookmarks = VersionTypeSet{ Bookmark: true, } Snapshots = VersionTypeSet{ Snapshot: true, } )
var ( ZFSSendPipeCapacityHint = int(envconst.Int64("ZFS_SEND_PIPE_CAPACITY_HINT", 1<<25)) ZFSRecvPipeCapacityHint = int(envconst.Int64("ZFS_RECV_PIPE_CAPACITY_HINT", 1<<25)) )
var ErrBookmarkCloningNotSupported = fmt.Errorf("bookmark cloning feature is not yet supported by ZFS")
var ErrEncryptedSendNotSupported = fmt.Errorf("raw sends which are required for encrypted zfs send are not supported")
var ResumeTokenCorruptError = errors.New("resume token is corrupt")
var ResumeTokenDecodingNotSupported = errors.New("zfs binary does not allow decoding resume token or zrepl cannot scrape zfs output")
var ResumeTokenParsingError = errors.New("zrepl cannot parse resume token values")
var ZFS_BINARY string = "zfs"
Functions ¶
func ComponentNamecheck ¶ added in v0.3.0
From module/zcommon/zfs_namecheck.c
Snapshot names must be made up of alphanumeric characters plus the following characters:
[-_.: ]
func EncryptionCLISupported ¶ added in v0.3.0
func FilesystemVersionEqualIdentity ¶ added in v0.3.0
func FilesystemVersionEqualIdentity(a, b FilesystemVersion) bool
Only takes into account those attributes of FilesystemVersion that are immutable over time in ZFS.
func PrometheusRegister ¶
func PrometheusRegister(registry prometheus.Registerer) error
func ResumeRecvSupported ¶ added in v0.3.0
func ResumeRecvSupported(ctx context.Context, fs *DatasetPath) (bool, error)
fs == nil only checks for CLI support
func ResumeSendSupported ¶ added in v0.3.0
func ValidHoldTag ¶ added in v0.3.0
returned err != nil is guaranteed to represent invalid hold tag
func ZFSCreatePlaceholderFilesystem ¶
func ZFSCreatePlaceholderFilesystem(ctx context.Context, fs *DatasetPath, parent *DatasetPath) (err error)
func ZFSDestroyFilesystemVersion ¶
func ZFSDestroyFilesystemVersion(ctx context.Context, filesystem *DatasetPath, version *FilesystemVersion) (err error)
func ZFSDestroyFilesystemVersions ¶ added in v0.2.0
func ZFSDestroyFilesystemVersions(ctx context.Context, reqs []*DestroySnapOp)
func ZFSDestroyIdempotent ¶ added in v0.3.0
func ZFSGetEncryptionEnabled ¶ added in v0.3.0
returns false, nil if encryption is not supported
func ZFSGetGUID ¶ added in v0.3.0
The returned error includes requested filesystem and version as quoted strings in its error message
func ZFSGetReceiveResumeTokenOrEmptyStringIfNotSupported ¶ added in v0.3.0
func ZFSGetReceiveResumeTokenOrEmptyStringIfNotSupported(ctx context.Context, fs *DatasetPath) (string, error)
if string is empty and err == nil, the feature is not supported
func ZFSListChan ¶
func ZFSListChan(ctx context.Context, out chan ZFSListResult, properties []string, notExistHint *DatasetPath, zfsArgs ...string)
ZFSListChan executes `zfs list` and sends the results to the `out` channel. The `out` channel is always closed by ZFSListChan: If an error occurs, it is closed after sending a result with the Err field set. If no error occurs, it is just closed. If the operation is cancelled via context, the channel is just closed.
If notExistHint is not nil and zfs exits with an error, the stderr is attempted to be interpreted as a *DatasetDoesNotExist error.
However, if callers do not drain `out` or cancel via `ctx`, the process will leak either running because IO is pending or as a zombie.
func ZFSRecv ¶
func ZFSRecv(ctx context.Context, fs string, v *ZFSSendArgVersion, stream io.ReadCloser, opts RecvOptions) (err error)
func ZFSRecvClearResumeToken ¶
always returns *ClearResumeTokenError
func ZFSRelease ¶ added in v0.3.0
Idempotent: if the hold doesn't exist, this is not an error
func ZFSRollback ¶
func ZFSRollback(ctx context.Context, fs *DatasetPath, snapshot FilesystemVersion, rollbackArgs ...string) (err error)
func ZFSSet ¶
func ZFSSet(ctx context.Context, fs *DatasetPath, props *ZFSProperties) (err error)
func ZFSSetPlaceholder ¶
func ZFSSetPlaceholder(ctx context.Context, p *DatasetPath, isPlaceholder bool) error
func ZFSSnapshot ¶
Types ¶
type BookmarkExists ¶ added in v0.3.0
type BookmarkExists struct {
// contains filtered or unexported fields
}
func (*BookmarkExists) Error ¶ added in v0.3.0
func (e *BookmarkExists) Error() string
type ClearResumeTokenError ¶
func (ClearResumeTokenError) Error ¶
func (e ClearResumeTokenError) Error() string
type DatasetDoesNotExist ¶
type DatasetDoesNotExist struct {
Path string
}
func (*DatasetDoesNotExist) Error ¶
func (d *DatasetDoesNotExist) Error() string
type DatasetFilter ¶
type DatasetFilter interface {
Filter(p *DatasetPath) (pass bool, err error)
}
func NoFilter ¶
func NoFilter() DatasetFilter
Returns a DatasetFilter that does not filter (passes all paths)
type DatasetPath ¶
type DatasetPath struct {
// contains filtered or unexported fields
}
func NewDatasetPath ¶
func NewDatasetPath(s string) (p *DatasetPath, err error)
func ZFSListMapping ¶
func ZFSListMapping(ctx context.Context, filter DatasetFilter) (datasets []*DatasetPath, err error)
func (*DatasetPath) Copy ¶
func (p *DatasetPath) Copy() (c *DatasetPath)
func (*DatasetPath) Empty ¶
func (p *DatasetPath) Empty() bool
func (DatasetPath) Equal ¶
func (p DatasetPath) Equal(q *DatasetPath) bool
func (*DatasetPath) Extend ¶
func (p *DatasetPath) Extend(extend *DatasetPath)
func (*DatasetPath) HasPrefix ¶
func (p *DatasetPath) HasPrefix(prefix *DatasetPath) bool
func (*DatasetPath) Length ¶
func (p *DatasetPath) Length() int
func (*DatasetPath) MarshalJSON ¶
func (p *DatasetPath) MarshalJSON() ([]byte, error)
func (*DatasetPath) Pool ¶ added in v0.3.0
func (p *DatasetPath) Pool() (string, error)
func (*DatasetPath) ToString ¶
func (p *DatasetPath) ToString() string
func (*DatasetPath) TrimNPrefixComps ¶
func (p *DatasetPath) TrimNPrefixComps(n int)
func (*DatasetPath) TrimPrefix ¶
func (p *DatasetPath) TrimPrefix(prefix *DatasetPath)
func (*DatasetPath) UnmarshalJSON ¶
func (p *DatasetPath) UnmarshalJSON(b []byte) error
type DatasetPathForest ¶
type DatasetPathForest struct {
// contains filtered or unexported fields
}
func NewDatasetPathForest ¶
func NewDatasetPathForest() *DatasetPathForest
func (*DatasetPathForest) Add ¶
func (f *DatasetPathForest) Add(p *DatasetPath)
func (*DatasetPathForest) WalkTopDown ¶
func (f *DatasetPathForest) WalkTopDown(visitor DatasetPathsVisitor)
Traverse a list of DatasetPaths top down, i.e. given a set of datasets with same path prefix, those with shorter prefix are traversed first. If there are gaps, i.e. the intermediary component a/b between a and a/b/c, those gaps are still visited but the FilledIn property of the visit is set to true.
type DatasetPathVisit ¶
type DatasetPathVisit struct {
Path *DatasetPath
// If true, the dataset referenced by Path was not in the list of datasets to traverse
FilledIn bool
Parent *DatasetPathVisit
}
type DatasetPathsVisitor ¶
type DatasetPathsVisitor func(v *DatasetPathVisit) (visitChildTree bool)
type DestroySnapOp ¶ added in v0.2.0
func (*DestroySnapOp) String ¶ added in v0.2.0
func (o *DestroySnapOp) String() string
type DestroySnapshotsError ¶ added in v0.2.0
type DestroySnapshotsError struct {
RawLines []string
Filesystem string
Undestroyable []string // snapshot name only (filesystem@ stripped)
Reason []string
}
func (*DestroySnapshotsError) Error ¶ added in v0.2.0
func (e *DestroySnapshotsError) Error() string
type DrySendInfo ¶
type DrySendInfo struct {
Type DrySendType
Filesystem string // parsed from To field
From, To string // direct copy from ZFS output
SizeEstimate int64 // -1 if size estimate is not possible
}
func ZFSSendDry ¶
func ZFSSendDry(ctx context.Context, sendArgs ZFSSendArgsValidated) (_ *DrySendInfo, err error)
to may be "", in which case a full ZFS send is done May return BookmarkSizeEstimationNotSupported as err if from is a bookmark.
type DrySendType ¶
type DrySendType string
const ( DrySendTypeFull DrySendType = "full" DrySendTypeIncremental DrySendType = "incremental" )
func DrySendTypeFromString ¶
func DrySendTypeFromString(s string) (DrySendType, error)
type EntityType ¶ added in v0.3.0
type EntityType string
const ( EntityTypeFilesystem EntityType = "filesystem" EntityTypeVolume EntityType = "volume" EntityTypeSnapshot EntityType = "snapshot" EntityTypeBookmark EntityType = "bookmark" )
func (EntityType) MustValidate ¶ added in v0.3.0
func (e EntityType) MustValidate()
func (EntityType) String ¶ added in v0.3.0
func (e EntityType) String() string
func (EntityType) Validate ¶ added in v0.3.0
func (e EntityType) Validate() error
type ErrRecvResumeNotSupported ¶ added in v0.3.0
func (*ErrRecvResumeNotSupported) Error ¶ added in v0.3.0
func (e *ErrRecvResumeNotSupported) Error() string
type FilesystemPlaceholderState ¶
type FilesystemPlaceholderState struct {
FS string
FSExists bool
IsPlaceholder bool
RawLocalPropertyValue string
}
func ZFSGetFilesystemPlaceholderState ¶
func ZFSGetFilesystemPlaceholderState(ctx context.Context, p *DatasetPath) (state *FilesystemPlaceholderState, err error)
ZFSGetFilesystemPlaceholderState is the authoritative way to determine whether a filesystem is a placeholder. Note that the property source must be `local` for the returned value to be valid.
For nonexistent FS, err == nil and state.FSExists == false
type FilesystemVersion ¶
type FilesystemVersion struct {
Type VersionType
// Display name. Should not be used for identification, only for user output
Name string
// GUID as exported by ZFS. Uniquely identifies a snapshot across pools
Guid uint64
// The TXG in which the snapshot was created. For bookmarks,
// this is the GUID of the snapshot it was initially tied to.
CreateTXG uint64
// The time the dataset was created
Creation time.Time
// userrefs field (snapshots only)
UserRefs OptionUint64
}
The data in a FilesystemVersion is guaranteed to stem from a ZFS CLI invocation.
func ParseFilesystemVersion ¶ added in v0.3.0
func ParseFilesystemVersion(args ParseFilesystemVersionArgs) (v FilesystemVersion, err error)
func ZFSBookmark ¶
func ZFSBookmark(ctx context.Context, fs string, v FilesystemVersion, bookmark string) (bm FilesystemVersion, err error)
idempotently create bookmark of the given version v
if `v` is a bookmark, returns ErrBookmarkCloningNotSupported unless a bookmark with the name `bookmark` exists and has the same idenitty (zfs.FilesystemVersionEqualIdentity)
v must be validated by the caller
func ZFSGetFilesystemVersion ¶ added in v0.3.0
func ZFSGetFilesystemVersion(ctx context.Context, ds string) (v FilesystemVersion, _ error)
func ZFSListFilesystemVersions ¶
func ZFSListFilesystemVersions(ctx context.Context, fs *DatasetPath, options ListFilesystemVersionsOptions) (res []FilesystemVersion, err error)
returned versions are sorted by createtxg FIXME drop sort by createtxg requirement
func (FilesystemVersion) FullPath ¶ added in v0.3.0
func (v FilesystemVersion) FullPath(fs string) string
func (FilesystemVersion) GetCreateTXG ¶ added in v0.3.0
func (v FilesystemVersion) GetCreateTXG() uint64
func (FilesystemVersion) GetGUID ¶ added in v0.3.0
func (v FilesystemVersion) GetGUID() uint64
func (FilesystemVersion) GetGuid ¶ added in v0.3.0
func (v FilesystemVersion) GetGuid() uint64
func (FilesystemVersion) GetName ¶ added in v0.3.0
func (v FilesystemVersion) GetName() string
func (FilesystemVersion) IsBookmark ¶ added in v0.3.0
func (v FilesystemVersion) IsBookmark() bool
func (FilesystemVersion) IsSnapshot ¶ added in v0.3.0
func (v FilesystemVersion) IsSnapshot() bool
func (FilesystemVersion) RelName ¶ added in v0.3.0
func (v FilesystemVersion) RelName() string
func (FilesystemVersion) String ¶
func (v FilesystemVersion) String() string
func (FilesystemVersion) ToAbsPath ¶
func (v FilesystemVersion) ToAbsPath(p *DatasetPath) string
func (FilesystemVersion) ToSendArgVersion ¶ added in v0.3.0
func (v FilesystemVersion) ToSendArgVersion() ZFSSendArgVersion
type GetMountpointOutput ¶ added in v0.3.0
func ZFSGetMountpoint ¶ added in v0.3.0
func ZFSGetMountpoint(ctx context.Context, fs string) (*GetMountpointOutput, error)
type ListFilesystemVersionsOptions ¶ added in v0.3.0
type ListFilesystemVersionsOptions struct {
// the prefix of the version name, without the delimiter char
// empty means any prefix matches
ShortnamePrefix string
// which types should be returned
// nil or len(0) means any prefix matches
Types VersionTypeSet
}
type MigrateHashBasedPlaceholderReport ¶
type MigrateHashBasedPlaceholderReport struct {
OriginalState FilesystemPlaceholderState
NeedsModification bool
}
func ZFSMigrateHashBasedPlaceholderToCurrent ¶
func ZFSMigrateHashBasedPlaceholderToCurrent(ctx context.Context, fs *DatasetPath, dryRun bool) (*MigrateHashBasedPlaceholderReport, error)
fs must exist, will panic otherwise
type OptionUint64 ¶ added in v0.3.0
type ParseFilesystemVersionArgs ¶ added in v0.3.0
type ParseFilesystemVersionArgs struct {
// contains filtered or unexported fields
}
type PathValidationError ¶ added in v0.3.0
type PathValidationError struct {
// contains filtered or unexported fields
}
func EntityNamecheck ¶ added in v0.3.0
func EntityNamecheck(path string, t EntityType) (err *PathValidationError)
combines
lib/libzfs/libzfs_dataset.c: zfs_validate_name module/zcommon/zfs_namecheck.c: entity_namecheck
The '%' character is not allowed because it's reserved for zfs-internal use
func (*PathValidationError) Error ¶ added in v0.3.0
func (e *PathValidationError) Error() string
func (*PathValidationError) Path ¶ added in v0.3.0
func (e *PathValidationError) Path() string
type RecvCannotReadFromStreamErr ¶ added in v0.3.0
type RecvCannotReadFromStreamErr struct {
Msg string
}
func (*RecvCannotReadFromStreamErr) Error ¶ added in v0.3.0
func (e *RecvCannotReadFromStreamErr) Error() string
type RecvDestroyOrOverwriteEncryptedErr ¶ added in v0.3.0
type RecvDestroyOrOverwriteEncryptedErr struct {
Msg string
}
func (*RecvDestroyOrOverwriteEncryptedErr) Error ¶ added in v0.3.0
func (e *RecvDestroyOrOverwriteEncryptedErr) Error() string
type RecvFailedWithResumeTokenErr ¶ added in v0.3.0
type RecvFailedWithResumeTokenErr struct {
Msg string
ResumeTokenRaw string
ResumeTokenParsed *ResumeToken
}
func (*RecvFailedWithResumeTokenErr) Error ¶ added in v0.3.0
func (e *RecvFailedWithResumeTokenErr) Error() string
type RecvOptions ¶
type ResumeToken ¶
type ResumeToken struct {
HasFromGUID, HasToGUID bool
FromGUID, ToGUID uint64
ToName string
HasCompressOK, CompressOK bool
HasRawOk, RawOK bool
}
NOTE: Update ZFSSendARgs.Validate when changing fields (potentially SECURITY SENSITIVE)
func ParseResumeToken ¶
func ParseResumeToken(ctx context.Context, token string) (*ResumeToken, error)
Abuse 'zfs send' to decode the resume token
FIXME: implement nvlist unpacking in Go and read through libzfs_sendrecv.c
func (*ResumeToken) ToNameSplit ¶ added in v0.3.0
func (t *ResumeToken) ToNameSplit() (fs *DatasetPath, snapName string, err error)
type SendStream ¶ added in v0.3.0
type SendStream struct {
// contains filtered or unexported fields
}
func ZFSSend ¶
func ZFSSend(ctx context.Context, sendArgs ZFSSendArgsValidated) (*SendStream, error)
if token != "", then send -t token is used otherwise send [-i from] to is used (if from is "" a full ZFS send is done)
Returns ErrEncryptedSendNotSupported if encrypted send is requested but not supported by CLI
func (*SendStream) Close ¶ added in v0.3.0
func (s *SendStream) Close() error
type VersionType ¶
type VersionType string
const ( Bookmark VersionType = "bookmark" Snapshot VersionType = "snapshot" )
func DecomposeVersionString ¶
func DecomposeVersionString(v string) (fs string, versionType VersionType, name string, err error)
func (VersionType) DelimiterChar ¶
func (t VersionType) DelimiterChar() string
func (VersionType) String ¶
func (t VersionType) String() string
type VersionTypeSet ¶ added in v0.3.0
type VersionTypeSet map[VersionType]bool
func (VersionTypeSet) String ¶ added in v0.3.0
func (s VersionTypeSet) String() string
type ZFSListMappingPropertiesResult ¶
type ZFSListMappingPropertiesResult struct {
Path *DatasetPath
// Guaranteed to have the same length as properties in the originating call
Fields []string
}
func ZFSListMappingProperties ¶
func ZFSListMappingProperties(ctx context.Context, filter DatasetFilter, properties []string) (datasets []ZFSListMappingPropertiesResult, err error)
properties must not contain 'name'
type ZFSListResult ¶
type ZFSProperties ¶
type ZFSProperties struct {
// contains filtered or unexported fields
}
func NewZFSProperties ¶
func NewZFSProperties() *ZFSProperties
func ZFSGet ¶
func ZFSGet(ctx context.Context, fs *DatasetPath, props []string) (*ZFSProperties, error)
func ZFSGetRawAnySource ¶ added in v0.2.0
func (*ZFSProperties) Get ¶
func (p *ZFSProperties) Get(key string) string
func (*ZFSProperties) Set ¶
func (p *ZFSProperties) Set(key, val string)
type ZFSSendArgVersion ¶ added in v0.3.0
NOTE: When updating this struct, make sure to update funcs Validate ValidateCorrespondsToResumeToken
func (ZFSSendArgVersion) FullPath ¶ added in v0.3.0
func (v ZFSSendArgVersion) FullPath(fs string) string
func (ZFSSendArgVersion) GetGuid ¶ added in v0.3.0
func (v ZFSSendArgVersion) GetGuid() uint64
func (ZFSSendArgVersion) IsSnapshot ¶ added in v0.3.0
func (v ZFSSendArgVersion) IsSnapshot() bool
func (ZFSSendArgVersion) MustBeBookmark ¶ added in v0.3.0
func (v ZFSSendArgVersion) MustBeBookmark()
func (ZFSSendArgVersion) ToSendArgVersion ¶ added in v0.3.0
func (v ZFSSendArgVersion) ToSendArgVersion() ZFSSendArgVersion
func (ZFSSendArgVersion) ValidateExists ¶ added in v0.3.0
func (a ZFSSendArgVersion) ValidateExists(ctx context.Context, fs string) error
func (ZFSSendArgVersion) ValidateExistsAndGetVersion ¶ added in v0.3.0
func (a ZFSSendArgVersion) ValidateExistsAndGetVersion(ctx context.Context, fs string) (v FilesystemVersion, _ error)
fs must be not empty
func (ZFSSendArgVersion) ValidateInMemory ¶ added in v0.3.0
func (v ZFSSendArgVersion) ValidateInMemory(fs string) error
type ZFSSendArgsResumeTokenMismatchError ¶ added in v0.3.0
type ZFSSendArgsResumeTokenMismatchError struct {
What ZFSSendArgsResumeTokenMismatchErrorCode
Err error
}
func (*ZFSSendArgsResumeTokenMismatchError) Error ¶ added in v0.3.0
func (e *ZFSSendArgsResumeTokenMismatchError) Error() string
type ZFSSendArgsResumeTokenMismatchErrorCode ¶ added in v0.3.0
type ZFSSendArgsResumeTokenMismatchErrorCode int
const ( ZFSSendArgsResumeTokenMismatchGeneric ZFSSendArgsResumeTokenMismatchErrorCode = 1 + iota ZFSSendArgsResumeTokenMismatchEncryptionNotSet // encryption not set in token but required by send args ZFSSendArgsResumeTokenMismatchEncryptionSet // encryption not set in token but not required by send args ZFSSendArgsResumeTokenMismatchFilesystem )
The format is ZFSSendArgsResumeTokenMismatch+WhatIsWrongInToken
type ZFSSendArgsUnvalidated ¶ added in v0.3.0
type ZFSSendArgsUnvalidated struct {
FS string
From, To *ZFSSendArgVersion // From may be nil
Encrypted *NilBool
// Preferred if not empty
ResumeToken string // if not nil, must match what is specified in From, To (covered by ValidateCorrespondsToResumeToken)
}
When updating this struct, check Validate and ValidateCorrespondsToResumeToken (POTENTIALLY SECURITY SENSITIVE)
func (ZFSSendArgsUnvalidated) Validate ¶ added in v0.3.0
func (a ZFSSendArgsUnvalidated) Validate(ctx context.Context) (v ZFSSendArgsValidated, _ error)
- Recursively call Validate on each field. - Make sure that if ResumeToken != "", it reflects the same operation as the other parameters would.
This function is not pure because GUIDs are checked against the local host's datasets.
type ZFSSendArgsValidated ¶ added in v0.3.0
type ZFSSendArgsValidated struct {
ZFSSendArgsUnvalidated
FromVersion *FilesystemVersion
ToVersion FilesystemVersion
}
type ZFSSendArgsValidationError ¶ added in v0.3.0
type ZFSSendArgsValidationError struct {
Args ZFSSendArgsUnvalidated
What ZFSSendArgsValidationErrorCode
Msg error
}
func (ZFSSendArgsValidationError) Error ¶ added in v0.3.0
func (e ZFSSendArgsValidationError) Error() string
type ZFSSendArgsValidationErrorCode ¶ added in v0.3.0
type ZFSSendArgsValidationErrorCode int
const ( ZFSSendArgsGenericValidationError ZFSSendArgsValidationErrorCode = 1 + iota ZFSSendArgsEncryptedSendRequestedButFSUnencrypted ZFSSendArgsFSEncryptionCheckFail ZFSSendArgsResumeTokenMismatch )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package zfscmd provides a wrapper around packate os/exec.
|
Package zfscmd provides a wrapper around packate os/exec. |
|
zfscmd-logging-scraper
command
|