Use copy file range from sysx

Use pooled buffers for copy

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2017-02-02 10:28:25 -08:00
parent bb9f6b568d
commit 572dbcdbd4
3 changed files with 32 additions and 59 deletions

View file

@ -4,10 +4,19 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sync"
"github.com/pkg/errors"
)
var (
bufferPool = &sync.Pool{
New: func() interface{} {
return make([]byte, 32*1024)
},
}
)
// CopyDirectory copies the directory from src to dst.
// Most efficient copy of files is attempted.
func CopyDirectory(dst, src string) error {