Documentation ¶
Index ¶
- func File(filename string) ([]string, []string, error)
- func InitFTDB(s FTStore)
- func InitFilesDB(s FilesStore)
- func ListFiles(ctx context.Context, ftclient pb.FTServiceClient, remdir *pb.RemoteDirectory) error
- func ListFilesCondition(ctx context.Context, ftclient pb.FTServiceClient) error
- func PullFiles(ctx context.Context, ftclient pb.FTServiceClient, remdir *pb.RemoteDirectory) error
- type BadgerDB
- func (badgerDB BadgerDB) AddFile(key string, value *sftp.TransferConfig) error
- func (badgerDB BadgerDB) CheckFileExists(key []byte) (bool, error)
- func (badgerDB BadgerDB) Close() error
- func (badgerDB BadgerDB) CloseFTDB() error
- func (badgerDB BadgerDB) DeleteFile(key string) error
- func (badgerDB BadgerDB) GetFile() error
- func (badgerDB BadgerDB) ListFiles() error
- type DataStore
- type FTServer
- type FTStore
- type FilesStore
- type ListDirSender
- type RemoteFTServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
CheckFileExists checks if a file exists in the database.
func (BadgerDB) DeleteFile ¶
DeleteFile removes a file from the Files 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 ¶
func (s *FTServer) ListDirCondition(in *pb.RemoteDirectoryCondition, stream pb.FTService_ListDirConditionServer) error
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) TransferCondition ¶
func (s *RemoteFTServer) TransferCondition(in *pb.RemoteDirectoryConditionTransfer, stream pb.RemoteFTService_TransferConditionServer) error
func (*RemoteFTServer) TransferFile ¶
func (s *RemoteFTServer) TransferFile(in *pb.RemoteDirectoryTransfer, stream pb.RemoteFTService_TransferFileServer) error