sftp

package
v0.0.0-...-17ee6b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2015 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package sftp implements repository storage in a directory on a remote server via the sftp protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SFTP

type SFTP struct {
	// contains filtered or unexported fields
}

func Create

func Create(dir string, program string, args ...string) (*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.

func Open

func Open(dir string, program string, args ...string) (*SFTP, error)

Open opens an sftp backend. When the command is started via exec.Command, it is expected to speak sftp on stdin/stdout. The backend is expected at the given path.

func (*SFTP) Close

func (s *SFTP) Close() error

Close closes the sftp connection and terminates the underlying command.

func (*SFTP) Create

func (r *SFTP) Create() (backend.Blob, error)

Create creates a new Blob. The data is available only after Finalize() has been called on the returned Blob.

func (*SFTP) Get

func (r *SFTP) Get(t backend.Type, name string) (io.ReadCloser, error)

Get returns a reader that yields the content stored under the given name. The reader should be closed after draining it.

func (*SFTP) GetReader

func (r *SFTP) GetReader(t backend.Type, name string, offset, length uint) (io.ReadCloser, error)

GetReader returns an io.ReadCloser for the Blob with the given name of type t at offset and length. If length is 0, the reader reads until EOF.

func (*SFTP) List

func (r *SFTP) List(t backend.Type, done <-chan struct{}) <-chan string

List returns a channel that yields all names of blobs of type t. A goroutine is started for this. If the channel done is closed, sending stops.

func (*SFTP) Location

func (r *SFTP) Location() string

Location returns this backend's location (the directory name).

func (*SFTP) Remove

func (r *SFTP) Remove(t backend.Type, name string) error

Remove removes the content stored at name.

func (*SFTP) Test

func (r *SFTP) Test(t backend.Type, name string) (bool, error)

Test returns true if a blob of the given type and name exists in the backend.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL