MCPcopy
hub / github.com/wal-g/wal-g / Client

Method Client

pkg/storages/sh/sftp_lazy.go:41–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41func (l *SFTPLazy) Client() (SFTPClient, error) {
42 // Establish the SFTP connection only once on the first call, and reuse the connection in all subsequent calls
43 l.once.Do(func() {
44 client, err := connect(l.address, l.config)
45 if err != nil {
46 l.connErr = fmt.Errorf("lazy SSH connection error: %w", err)
47 }
48 l.client = client
49 })
50 return l.client, l.connErr
51}
52
53func connect(addr string, config *ssh.ClientConfig) (*sftp.Client, error) {
54 sshClient, err := ssh.Dial("tcp", addr, config)

Callers 6

CloseMethod · 0.45
ListFolderMethod · 0.45
DeleteObjectsMethod · 0.45
ExistsMethod · 0.45
ReadObjectMethod · 0.45
PutObjectMethod · 0.45

Calls 2

connectFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected