'zrok copy' now supports copy and oneway sync (#438)

This commit is contained in:
Michael Quigley
2024-01-11 11:36:05 -05:00
parent 3b35250024
commit e40df8c101
4 changed files with 27 additions and 6 deletions

View File

@@ -6,15 +6,18 @@ import (
"os"
)
func Synchronize(src, dst Target) error {
func OneWay(src, dst Target, sync bool) error {
srcTree, err := src.Inventory()
if err != nil {
return errors.Wrap(err, "error creating source inventory")
}
dstTree, err := dst.Inventory()
if err != nil {
return errors.Wrap(err, "error creating destination inventory")
var dstTree []*Object
if sync {
dstTree, err = dst.Inventory()
if err != nil {
return errors.Wrap(err, "error creating destination inventory")
}
}
dstIndex := make(map[string]*Object)