Documentation ¶
Index ¶
- type FileTransferNotification
- type ITorrxferServer
- type RPCFile
- func (f *RPCFile) GetCreationTime() time.Time
- func (f *RPCFile) GetDataHash() string
- func (f *RPCFile) GetFileName() string
- func (f *RPCFile) GetMediaPath() string
- func (f *RPCFile) GetModifiedTime() time.Time
- func (f *RPCFile) GetRemoteSize() uint64
- func (f *RPCFile) GetSize() uint64
- func (f *RPCFile) SetMediaPath(mediaDirectory string) error
- type RPCTorrxferServer
- type TorrxferServerConnection
- type TransferNotificationType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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 ¶
NewFileFromGrpc returns a RPCFile from a gRPC wire file object
func (*RPCFile) GetCreationTime ¶
GetCreationTime creation time
func (*RPCFile) GetMediaPath ¶
GetMediaPath media root directory
func (*RPCFile) GetModifiedTime ¶
GetModifiedTime modified time
func (*RPCFile) GetRemoteSize ¶
GetRemoteSize returns the size of the file on the server
func (*RPCFile) SetMediaPath ¶
SetMediaPath sets the media path to convey the folder structure on the server side
type RPCTorrxferServer ¶
type RPCTorrxferServer struct { pb.UnimplementedRpcTorrxferServerServer // 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 ¶
QueryFile wrapper around gRPC query file. Called by gRPC, should not be called directly
func (*RPCTorrxferServer) TransferFile ¶
func (s *RPCTorrxferServer) TransferFile(stream pb.RpcTorrxferServer_TransferFileServer) error
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 TransferNotificationTypeBytes // TransferNotificationTypeClosed Closed connection TransferNotificationTypeClosed )