mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-09 07:05:47 +02:00
zfs: implement ZFSSend
This commit is contained in:
21
zfs/diff.go
21
zfs/diff.go
@ -1,6 +1,7 @@
|
||||
package zfs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
@ -15,6 +16,18 @@ const (
|
||||
Snapshot = "snapshot"
|
||||
)
|
||||
|
||||
func (t VersionType) DelimiterChar() string {
|
||||
switch t {
|
||||
case Bookmark:
|
||||
return "#"
|
||||
case Snapshot:
|
||||
return "@"
|
||||
default:
|
||||
panic(fmt.Sprintf("unexpected VersionType %#v", t))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type FilesystemVersion struct {
|
||||
Type VersionType
|
||||
|
||||
@ -29,6 +42,14 @@ type FilesystemVersion struct {
|
||||
CreateTXG uint64
|
||||
}
|
||||
|
||||
func (v FilesystemVersion) ToAbsPath(p DatasetPath) string {
|
||||
var b bytes.Buffer
|
||||
b.WriteString(p.ToString())
|
||||
b.WriteString(v.Type.DelimiterChar())
|
||||
b.WriteString(v.Name)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
type fsbyCreateTXG []FilesystemVersion
|
||||
|
||||
func (l fsbyCreateTXG) Len() int { return len(l) }
|
||||
|
Reference in New Issue
Block a user