This section is empty.


This section is empty.


This section is empty.


type FileTransferNotification

type FileTransferNotification struct {
	NotificationType TransferNotificationType
	Filepath         string
	LastTransferred  uint64
	CurrentOffset    uint64
	Error            error

FileTransferNotification Updated file notification

type ITorrxferServer

type ITorrxferServer interface {
	QueryFunction(clientID string, file *RPCFile) (*RPCFile, error)
	TransferFunction(clientID string, fileBytes []byte, blockSize uint32, currentOffset uint64) error
	RegisterForWriteNotification(clientID string) (chan error, chan struct{})
	Close(clientID string)

ITorrxferServer Server interface representation for client

type RPCFile

type RPCFile struct {
	// contains filtered or unexported fields

RPCFile wraps around the gRPC RPCFile type. This file structure should be used by both client and server during the transfer

func NewFile

func NewFile(filePath string) (*RPCFile, error)

NewFile constructs a new file object that wraps around the gRPC struct This function can be called on files that don't exist

func NewFileFromGrpc

func NewFileFromGrpc(grpcFile *pb.File) *RPCFile

NewFileFromGrpc returns a RPCFile from a gRPC wire file object

func (*RPCFile) GetCreationTime

func (f *RPCFile) GetCreationTime() time.Time

GetCreationTime creation time

func (*RPCFile) GetDataHash

func (f *RPCFile) GetDataHash() string

GetDataHash data hash

func (*RPCFile) GetFileName

func (f *RPCFile) GetFileName() string

GetFileName file name

func (*RPCFile) GetMediaPath

func (f *RPCFile) GetMediaPath() string

GetMediaPath media root directory

func (*RPCFile) GetModifiedTime

func (f *RPCFile) GetModifiedTime() time.Time

GetModifiedTime modified time

func (*RPCFile) GetRemoteSize

func (f *RPCFile) GetRemoteSize() uint64

GetRemoteSize returns the size of the file on the server

func (*RPCFile) GetSize

func (f *RPCFile) GetSize() uint64

GetSize size

func (*RPCFile) SetMediaPath

func (f *RPCFile) SetMediaPath(mediaDirectory string) error

SetMediaPath sets the media path to convey the folder structure on the server side

type RPCTorrxferServer

type RPCTorrxferServer struct {
	// contains filtered or unexported fields

RPCTorrxferServer wrapper around grpc server

func NewRPCTorrxferServer

func NewRPCTorrxferServer(torrxferServer ITorrxferServer) (server *RPCTorrxferServer)

NewRPCTorrxferServer creates a new torrxfer rpc server

func (*RPCTorrxferServer) QueryFile

func (s *RPCTorrxferServer) QueryFile(ctx context.Context, file *pb.File) (*pb.File, error)

QueryFile wrapper around gRPC query file. Called by gRPC, should not be called directly

func (*RPCTorrxferServer) TransferFile

TransferFile wrapper around gRPC TransferFile. Called by gRPC, should not be called directly

type TorrxferServerConnection

type TorrxferServerConnection interface {
	QueryFile(file string, mediaPrefix string, correlationUUID string) (*RPCFile, error)
	TransferFile(fileBytes *io.PipeReader, blockSize uint32, offset uint64, correlationUUID string) (fileSummaryChan chan FileTransferNotification, err error)

TorrxferServerConnection represents a wrapper around the gRPC mechanisms to talk to the torrxfer server

func NewTorrxferServerConnection

func NewTorrxferServerConnection(server common.ServerConnectionConfig) (TorrxferServerConnection, error)

NewTorrxferServerConnection constructs a new server connection given server config

type TransferNotificationType

type TransferNotificationType uint8

TransferNotificationType is an iota

const (
	// TransferNotificationTypeError Error
	TransferNotificationTypeError TransferNotificationType = iota
	// TransferNotificationTypeBytes sent bytes
	// TransferNotificationTypeClosed Closed connection