-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetransfer.repository.interface.go
25 lines (22 loc) · 1.18 KB
/
filetransfer.repository.interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package service
import (
"context"
pb "github.com/xhsun/grpc-file-transfer/dfs"
)
//go:generate mockery --srcpkg=github.com/xhsun/grpc-file-transfer/client/internal/file/service --name=IFileTransferRepository --output=../../mock --outpkg=mock --structname=FileTransferRepositoryMock --filename=filetransfer.repository.mock.go
type IFileTransferRepository interface {
//UploadStream - Get upload stream to store file to server
UploadStream(ctx context.Context) (pb.FileTransfer_StoreClient, error)
//Upload - Upload file chunk to to server
Upload(stream pb.FileTransfer_StoreClient, fileName string, fileChunk []byte) error
//UploadClose - Notify server upload completed
UploadClose(stream pb.FileTransfer_StoreClient) error
//DownloadStream - Get download stream to fetch file from server
DownloadStream(ctx context.Context, fileName string) (pb.FileTransfer_FetchClient, error)
//Download - Download file chunk from server
Download(stream pb.FileTransfer_FetchClient) ([]byte, int, error)
//ServerFileList - Get list of files from server
ServerFileList(ctx context.Context) (map[string]uint64, error)
//Delete - Delete file from server
Delete(ctx context.Context, fileName string) error
}