storj/cmd/uplink/ulfs/local_backend_os.go
Jeff Wendling 89ccfe2dd7 cmd/uplink: fix recursive copy and improve tests
recursive copy had a bug with relative local paths.

this fixes that bug and changes the test framework
to use more of the code that actually runs in uplink
and only mocks out the direct interaction with the
operating system.

Change-Id: I9da2a80bfda8f86a8d05879b87171f299f759c7e
2022-05-11 15:17:16 -04:00

45 lines
1.0 KiB
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package ulfs
import "os"
// LocalBackendOS implements LocalBackend by using the os package.
type LocalBackendOS struct{}
// NewLocalBackendOS constructs a new LocalBackendOS.
func NewLocalBackendOS() *LocalBackendOS {
return new(LocalBackendOS)
}
// Create calls os.Create.
func (l *LocalBackendOS) Create(name string) (LocalBackendFile, error) {
return os.Create(name)
}
// MkdirAll calls os.MkdirAll.
func (l *LocalBackendOS) MkdirAll(path string, perm os.FileMode) error {
return os.MkdirAll(path, perm)
}
// Open calls os.Open.
func (l *LocalBackendOS) Open(name string) (LocalBackendFile, error) {
return os.Open(name)
}
// Remove calls os.Remove.
func (l *LocalBackendOS) Remove(name string) error {
return os.Remove(name)
}
// Rename calls os.Rename.
func (l *LocalBackendOS) Rename(oldname, newname string) error {
return os.Rename(oldname, newname)
}
// Stat calls os.Stat.
func (l *LocalBackendOS) Stat(name string) (os.FileInfo, error) {
return os.Stat(name)
}