2022-11-30 09:41:35 +00:00
|
|
|
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 {
|
2023-08-18 11:39:59 +00:00
|
|
|
sfwr.FetchingDataProgress = make(map[string]*protobuf.FetchingBackedUpDataDetails)
|
2022-11-30 09:41:35 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
sfwr.FetchingDataProgress[section] = details
|
2022-11-30 09:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|