-
Notifications
You must be signed in to change notification settings - Fork 243
/
progress_response.go
36 lines (30 loc) · 1001 Bytes
/
progress_response.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
26
27
28
29
30
31
32
33
34
35
36
package wakusync
import (
"github.com/status-im/status-go/protocol/protobuf"
)
type FetchingBackupedDataDetails struct {
DataNumber uint32 `json:"dataNumber,omitempty"`
TotalNumber uint32 `json:"totalNumber,omitempty"`
}
func (sfwr *WakuBackedUpDataResponse) AddFetchingBackedUpDataDetails(section string, details *protobuf.FetchingBackedUpDataDetails) {
if details == nil {
return
}
if sfwr.FetchingDataProgress == nil {
sfwr.FetchingDataProgress = make(map[string]protobuf.FetchingBackedUpDataDetails)
}
sfwr.FetchingDataProgress[section] = *details
}
func (sfwr *WakuBackedUpDataResponse) FetchingBackedUpDataDetails() map[string]FetchingBackupedDataDetails {
if len(sfwr.FetchingDataProgress) == 0 {
return nil
}
result := make(map[string]FetchingBackupedDataDetails)
for section, details := range sfwr.FetchingDataProgress {
result[section] = FetchingBackupedDataDetails{
DataNumber: details.DataNumber,
TotalNumber: details.TotalNumber,
}
}
return result
}