-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmsg.go
More file actions
41 lines (37 loc) · 1.41 KB
/
msg.go
File metadata and controls
41 lines (37 loc) · 1.41 KB
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
package gosync
// 须改进: 以嵌套的方式处理message, 排除不必要的字段, 减小网络流量
type Message struct {
TaskID string
MgID int // reserved
MgType string // cmd,auth,file,info,task
MgName string // cmd name, auth username, file name, info name, ** del: task: DefaultSync/UpdateSync**
MgByte []byte // file piece
MgString string // cmd option, autho user passwd, sync task target hosts
MgStrings []string
IntOption int // file piece number or other
StrOption string // start, continue, end
SrcPath string // src file path or task src path
DstPath string // dst file path or task dst path
Del bool // whether should the not exist files in src be deleted.
Zip bool // whether should files be compressed.
Overwrt bool // whether the conflicted files be overwrited.
B bool // other bool option
M map[hostIP]ret
}
// 定义一个小型的Message, 减小网络流量
type ClientRet struct {
MgID int
MgType string
M map[hostIP]ret
}
// type filePiece struct {
// TaskID string
// MgID int
// MgType string // "fileStream"
// MgName string // 文件名
// MgByte []byte // 文件内容切片
// IntOption int // 切片序号
// MgString string // 用于标识所有切片发送完成
// B bool // 是否是文件的最后一片
// Zip bool // 是否是元压缩文件(需解压缩)
// }