Documentation ¶
Overview ¶
Package filetransfer implements the exchange of files between cdgb <-> debugd and between debugd <-> debugd pairs.
Index ¶
Constants ¶
const ( // ShowProgress indicates that progress should be shown. ShowProgress = true // DontShowProgress indicates that progress should not be shown. DontShowProgress = false )
Variables ¶
var ( // ErrReceiveRunning is returned if a file receive is already running. ErrReceiveRunning = errors.New("receive already running") // ErrReceiveFinished is returned if a file receive has already finished. ErrReceiveFinished = errors.New("receive finished") )
Functions ¶
This section is empty.
Types ¶
type FileStat ¶
type FileStat struct { SourcePath string TargetPath string Mode fs.FileMode OverrideServiceUnit string // optional name of the service unit to override }
FileStat contains the metadata of a file that can be up/downloaded.
type FileTransferer ¶
type FileTransferer struct {
// contains filtered or unexported fields
}
FileTransferer manages sending and receiving of files.
func New ¶
func New(log *logger.Logger, streamer streamReadWriter, showProgress bool) *FileTransferer
New creates a new FileTransferer.
func (*FileTransferer) CanSend ¶
func (s *FileTransferer) CanSend() bool
CanSend returns true if the file receive has finished. This is called to determine if a debugd instance can request files from this server.
func (*FileTransferer) GetFiles ¶
func (s *FileTransferer) GetFiles() []FileStat
GetFiles returns the a copy of the list of files that have been received.
func (*FileTransferer) RecvFiles ¶
func (s *FileTransferer) RecvFiles(stream RecvFilesStream) (err error)
RecvFiles receives files from the given stream.
func (*FileTransferer) SendFiles ¶
func (s *FileTransferer) SendFiles(stream SendFilesStream) error
SendFiles sends files to the given stream.
func (*FileTransferer) SetFiles ¶
func (s *FileTransferer) SetFiles(files []FileStat)
SetFiles sets the list of files that can be sent.
type RecvFilesStream ¶
type RecvFilesStream interface {
Recv() (*pb.FileTransferMessage, error)
}
RecvFilesStream is a stream that receives FileTransferMessages.
type SendFilesStream ¶
type SendFilesStream interface {
Send(*pb.FileTransferMessage) error
}
SendFilesStream is a stream that sends FileTransferMessages.