Documentation ¶
Overview ¶
Package remote contains helpers for network operations.
Index ¶
- Variables
- func Idempotent(ctx context.Context, fun func() error) error
- func IsRetriable(err error) bool
- type CloseableSFTPClient
- type ReconnectingSFTPClient
- func (c *ReconnectingSFTPClient) Chmod(path string, mode os.FileMode) error
- func (c *ReconnectingSFTPClient) Chown(path string, uid, gid int) error
- func (c *ReconnectingSFTPClient) Chtimes(path string, atime time.Time, mtime time.Time) error
- func (c *ReconnectingSFTPClient) Close() error
- func (c *ReconnectingSFTPClient) Create(path string) (f *sftp.File, err error)
- func (c *ReconnectingSFTPClient) Link(oldname, newname string) error
- func (c *ReconnectingSFTPClient) Lstat(path string) (fi os.FileInfo, err error)
- func (c *ReconnectingSFTPClient) Mkdir(path string) error
- func (c *ReconnectingSFTPClient) Open(path string) (f *sftp.File, err error)
- func (c *ReconnectingSFTPClient) PosixRename(oldname, newname string) error
- func (c *ReconnectingSFTPClient) ReadDir(path string) (fis []os.FileInfo, err error)
- func (c *ReconnectingSFTPClient) ReadLink(path string) (s string, err error)
- func (c *ReconnectingSFTPClient) Remove(path string) error
- func (c *ReconnectingSFTPClient) RemoveDirectory(path string) error
- func (c *ReconnectingSFTPClient) StatVFS(path string) (st *sftp.StatVFS, err error)
- func (c *ReconnectingSFTPClient) Symlink(oldname, newname string) error
- type SFTPClient
Constants ¶
This section is empty.
Variables ¶
var ErrClientClosed = errors.New("client is closed")
ErrClientClosed signals that Close was called, so no new operations could be started.
Functions ¶
func Idempotent ¶
Idempotent retries an idempotent function until it succeeds or returns a non-retriable error. If the context is cancelled, the function will return during a back-off.
func IsRetriable ¶
Returns whether it makes sense to retry on this kind of error.
Types ¶
type CloseableSFTPClient ¶
type CloseableSFTPClient interface { SFTPClient // Close releases resources used by this client. Close() error }
A CloseableSFTPClient can, in addition to SFTPClient operations, also be closed cleanly.
type ReconnectingSFTPClient ¶
type ReconnectingSFTPClient struct {
// contains filtered or unexported fields
}
A ReconnectingSFTPClient will reconnect if a disconnect happens, but will not do retries on its own.
func NewReconnectingSFTPClient ¶
func NewReconnectingSFTPClient(dialer func() (CloseableSFTPClient, error)) (*ReconnectingSFTPClient, error)
NewReconnectingSFTPClient creates a new client using the given dialer. An error is returned if the dialer couldn't create an initial client.
func (*ReconnectingSFTPClient) Chmod ¶
func (c *ReconnectingSFTPClient) Chmod(path string, mode os.FileMode) error
func (*ReconnectingSFTPClient) Chown ¶
func (c *ReconnectingSFTPClient) Chown(path string, uid, gid int) error
func (*ReconnectingSFTPClient) Close ¶
func (c *ReconnectingSFTPClient) Close() error
Close closes the open client, and makes new operations fail with ErrClientClosed.
func (*ReconnectingSFTPClient) Create ¶
func (c *ReconnectingSFTPClient) Create(path string) (f *sftp.File, err error)
func (*ReconnectingSFTPClient) Link ¶
func (c *ReconnectingSFTPClient) Link(oldname, newname string) error
func (*ReconnectingSFTPClient) Lstat ¶
func (c *ReconnectingSFTPClient) Lstat(path string) (fi os.FileInfo, err error)
func (*ReconnectingSFTPClient) Mkdir ¶
func (c *ReconnectingSFTPClient) Mkdir(path string) error
func (*ReconnectingSFTPClient) Open ¶
func (c *ReconnectingSFTPClient) Open(path string) (f *sftp.File, err error)
func (*ReconnectingSFTPClient) PosixRename ¶
func (c *ReconnectingSFTPClient) PosixRename(oldname, newname string) error
func (*ReconnectingSFTPClient) ReadDir ¶
func (c *ReconnectingSFTPClient) ReadDir(path string) (fis []os.FileInfo, err error)
func (*ReconnectingSFTPClient) ReadLink ¶
func (c *ReconnectingSFTPClient) ReadLink(path string) (s string, err error)
func (*ReconnectingSFTPClient) Remove ¶
func (c *ReconnectingSFTPClient) Remove(path string) error
func (*ReconnectingSFTPClient) RemoveDirectory ¶
func (c *ReconnectingSFTPClient) RemoveDirectory(path string) error
func (*ReconnectingSFTPClient) StatVFS ¶
func (c *ReconnectingSFTPClient) StatVFS(path string) (st *sftp.StatVFS, err error)
func (*ReconnectingSFTPClient) Symlink ¶
func (c *ReconnectingSFTPClient) Symlink(oldname, newname string) error
type SFTPClient ¶
type SFTPClient interface { Chmod(path string, mode os.FileMode) error Chown(path string, uid, gid int) error Chtimes(path string, atime time.Time, mtime time.Time) error Create(path string) (*sftp.File, error) Link(oldname, newname string) error Lstat(path string) (os.FileInfo, error) Mkdir(path string) error Open(path string) (*sftp.File, error) PosixRename(oldname, newname string) error ReadDir(path string) ([]os.FileInfo, error) ReadLink(path string) (string, error) Remove(path string) error RemoveDirectory(path string) error StatVFS(path string) (*sftp.StatVFS, error) Symlink(oldname, newname string) error }
An SFTPClient abstracts github.com/pkg/sftp.Client.