mirror of
https://github.com/zrepl/zrepl.git
synced 2025-06-30 22:40:05 +02:00
Make zfs.DatasetPath json.Marshaler and json.Unmarshaler
Had to resort to using pointers to zfs.DatasetPath everywhere... Should find a better solution for that.
This commit is contained in:
@ -3,10 +3,10 @@ package zfs
|
||||
import "fmt"
|
||||
|
||||
type DatasetFilter interface {
|
||||
Filter(p DatasetPath) (pass bool, err error)
|
||||
Filter(p *DatasetPath) (pass bool, err error)
|
||||
}
|
||||
|
||||
func ZFSListMapping(filter DatasetFilter) (datasets []DatasetPath, err error) {
|
||||
func ZFSListMapping(filter DatasetFilter) (datasets []*DatasetPath, err error) {
|
||||
|
||||
if filter == nil {
|
||||
panic("filter must not be nil")
|
||||
@ -15,11 +15,11 @@ func ZFSListMapping(filter DatasetFilter) (datasets []DatasetPath, err error) {
|
||||
var lines [][]string
|
||||
lines, err = ZFSList([]string{"name"}, "-r", "-t", "filesystem,volume")
|
||||
|
||||
datasets = make([]DatasetPath, 0, len(lines))
|
||||
datasets = make([]*DatasetPath, 0, len(lines))
|
||||
|
||||
for _, line := range lines {
|
||||
|
||||
var path DatasetPath
|
||||
var path *DatasetPath
|
||||
if path, err = NewDatasetPath(line[0]); err != nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user