github.com/status-im/status-go@v1.1.0/protocol/wakusync/progress_response.go (about) 1 package wakusync 2 3 import ( 4 "github.com/status-im/status-go/protocol/protobuf" 5 ) 6 7 type FetchingBackupedDataDetails struct { 8 DataNumber uint32 `json:"dataNumber,omitempty"` 9 TotalNumber uint32 `json:"totalNumber,omitempty"` 10 } 11 12 func (sfwr *WakuBackedUpDataResponse) AddFetchingBackedUpDataDetails(section string, details *protobuf.FetchingBackedUpDataDetails) { 13 if details == nil { 14 return 15 } 16 if sfwr.FetchingDataProgress == nil { 17 sfwr.FetchingDataProgress = make(map[string]*protobuf.FetchingBackedUpDataDetails) 18 } 19 20 sfwr.FetchingDataProgress[section] = details 21 } 22 23 func (sfwr *WakuBackedUpDataResponse) FetchingBackedUpDataDetails() map[string]FetchingBackupedDataDetails { 24 if len(sfwr.FetchingDataProgress) == 0 { 25 return nil 26 } 27 28 result := make(map[string]FetchingBackupedDataDetails) 29 for section, details := range sfwr.FetchingDataProgress { 30 result[section] = FetchingBackupedDataDetails{ 31 DataNumber: details.DataNumber, 32 TotalNumber: details.TotalNumber, 33 } 34 } 35 return result 36 }