forked from TrueCloudLab/restic
sftp: Rename Open/Create
This commit is contained in:
parent
1086528ab7
commit
2e53af1b75
3 changed files with 10 additions and 10 deletions
|
@ -388,7 +388,7 @@ func open(s string, opts options.Options) (restic.Backend, error) {
|
|||
case "local":
|
||||
be, err = local.Open(cfg.(local.Config))
|
||||
case "sftp":
|
||||
be, err = sftp.OpenWithConfig(cfg.(sftp.Config))
|
||||
be, err = sftp.Open(cfg.(sftp.Config))
|
||||
case "s3":
|
||||
be, err = s3.Open(cfg.(s3.Config))
|
||||
case "rest":
|
||||
|
@ -422,7 +422,7 @@ func create(s string, opts options.Options) (restic.Backend, error) {
|
|||
case "local":
|
||||
return local.Create(cfg.(local.Config))
|
||||
case "sftp":
|
||||
return sftp.CreateWithConfig(cfg.(sftp.Config))
|
||||
return sftp.Create(cfg.(sftp.Config))
|
||||
case "s3":
|
||||
return s3.Open(cfg.(s3.Config))
|
||||
case "rest":
|
||||
|
|
|
@ -153,9 +153,9 @@ func buildSSHCommand(cfg Config) []string {
|
|||
return args
|
||||
}
|
||||
|
||||
// OpenWithConfig opens an sftp backend as described by the config by running
|
||||
// Open opens an sftp backend as described by the config by running
|
||||
// "ssh" with the appropriate arguments.
|
||||
func OpenWithConfig(cfg Config) (*SFTP, error) {
|
||||
func Open(cfg Config) (*SFTP, error) {
|
||||
debug.Log("config %#v", cfg)
|
||||
|
||||
if cfg.Command == "" {
|
||||
|
@ -171,8 +171,8 @@ func OpenWithConfig(cfg Config) (*SFTP, error) {
|
|||
}
|
||||
|
||||
// create creates all the necessary files and directories for a new sftp
|
||||
// backend at dir. Afterwards a new config blob should be created. `dir` must
|
||||
// be delimited by forward slashes ("/"), which is required by sftp.
|
||||
// backend at dir. `dir` must be delimited by forward slashes ("/"), which is
|
||||
// required by sftp.
|
||||
func create(dir string, program string, args ...string) (*SFTP, error) {
|
||||
debug.Log("create() %v %v", program, args)
|
||||
sftp, err := startClient(program, args...)
|
||||
|
@ -204,9 +204,9 @@ func create(dir string, program string, args ...string) (*SFTP, error) {
|
|||
return open(dir, program, args...)
|
||||
}
|
||||
|
||||
// CreateWithConfig creates an sftp backend as described by the config by running
|
||||
// Create creates an sftp backend as described by the config by running
|
||||
// "ssh" with the appropriate arguments.
|
||||
func CreateWithConfig(cfg Config) (*SFTP, error) {
|
||||
func Create(cfg Config) (*SFTP, error) {
|
||||
debug.Log("config %#v", cfg)
|
||||
if cfg.Command == "" {
|
||||
return create(cfg.Dir, "ssh", buildSSHCommand(cfg)...)
|
||||
|
|
|
@ -63,7 +63,7 @@ func init() {
|
|||
|
||||
cfg.Dir = tempBackendDir
|
||||
|
||||
return sftp.CreateWithConfig(cfg)
|
||||
return sftp.Create(cfg)
|
||||
}
|
||||
|
||||
test.OpenFn = func() (restic.Backend, error) {
|
||||
|
@ -74,7 +74,7 @@ func init() {
|
|||
|
||||
cfg.Dir = tempBackendDir
|
||||
|
||||
return sftp.OpenWithConfig(cfg)
|
||||
return sftp.Open(cfg)
|
||||
}
|
||||
|
||||
test.CleanupFn = func() error {
|
||||
|
|
Loading…
Reference in a new issue