func NewBackuper(c *Config, snapSuff string) (*Backuper, error) { srcZfs, err := zfs.NewZfs(runcmd.NewLocalRunner()) if err != nil { return nil, err } dstZfs, err := zfs.NewZfs(runcmd.NewRemoteKeyAuthRunner(c.User, c.Host, c.Key)) if err != nil { return nil, err } return &Backuper{srcZfs, dstZfs, c, snapSuff}, nil }
func loadConfigFromArgs( property, remote, expire, host, user, key string, maxio int, ) (*Config, error) { config := new(Config) config.Backup = make([]Backup, 0) config.Host = host config.User = user config.Key = key config.MaxIoThreads = maxio srcZfs, err := zfs.NewZfs(runcmd.NewLocalRunner()) if err != nil { return nil, err } list, err := srcZfs.List("", zfs.FS, true) if err != nil { return nil, err } for _, fs := range list { out, err := srcZfs.Property(fs, property) if err != nil { return nil, err } if out == "true" { config.Backup = append( config.Backup, Backup{false, expire, fs, remote, ""}, ) } } return config, nil }