filetransfer

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filetransfer implements the exchange of files between cdgb <-> debugd and between debugd <-> debugd pairs.

Index

Constants

View Source
const (
	// ShowProgress indicates that progress should be shown.
	ShowProgress = true
	// DontShowProgress indicates that progress should not be shown.
	DontShowProgress = false
)

Variables

View Source
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.

Directories

Path Synopsis
Package streamer implements streaming of files over gRPC.
Package streamer implements streaming of files over gRPC.

Jump to

Keyboard shortcuts

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