filetransfer

package
v0.0.0-...-f0ab10a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

func File(filename string) ([]string, []string, error)

File is used for finding a file.

func InitFTDB

func InitFTDB(s FTStore)

InitFTDB initializes the FileTransfer DB

func InitFilesDB

func InitFilesDB(s FilesStore)

InitFilesDB initializes the NodeConfigDB

func ListFiles

func ListFiles(ctx context.Context, ftclient pb.FTServiceClient, remdir *pb.RemoteDirectory) error

ListFiles lists files on Remote Server

func ListFilesCondition

func ListFilesCondition(ctx context.Context, ftclient pb.FTServiceClient) error

ListFilesCondition - needs input args refactoring required.

func PullFiles

func PullFiles(ctx context.Context, ftclient pb.FTServiceClient, remdir *pb.RemoteDirectory) error

PullFiles pulls files from remote sever onto current server.

Types

type BadgerDB

type BadgerDB struct {
	FilesDB        *badger.DB
	FileTransferDB *badger.DB
}

BadgerDB is the DB instance for BadgerDB

func (BadgerDB) AddFile

func (badgerDB BadgerDB) AddFile(key string, value *sftp.TransferConfig) error

AddFile adds a new file in the Files DB Key is the full path of the destination file. Value is TransferConfig for the file.

func (BadgerDB) CheckFileExists

func (badgerDB BadgerDB) CheckFileExists(key []byte) (bool, error)

CheckFileExists checks if a file exists in the database.

func (BadgerDB) Close

func (badgerDB BadgerDB) Close() error

Close close the database.

func (BadgerDB) CloseFTDB

func (badgerDB BadgerDB) CloseFTDB() error

CloseFTDB closes the FileTransfer Database

func (BadgerDB) DeleteFile

func (badgerDB BadgerDB) DeleteFile(key string) error

DeleteFile removes a file from the Files DB

func (BadgerDB) GetFile

func (badgerDB BadgerDB) GetFile() error

GetFile gets a file from Files DB

func (BadgerDB) ListFiles

func (badgerDB BadgerDB) ListFiles() error

ListFiles lists all the files in the DB.

type DataStore

type DataStore struct {
	Files        FilesStore
	FileTransfer FTStore
}

DataStore is the struct containing the FilesDB and ConfigDB Interfaces.

var Data DataStore

Data is the instance of DataStore

type FTServer

type FTServer struct{}

FTServer implements the methods for the FT grpc service.

func (*FTServer) ListDir

func (s *FTServer) ListDir(in *pb.RemoteDirectory, stream pb.FTService_ListDirServer) error

ListDir implements grpc server function for listing a directory recursively and returning the files as a stream.

func (*FTServer) ListDirCondition

ListDirCondition lists a directory recursively and returns the files as a stream after evaluating a condition.

type FTStore

type FTStore interface {
	CloseFTDB() error
}

FTStore is the interface for the FileTransfer DB

type FilesStore

type FilesStore interface {
	CheckFileExists([]byte) (bool, error)
	AddFile(string, *sftp.TransferConfig) error
	GetFile() error
	DeleteFile(string) error
	CloseFilesDB() error
}

FilesStore is the main interface for the backend

type ListDirSender

type ListDirSender interface {
	Send(*pb.RemoteFile) error
	grpc.ServerStream
}

ListDirSender is the interface for passing object to stream RemoteFile response

type RemoteFTServer

type RemoteFTServer struct{}

RemoteFTServer implements the methods for the RemoteFT grpc service

func (*RemoteFTServer) TransferFile

Jump to

Keyboard shortcuts

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