forked from arpitm91/CMPE-275-Fall2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_transfer.proto
87 lines (65 loc) · 1.73 KB
/
file_transfer.proto
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
syntax = "proto3";
package grpc;
message RequestFileList {
bool isClient=1; // true then client else other team
}
message FileInfo {
string fileName = 1; // teamname_fileid (unique)
}
message FileUploadInfo {
string fileName = 1; // teamname_fileid (unique)
float fileSize = 2;
int64 maxChunks = 3;
}
message ChunkInfo {
string fileName = 1;
int64 chunkId = 2; // Starts from 0 - N
int64 startSeqNum = 3;
}
message FileMetaData {
string fileName = 1;
int64 chunkId = 2;
bytes data = 3;
int64 seqNum = 4;
int64 seqMax = 5;
}
message FileUploadData {
string fileName = 1;
int64 chunkId =2; // Required to upload file parallely
bytes data = 3;
int64 seqNum = 4;
int64 seqMax = 5;
int64 maxChunks = 6;
}
message ProxyInfo {
string ip = 1;
string port = 2;
}
message FileLocationInfo {
string fileName = 1;
int64 maxChunks = 2;
repeated ProxyInfo lstProxy = 3;
bool isFileFound = 4;
}
message FileList {
repeated string lstFileNames = 1;
}
message ProxyList {
repeated ProxyInfo lstProxy = 1;
}
service DataTransferService {
// From team's client to team's own cluster
rpc RequestFileInfo (FileInfo) returns (FileLocationInfo);
// From team-1 cluster to rest of the nodes of other teams
rpc GetFileLocation (FileInfo) returns (FileLocationInfo);
// From team's client to the actual data-center node (can be any team's node)
rpc DownloadChunk (ChunkInfo) returns (stream FileMetaData);
rpc UploadFile (stream FileUploadData) returns (FileInfo);
// Interteam request
rpc ListFiles (RequestFileList) returns (FileList);
// Request File upload get back proxy list to
// return proxylist when raft consensus is reached
rpc RequestFileUpload(FileUploadInfo) returns (ProxyList);
}
// 1. Upload file
// 2. List files